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

crash when inner class method appends char to private string of enclosing class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1
    • 1.3.0
    • tools
    • ladybird
    • generic, x86
    • generic, windows_nt
    • Verified

        /**
         * @test %W% %E%
         * @bug 4318526
         * @author iag
         * @summary Verify that the compiler does not crash if a method in an inner
         * class appends a character to a string declared private in the enclosing
         * class.
         *
         * @run compile Test.java
         */

        public class Test {
            // s must be declared private.
            private String s = "";

            // This works.
            /*
            void m() {
        s += 'a';
            }
            */

            class Inner {
          void m() {
        // This works.
        // += "a";
          s += 'a';
          }
            }
        }

        $ jdk13; javac Formeleditor.java
        An exception has occurred in the compiler (1.3.0rc2). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and the following diagnostic in your report. Thank you.
        java.lang.InternalError: assertion failed
                at com.sun.tools.javac.v8.util.Util.assert(Util.java:25)
                at com.sun.tools.javac.v8.code.Code.emitop(Code.java:365)
                at com.sun.tools.javac.v8.code.Code.emitop(Code.java:376)
                at com.sun.tools.javac.v8.comp.Items$StackItem.drop(Items.java:287)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:873)
                at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
                at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:401)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:507)
                at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
                at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:477)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:452)
                at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1366)
                at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:302)
                at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:407)
                at com.sun.tools.javac.v8.Main.compile(Main.java:247)
                at com.sun.tools.javac.Main.main(Main.java:16)

        iris.garcia@eng 2000-03-02

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


        Subject: Bug Report
        Date: Thu, 7 Dec 2000 12:18:13 +0900
        From: "m-takata" <###@###.###>
        To: <###@###.###>

        JDK1.3,JDK1.2.2 compiled error.

        public class Test{
          private String s = "";
          public class Inner{
            public void set(){
              int i = 0;
              s += i;
            }
          }
        }

        java.lang.InternalError: assertion failed
                at com.sun.tools.javac.v8.util.Util.assert(Util.java:25)
                at com.sun.tools.javac.v8.code.Code.emitop(Code.java:365)
                at com.sun.tools.javac.v8.code.Code.emitop(Code.java:376)
                at com.sun.tools.javac.v8.comp.Items$StackItem.drop(Items.java:287)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:873)
                at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
                at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:401)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:507)
                at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
                at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:477)
                at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:452)
                at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
                at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
                at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1366)
                at
        com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:302)
                at
        com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:407)
                at com.sun.tools.javac.v8.Main.compile(Main.java:247)
                at com.sun.tools.javac.Main.main(Main.java:16)

        success sample1.

        public class Test{
          String s = ""; << not private
          public class Inner{
            public void set(){
              int i = 0;
              s += i;
            }
          }
        }

        success sample2.

        public class Test{
          private String s = "";
          public class Inner{
            public void set(){
              String i = ""; << not primitive
              s += i;
            }
          }
        }




        neal.gafter@Eng 2000-12-07

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

              gafter Neal Gafter (Inactive)
              iris Iris Clark
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: