[java] Fix test cases so that PMD can be built with Java19+
Fixes #4401
This commit is contained in:
parent
e6428eb6fd
commit
be59b47a48
@ -43,6 +43,8 @@ The remaining section describes the complete release notes for 7.0.0.
|
||||
|
||||
* miscellaneous
|
||||
* [#4582](https://github.com/pmd/pmd/issues/4582): \[dist] Download link broken
|
||||
* java
|
||||
* [#4401](https://github.com/pmd/pmd/issues/4401): \[java] PMD 7 fails to build under Java 19
|
||||
|
||||
#### API Changes
|
||||
|
||||
|
@ -34,12 +34,12 @@ public class ParserCornerCases17 {
|
||||
short aShort = (short)0b1010000101000101;
|
||||
|
||||
// Some 32-bit 'int' values:
|
||||
int anInt1 = 0b10100001010001011010000101000101;
|
||||
int anInt1 = 0b00000000100000000010100001010001;
|
||||
int anInt2 = 0b101;
|
||||
int anInt3 = 0B101; // The B can be upper or lower case.
|
||||
|
||||
// A 64-bit 'long' value. Note the "L" suffix:
|
||||
long aLong = 0b1010000101000101101000010100010110100001010001011010000101000101L;
|
||||
long aLong = 0b0000000000000000000000000000000000000000100010001000010000010000L;
|
||||
|
||||
int[] phases = {
|
||||
0b00110001,
|
||||
@ -70,14 +70,14 @@ public class ParserCornerCases17 {
|
||||
}
|
||||
|
||||
public void underscoreInNumericLiterals() {
|
||||
long creditCardNumber = 1234_5678_9012_3456L;
|
||||
long creditCardNumber = 1111_2222_3333_4444L;
|
||||
long socialSecurityNumber = 999_99_9999L;
|
||||
float pi = 3.14_15F;
|
||||
long hexBytes = 0xFF_EC_DE_5E;
|
||||
long hexWords = 0xCAFE_BABE;
|
||||
long hexBytes = 0x00_11_22_33;
|
||||
long hexWords = 0x0001_CAFE;
|
||||
long maxLong = 0x7fff_ffff_ffff_ffffL;
|
||||
byte nybbles = 0b0010_0101;
|
||||
long bytes = 0b11010010_01101001_10010100_10010010;
|
||||
long bytes = 0b00000000_10001000_10000100_00010000;
|
||||
|
||||
int _52 = 1;
|
||||
int x1 = _52; // This is an identifier, not a numeric literal
|
||||
|
@ -45,7 +45,7 @@
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "anInt1"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "anInt1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b10100001010001011010000101000101", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.705695045E9, @ValueAsFloat = 2.70569498E9, @ValueAsInt = -1589272251, @ValueAsLong = 2705695045]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00000000100000000010100001010001", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8398929.0, @ValueAsFloat = 8398929.0, @ValueAsInt = 8398929, @ValueAsLong = 8398929]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT]
|
||||
@ -63,7 +63,7 @@
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "aLong"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "aLong", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b1010000101000101101000010100010110100001010001011010000101000101L", @IntLiteral = false, @Integral = true, @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = -6.8258723397796086E18, @ValueAsFloat = -6.8258721E18, @ValueAsInt = -1589272251, @ValueAsLong = -6825872339779608251]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b0000000000000000000000000000000000000000100010001000010000010000L", @IntLiteral = false, @Integral = true, @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8946704.0, @ValueAsFloat = 8946704.0, @ValueAsInt = 8946704, @ValueAsLong = 8946704]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- ArrayType[@ArrayDepth = 1]
|
||||
@ -154,7 +154,7 @@
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "creditCardNumber"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "creditCardNumber", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1234_5678_9012_3456L", @IntLiteral = false, @Integral = true, @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.234567890123456E15, @ValueAsFloat = 1.23456795E15, @ValueAsInt = 1015724736, @ValueAsLong = 1234567890123456]
|
||||
| | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1111_2222_3333_4444L", @IntLiteral = false, @Integral = true, @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.111222233334444E15, @ValueAsFloat = 1.11122226E15, @ValueAsInt = -1770257748, @ValueAsLong = 1111222233334444]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
@ -172,13 +172,13 @@
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "hexBytes"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "hexBytes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0xFF_EC_DE_5E", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 4.293713502E9, @ValueAsFloat = 4.29371341E9, @ValueAsInt = -1253794, @ValueAsLong = 4293713502]
|
||||
| | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x00_11_22_33", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1122867.0, @ValueAsFloat = 1122867.0, @ValueAsInt = 1122867, @ValueAsLong = 1122867]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "hexWords"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "hexWords", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0xCAFE_BABE", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.405691582E9, @ValueAsFloat = 3.40569165E9, @ValueAsInt = -889275714, @ValueAsLong = 3405691582]
|
||||
| | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x0001_CAFE", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 117502.0, @ValueAsFloat = 117502.0, @ValueAsInt = 117502, @ValueAsLong = 117502]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
@ -196,7 +196,7 @@
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG]
|
||||
| | +- VariableDeclarator[@Initializer = true, @Name = "bytes"]
|
||||
| | +- VariableDeclaratorId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "bytes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b11010010_01101001_10010100_10010010", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.530134674E9, @ValueAsFloat = 3.53013478E9, @ValueAsInt = -764832622, @ValueAsLong = 3530134674]
|
||||
| | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00000000_10001000_10000100_00010000", @IntLiteral = true, @Integral = true, @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8946704.0, @ValueAsFloat = 8946704.0, @ValueAsInt = 8946704, @ValueAsLong = 8946704]
|
||||
| +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT]
|
||||
|
Loading…
x
Reference in New Issue
Block a user