Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4214889

fails if unicode escapes are used to create a class name in a java source file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • tools
    • None
    • sparc
    • solaris_2.6

      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%


            rfield Robert Field (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: