diff --git a/docs/releasenotes.html b/docs/releasenotes.html index 4f4d62d7b..d88c3f937 100644 --- a/docs/releasenotes.html +++ b/docs/releasenotes.html @@ -103,6 +103,10 @@ checkstyle-user). contributed by Pierre Dittgen (request 978916). +
  • DataAbstractionCoupling reports coupling classes, + contributed by Benoit Xhenseval + (request 990055).
  • +

    diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java index d62dce2b2..25e015563 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java @@ -285,8 +285,10 @@ public abstract class AbstractClassCouplingCheck extends Check if (mReferencedClassNames.size() > mMax) { log(mLineNo, mColumnNo, getLogMessageId(), - new Integer(mReferencedClassNames.size()), - new Integer(getMax())); + new Object[] { + new Integer(mReferencedClassNames.size()), + new Integer(getMax()), + mReferencedClassNames.toString(), }); } } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/messages.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/messages.properties index d3cf677db..f6872093e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/messages.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/messages.properties @@ -1,5 +1,5 @@ booleanExpressionComplexity=Boolean expression complexity is {0,number,integer} (max allowed is {1,number,integer}). -classDataAbstractionCoupling=Class Data Abstraction Coupling is {0,number,integer} (max allowed is {1,number,integer}). +classDataAbstractionCoupling=Class Data Abstraction Coupling is {0,number,integer} (max allowed is {1,number,integer}) classes {2}. classFanOutComplexity=Class Fan-Out Complexity is {0,number,integer} (max allowed is {1,number,integer}). cyclomaticComplexity=Cyclomatic Complexity is {0,number,integer} (max allowed is {1,number,integer}). duplicateLiteral=Duplicate instances of literal ''{0}'' are not allowed. diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java index 7d45d6054..18ae3195a 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java @@ -14,8 +14,8 @@ public class ClassDataAbstractionCouplingCheckTest extends BaseCheckTestCase checkConfig.addAttribute("max", "0"); String[] expected = { - "6:1: Class Data Abstraction Coupling is 4 (max allowed is 0).", - "7:5: Class Data Abstraction Coupling is 1 (max allowed is 0).", + "6:1: Class Data Abstraction Coupling is 4 (max allowed is 0) classes [AnotherInnerClass, InnerClass, HashSet, HashMap].", + "7:5: Class Data Abstraction Coupling is 1 (max allowed is 0) classes [ArrayList].", }; verify(checkConfig,