Skip to content

False-negative: HexLiteralCase does not throw violation on Hex float literals #18653

@Aman-Baliyan

Description

@Aman-Baliyan

I have read check documentation: https://checkstyle.org/checks/misc/hexliteralcase.html#HexLiteralCase
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

/var/tmp $ javac Test.java

PS C:\Users\amanc\Downloads\Ai_Interviewer\PracticeCheckStyle\src\temp> javac Test.java
PS C:\Users\amanc\Downloads\Ai_Interviewer\PracticeCheckStyle\src\temp>

/var/tmp $ cat config.xml

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
        "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
    <property name="localeLanguage" value="en"/>

    <module name="TreeWalker">
       <module name="HexLiteralCase">
       </module>
    </module>
</module>


/var/tmp $ cat Test.java

package temp;
public class Test {
    float a = 0x1a.8p1f; // expected violation for lowercase a
    float b = 0x1A.8p1f; // correct
    double c = 0x1c.8p1d; // expected violation for lowercase c
    double d = 0x1C.8p1d; // correct
}


/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-13.0.0-all.jar -c config.xml Test.java

Starting audit...
Audit done.

Describe what you expect in detail.
There should be violations in Test.java for HexLiteralCase but there are no violations . The HexLiteralCase module does not work for hex float literals


Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions