Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove useless check for java.lang in AbstractClassCouplingCheck #36

Closed
vmassol opened this Issue · 2 comments

2 participants

@vmassol

I see in the code of AbstractClassCouplingCheck that java.lang are meant to be excluded:

private boolean isSignificant(String aClassName)
{
    return (aClassName.length() > 0)
            && !mIgnoredClassNames.contains(aClassName)
            && !aClassName.startsWith("java.lang.");
}

However in practice they are not excluded since the class names that are checked do NOT have their full package name computed.
For example "java.lang.Class" gets counted since only "Class" is passed to isSignificant().

This is a a big issue...

Here's the file on which I've traced the issue: https://raw.github.com/xwiki/xwiki-commons/a10d6f9ef079c08ef3fd01dd6c1e2ff2a9cc6120/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-api/src/main/java/org/xwiki/component/util/ReflectionUtils.java

See https://sourceforge.net/p/checkstyle/bugs/684/

@vmassol vmassol referenced this issue from a commit in vmassol/checkstyle
@vmassol vmassol fix #36 : Remove useless check for java.lang in AbstractClassCoupling…
…Check
e9318f1
@isopov
Owner

This seems to have lost in numerous PRs for this line of code (we had 4):

I've tried writing

public java.lang.Integer _integer = new java.lang.Integer(1);

And only this line of code prevent it from being reported. So I'm for closing this issue as "wontfix" in its current form.

@isopov
Owner

Rejecting this issue, since it breaks current functionality.

@isopov isopov closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.