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

internal compiler error while recompiling changed test source

XMLWordPrintable

    • 1.1.1
    • sparc
    • solaris_2.4
    • Not verified

      The test described below causes an internal compiler
      error: "sun.tools.java.CompilerError: codeConversion: 10, 13"

      The test is performed in two steps.

      Step 1. Compile the source containing definitions
      of an interface and a class. It produces two .class
      files: "Intrf1.class" and "stmt135.class"

      > cat stmt135.java
      interface Intrf1
      {
        int a = 0;
      }
      class stmt135
      {
        Intrf1 t = null;
        void f()
        {
           synchronized (t)
           {
             t = null;
           }
        }
      }

      > /usr/local/java/1.0/bin/javac stmt135.java
      >

      Step 2.
      Delete (or comment) the definition of the interface
      in the test source and recompile it. The compiler
      produces internal compiler error along with regular errors.
      It seems like it's the old "Intrf1.class" that
      causes the problem.

      > cat stmt135.java
      /*interface Intrf1
      {
        int a = 0;
      }*/
      class stmt135
      {
        Intrf1 t = null;
        void f()
        {
           synchronized (t)
           {
             t = null;
           }
        }
      }

      > /usr/local/java/1.0/bin/javac stmt135.java
      sun.tools.java.CompilerError: codeConversion: 10, 13
      at sun.tools.tree.Expression.codeConversion(Expression.java:450)
      at sun.tools.tree.ConvertExpression.codeValue(ConvertExpression.java:119)
      at sun.tools.tree.SynchronizedStatement.code(SynchronizedStatement.java:81)
      at sun.tools.javac.SourceField.code(SourceField.java:406)
      at sun.tools.javac.SourceField.code(SourceField.java:368)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:564)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:527)
      at sun.tools.javac.Main.compile(Main.java:193)
      at sun.tools.javac.Main.main(Main.java:289)
      .//stmt135.java:0: class stmt135:void f()@sun.tools.java.CompilerError: codeConversion: 10, 13
      /*interface Intrf1
      ^
      .//stmt135.java:5: Class stmt135 already defined in stmt135.java.
      class stmt135
            ^
      .//stmt135.java:7: Class Intrf1 not found in type declaration.
        Intrf1 t = null;
                 ^
      .//stmt135.java:10: Class Intrf1 not found in synchronized.
           synchronized (t)
           ^
      .//stmt135.java:10: Incompatible type for synchronized. Can't convert Intrf1 to java.lang.Object.
           synchronized (t)
           ^
      5 errors



      One more example.
      Step 1. Try compile first the following text:
      -------------arr039.java------------------
      class T extends Object {int z;}
      class arr039
      {
        public static void main(String argv[])
        {
           T[] a = new T[4];
           Object[] a1 = a;
        }
      }
      ------------------------------------------
      Step 2. Then change "T" to "A" in it and recompile:
      -------------arr039.java------------------
      class A extends Object {int z;}
      class arr039
      {
        public static void main(String argv[])
        {
           A[] a = new T[4];
           Object[] a1 = a;
        }
      }
      ------------------------------------------
      > /usr/local/java/1.0/bin/javac arr039.java
      sun.tools.java.CompilerError: codeConversion: 9, 13
      at sun.tools.tree.Expression.codeConversion(Expression.java:450)
      at sun.tools.tree.ConvertExpression.codeValue(ConvertExpression.java:119)
      at sun.tools.tree.VarDeclarationStatement.code(VarDeclarationStatement.java:156)
      at sun.tools.tree.DeclarationStatement.code(DeclarationStatement.java:81)
      at sun.tools.javac.SourceField.code(SourceField.java:406)
      at sun.tools.javac.SourceField.code(SourceField.java:368)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:564)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:527)
      at sun.tools.javac.Main.compile(Main.java:193)
      at sun.tools.javac.Main.main(Main.java:289)
      .//arr039.java:0: class arr039:void main(java.lang.String[])@sun.tools.java.CompilerError: codeConversion: 9, 13
      class A extends Object {int z;}
      ^
      .//arr039.java:1: Class A already defined in arr039.java.
      class A extends Object {int z;}
            ^
      .//arr039.java:2: Class arr039 already defined in arr039.java.
      class arr039
            ^
      .//arr039.java:6: Class T not found in declaration.
           A[] a = new T[4];
               ^
      .//arr039.java:6: Incompatible type for declaration. Can't convert T[] to A[].
           A[] a = new T[4];
               ^
      5 errors

            jrose John Rose
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: