-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
21
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows [Version 10.0.19045.3570]
A DESCRIPTION OF THE PROBLEM :
Run the testcase. This issue is not reproducible in openjdk 22-ea+19-1460. If this was fixed in version 22, the fix probably needs to be backported to version 21.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the testcase using "javac -g --release 21 --enable-preview Test.java"
2. Run "java --enable-preview Test"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.IllegalArgumentException: Not a number
at Test.main(Test.java:10)
ACTUAL -
Error: LinkageError occurred while loading main class Test
java.lang.ClassFormatError: Illegal field name "" in class Test
---------- BEGIN SOURCE ----------
public class Test
{
public static void main(String[] args) {
try
{
System.out.println(Double.valueOf("not a number"));
}
catch (NumberFormatException _)
{
throw new IllegalArgumentException("Not a number");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Compile classes without debug symbols (remove "-g")
FREQUENCY : always
Microsoft Windows [Version 10.0.19045.3570]
A DESCRIPTION OF THE PROBLEM :
Run the testcase. This issue is not reproducible in openjdk 22-ea+19-1460. If this was fixed in version 22, the fix probably needs to be backported to version 21.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the testcase using "javac -g --release 21 --enable-preview Test.java"
2. Run "java --enable-preview Test"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.IllegalArgumentException: Not a number
at Test.main(Test.java:10)
ACTUAL -
Error: LinkageError occurred while loading main class Test
java.lang.ClassFormatError: Illegal field name "" in class Test
---------- BEGIN SOURCE ----------
public class Test
{
public static void main(String[] args) {
try
{
System.out.println(Double.valueOf("not a number"));
}
catch (NumberFormatException _)
{
throw new IllegalArgumentException("Not a number");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Compile classes without debug symbols (remove "-g")
FREQUENCY : always
- duplicates
-
JDK-8315671 javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class
- Resolved