Skip to content

TypeTestUtil.isA confuses type Character from same package with java.lang.Character #4690

@Luro02

Description

@Luro02

Affects PMD Version: 7.0.0-rc3

Description:

TypeTestUtil.isA is used by PrimitiveWrapperInstantiationRule to check if a type is a primitive like a Character. The implementation is not correct, because with this code:

src/Character.java

public class Character {
    public Character(String string, Integer integer) {}
}

src/Test.java

public class Test {
    public void execute() {
        Character character = new Character("a", 1);
    }
}

the lint reports the new Character line, which is wrong. The code does compile and the constructor does not exist in java.lang.Character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugPMD crashes or fails to analyse a file.

    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