Skip to content
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

[java] AvoidUsingOctalValues triggers on non-octal double literals with a leading 0 #5007

Closed
Gold856 opened this issue May 12, 2024 · 0 comments · Fixed by #5020
Closed

[java] AvoidUsingOctalValues triggers on non-octal double literals with a leading 0 #5007

Gold856 opened this issue May 12, 2024 · 0 comments · Fixed by #5020
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@Gold856
Copy link
Contributor

Gold856 commented May 12, 2024

Affects PMD Version: 7.1.0

Rule: AvoidUsingOctalValues

Description:

When a double literal has a leading 0, and ends with either d or .0, the literal is not treated as an octal value. However, PMD still reports a violation.

Code Sample demonstrating the issue:

double literal1 = 017.0; // Not octal!
double literal2 = 017d; // Also not octal!
double octal = 017; // Definitely octal!

Expected outcome:

PMD should only report a violation at line 3 only, but it reports on all three.

Running PMD through: Gradle

@Gold856 Gold856 added the a:false-positive PMD flags a piece of code that is not problematic label May 12, 2024
@Gold856 Gold856 changed the title [java] AvoidUsingOctalValues triggers on double literals with a leading 0 [java] AvoidUsingOctalValues triggers on non-octal double literals with a leading 0 May 15, 2024
@oowekyala oowekyala added this to the 7.2.0 milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants