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

Try-catch in instance initializer causes compiler error

    XMLWordPrintable

Details

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

    Description

      Problem
      -------

      Try-catch in instance initializer causes compiler error

      Code Example
      ------------

      public class X {
      static Class yClass;

       {
          try {
              yClass = Class.forName("Y");
          } catch ( ClassNotFoundException e ) { }
       }
      }


      To Reproduce
      ------------

      Install SPARC Solaris 2.6

      Install the following SPARC Solaris JDK:

      java full version "Solaris_JDK_1.1.4_01_pre-release1"

      Compile the code attatched to this report and you will see:


      javac X.java
      sun.tools.java.CompilerError: copyInline
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Error.<init>(Compiled Code)
              at sun.tools.java.CompilerError.<init>(Compiled Code)
              at sun.tools.tree.TryStatement.copyInline(Compiled Code)
              at sun.tools.tree.CompoundStatement.copyInline(Compiled Code)
              at sun.tools.tree.InlineMethodExpression.copyInline(Compiled Code)
              at sun.tools.tree.MethodExpression.makeVarInits(Compiled Code)
              at sun.tools.tree.MethodExpression.checkValue(Compiled Code)
              at sun.tools.tree.MethodExpression.check(Compiled Code)
              at sun.tools.tree.ExpressionStatement.check(Compiled Code)
              at sun.tools.tree.Statement.checkBlockStatement(Compiled Code)
              at sun.tools.tree.CompoundStatement.check(Compiled Code)
              at sun.tools.tree.Statement.checkMethod(Compiled Code)
              at sun.tools.javac.SourceField.check(Compiled Code)
              at sun.tools.javac.SourceClass.checkFields(Compiled Code)
              at sun.tools.javac.SourceClass.checkInternal(Compiled Code)
              at sun.tools.javac.SourceClass.check(Compiled Code)
              at sun.tools.javac.Main.compile(Compiled Code)
              at sun.tools.javac.Main.main(Compiled Code)
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error

      Attachments

        Issue Links

          Activity

            People

              dstoutamsunw David Stoutamire (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: