New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassFanOutComplexity for a multi-dimensional array is calculating with an error. #5134

Closed
sergileon opened this Issue Sep 21, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@sergileon
Contributor

sergileon commented Sep 21, 2017

$ javac Test.java

$ cat Test.java

public class Test{
    protected Object[][] foo() {
        return new Object[][] {};
    }
}

$ cat config.xml

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
    <module name="TreeWalker">
         <module name="ClassFanOutComplexity">
		<property name="max" value="0"/>
         </module>
    </module>
</module>

$ java -jar checkstyle-8.3-SNAPSHOT-all.jar -c config.xml Test.java

Starting audit...
[ERROR] Test.java:1:1: Class Fan-Out Complexity is 1 (max allowed is 0). [ClassFanOutComplexity]
Audit done.
Checkstyle ends with 1 errors.

Expected is 0 error.
I think, createFullType found [ instead Object

@AADudkin

This comment has been minimized.

Show comment
Hide comment
@AADudkin

AADudkin commented Oct 18, 2017

i'm on it

@AADudkin

This comment has been minimized.

Show comment
Hide comment
@AADudkin

AADudkin Oct 23, 2017

Couldn't reproduce the issue. I tried following:

$ javac InputClassFanOutComplexityMultiDimensionalArray.java

$ cat InputClassFanOutComplexityMultiDimensionalArray.java
public class InputClassFanOutComplexityMultiDimensionalArray {
    public Object[][] get() {
        return new Object[][] {};
    }
}

$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
    <module name="TreeWalker">
         <module name="ClassFanOutComplexity">
                <property name="max" value="0"/>
         </module>
    </module>
</module>

$ java -jar checkstyle-8.4-SNAPSHOT-all.jar -c config.xml InputClassFanOutComplexityMultiDimensionalArray.java
Starting audit...
Audit done.

Got 0 errors as expected. Created corresponding test case in ClassFanOutComplexityCheckTest. Test is green.

AADudkin commented Oct 23, 2017

Couldn't reproduce the issue. I tried following:

$ javac InputClassFanOutComplexityMultiDimensionalArray.java

$ cat InputClassFanOutComplexityMultiDimensionalArray.java
public class InputClassFanOutComplexityMultiDimensionalArray {
    public Object[][] get() {
        return new Object[][] {};
    }
}

$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
    <module name="TreeWalker">
         <module name="ClassFanOutComplexity">
                <property name="max" value="0"/>
         </module>
    </module>
</module>

$ java -jar checkstyle-8.4-SNAPSHOT-all.jar -c config.xml InputClassFanOutComplexityMultiDimensionalArray.java
Starting audit...
Audit done.

Got 0 errors as expected. Created corresponding test case in ClassFanOutComplexityCheckTest. Test is green.

AADudkin pushed a commit to epam/checkstyle that referenced this issue Oct 23, 2017

AADudkin pushed a commit to epam/checkstyle that referenced this issue Oct 23, 2017

@rnveach

This comment has been minimized.

Show comment
Hide comment
@rnveach

rnveach Oct 23, 2017

Member

I get a violation with 8.2 release, not 8.3 .
I have not looked to see which commit caused the change.

Member

rnveach commented Oct 23, 2017

I get a violation with 8.2 release, not 8.3 .
I have not looked to see which commit caused the change.

@AADudkin

This comment has been minimized.

Show comment
Hide comment
@AADudkin

AADudkin Oct 25, 2017

Issue was fixed by @sergileon in commit 4645c22. Pull request #5109 is referenced at the start of this thread

AADudkin commented Oct 25, 2017

Issue was fixed by @sergileon in commit 4645c22. Pull request #5109 is referenced at the start of this thread

romani added a commit that referenced this issue Oct 26, 2017

@romani romani added this to the 8.4 milestone Oct 26, 2017

@Vladlis Vladlis closed this Oct 26, 2017

timurt added a commit to timurt/checkstyle that referenced this issue Dec 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment