Skip to content

Remove useless check for java.lang in AbstractClassCouplingCheck #36

@vmassol

Description

@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/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions