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

missing static qualifier causes a compiler error

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.1.2
    • tools
    • None
    • generic
    • solaris_2.5.1

      /*

      This file contains a typo, the static qualifier for the block
      that initializes foo has been commented out. This causes
      a compiler error:

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

      */

      import java.io.*;

      public class StaticTryCatchBug
      {
          static FileReader foo;
          /* static */ {
      try {
      foo = new FileReader("bar");
      }
      catch (FileNotFoundException x) {
      }
          }

          public static void main(String[] args) {
          }
      }

            tturnidgsunw Todd Turnidge (Inactive)
            sswingtrsunw Swingtraq Swingtraq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: