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

using of synthetic names in local class causes ClassFormatError

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      sparc
    • OS:
      solaris_7

      Backports

        Description



        Name: ngR10089 Date: 05/24/2001



        Java compiler jdk1.4.0beta-b65 creates class files rejected by VM. The test
        below reproduces the bug.

        > java -version
        java version "1.4.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
        Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

        > javac -d . test.java
        > java -Xfuture icls122.test
        Exception in thread "main" java.lang.ClassFormatError: icls122/test$1$InnClass
        (Repeative field name/signature)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:495)
        at
        java.security.SecureClassLoader.defineClass(SecureClassLoader.java:110)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:57)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:196)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:189)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:304)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:287)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:260)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at icls122.test.meth(test.java:39)
        at icls122.test.run(test.java:11)
        at icls122.test.main(test.java:7)
        >

        -----------------test.java------------------
        package icls122;
         
        import java.io.PrintStream;
         
        public class test {
        public static void main(String args[]) {
        System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String args[],PrintStream out) {
        int res1, res2;
        Intf ob = meth(1, 2);

        res1 = ob.getFirst();
        res2 = ob.getSecond();

        if ( res1 == 1 && res2 == 2 )
        return 0 /*STATUS_PASSED*/;
        out.println("Failed: res1=" + res1 +
        ", res2=" + res2);
        return 2 /*STATUS_FAILED*/;
        }
        interface Intf {
        int getFirst();
        int getSecond();
        }
        static Intf meth(final int prm1, final int zzz) {
        class InnClass implements Intf {
        Object val$prm1 = null;
        int val$zzz = 10;
        Object locVar;
        public int getFirst() {
        locVar = val$prm1;
        return prm1;
        }
        public int getSecond() {
        return zzz;
        }
        }
        return new InnClass();
        }
         }
        ----------------------------------------------------

        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                gafter Neal Gafter
                Reporter:
                nvgsunw Nvg Nvg (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: