javap fails when unicode escapes are used to create a class name in a java
source file:
With Source classmini1.java:
// no.1
public class classmini1{
public static void main(String args[]){
String className = "\u6f22\u5b57";
String classToString = "class "+className;
\u6f22\u5b57 kanjiClass = new \u6f22\u5b57();
Class c = kanjiClass.getClass();
kanjiClass.kanjitest();
System.out.println("Success: " + classToString);
}
}
//
class \u6f22\u5b57{
public \u6f22\u5b57(){}
public static void kanjitest(){
System.out.println("In kanjitest");
}
}
//
javac compiles it fine and produces "W.class from 'class \u6f22\u5b57'
dugout% javap -c -l -private -s -verbose classmini1
Error: No binary file '??'
Compiled from classmini1.java
public class classmini1 extends java.lang.Object {
public static void main(java.lang.String[]);
/* ([Ljava/lang/String;)V */
/* Stack=4, Locals=4, Args_size=1 */
public classmini1();
/* ()V */
/* Stack=1, Locals=1, Args_size=1 */
}
Method void main(java.lang.String[])
0 ldc #3 <String "??">
2 astore_1
3 new #7 <Class java.lang.StringBuffer>
6 dup
7 ldc #2 <String "class ">
9 invokespecial #12 <Method java.lang.StringBuffer(java.lang.String)>
12 aload_1
13 invokevirtual #13 <Method java.lang.StringBuffer append(java.lang.String)>
16 invokevirtual #18 <Method java.lang.String toString()>
19 astore_2
20 new #9 <Class ??>
23 dup
24 invokespecial #11 <Method dugout%
source file:
With Source classmini1.java:
// no.1
public class classmini1{
public static void main(String args[]){
String className = "\u6f22\u5b57";
String classToString = "class "+className;
\u6f22\u5b57 kanjiClass = new \u6f22\u5b57();
Class c = kanjiClass.getClass();
kanjiClass.kanjitest();
System.out.println("Success: " + classToString);
}
}
//
class \u6f22\u5b57{
public \u6f22\u5b57(){}
public static void kanjitest(){
System.out.println("In kanjitest");
}
}
//
javac compiles it fine and produces "W.class from 'class \u6f22\u5b57'
dugout% javap -c -l -private -s -verbose classmini1
Error: No binary file '??'
Compiled from classmini1.java
public class classmini1 extends java.lang.Object {
public static void main(java.lang.String[]);
/* ([Ljava/lang/String;)V */
/* Stack=4, Locals=4, Args_size=1 */
public classmini1();
/* ()V */
/* Stack=1, Locals=1, Args_size=1 */
}
Method void main(java.lang.String[])
0 ldc #3 <String "??">
2 astore_1
3 new #7 <Class java.lang.StringBuffer>
6 dup
7 ldc #2 <String "class ">
9 invokespecial #12 <Method java.lang.StringBuffer(java.lang.String)>
12 aload_1
13 invokevirtual #13 <Method java.lang.StringBuffer append(java.lang.String)>
16 invokevirtual #18 <Method java.lang.String toString()>
19 astore_2
20 new #9 <Class ??>
23 dup
24 invokespecial #11 <Method dugout%
- duplicates
-
JDK-4215103 javac cannot find unicode named binary classes
- Closed
- relates to
-
JDK-4023102 (i18n) Class.forName doesn't work with a non-ASCII name
- Closed