Details
-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8-pool, 11, 17, 19, 20, 21
-
generic
-
generic
Description
ADDITIONAL SYSTEM INFORMATION :
- OS and version: Ubuntu 18.04.6 LTS
- CPU model: Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz
- Java version:
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Run `javap -c -v -p` on a compiled class file of a java source file that has a String with trailing spaces (e.g., "XXX "). The result does not show the entire "XXX " in the corresponding constant pool entry, instead, it is "XXX".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file `Test.java` with the following content:
```
public class Test{
public static void main(String[] args){
System.out.println("XXX ");
}
}
```
2. Run `javac Test.java`
3. Run `javap -c -v -p Test.class`
4. Check the #3 entry in the constant pool
5. Note that the line of #3 does not show the trailing spaces for the String "XXX "
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
" #3 = String #18 // XXX "
ACTUAL -
" #3 = String #18 // XXX"
---------- BEGIN SOURCE ----------
public class Test{
public static void main(String[] args){
System.out.println("XXX ");
}
}
---------- END SOURCE ----------
FREQUENCY : always
- OS and version: Ubuntu 18.04.6 LTS
- CPU model: Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz
- Java version:
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Run `javap -c -v -p` on a compiled class file of a java source file that has a String with trailing spaces (e.g., "XXX "). The result does not show the entire "XXX " in the corresponding constant pool entry, instead, it is "XXX".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file `Test.java` with the following content:
```
public class Test{
public static void main(String[] args){
System.out.println("XXX ");
}
}
```
2. Run `javac Test.java`
3. Run `javap -c -v -p Test.class`
4. Check the #3 entry in the constant pool
5. Note that the line of #3 does not show the trailing spaces for the String "XXX "
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
" #3 = String #18 // XXX "
ACTUAL -
" #3 = String #18 // XXX"
---------- BEGIN SOURCE ----------
public class Test{
public static void main(String[] args){
System.out.println("XXX ");
}
}
---------- END SOURCE ----------
FREQUENCY : always
Attachments
Issue Links
- duplicates
-
JDK-8258830 javap output for string literals needs improvement
- Open