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

Try-catch in instance initializer causes compiler error.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.2.0
    • 1.0.2, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6
    • tools
    • None
    • 1.2
    • generic, x86, sparc
    • generic, solaris_2.5, solaris_2.5.1, solaris_2.6, windows_95, windows_nt
    • Not verified



      Name: mc57594 Date: 03/12/97


      The following code chucks an exception in the compiler:
      class B {
          {
              try {
              }
              catch (Exception e) {}
          }
      }

      The error thrown is:

      sun.tools.java.CompilerError: copyInline
      at sun.tools.tree.TryStatement.copyInline(TryStatement.java:180)
      at sun.tools.tree.CompoundStatement.copyInline(CompoundStatement.java:137)

      at
      sun.tools.tree.InlineMethodExpression.copyInline(InlineMethodExpression.java
      :75)
      at sun.tools.tree.MethodExpression.makeVarInits(MethodExpression.java:559)

      at sun.tools.tree.MethodExpression.checkValue(MethodExpression.java:298)
      at sun.tools.tree.MethodExpression.check(MethodExpression.java:334)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:46)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:70)
      at sun.tools.tree.Statement.checkMethod(Statement.java:98)
      at sun.tools.javac.SourceField.check(SourceField.java:396)
      at sun.tools.javac.SourceClass.checkFields(SourceClass.java:780)
      at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:554)
      at sun.tools.javac.SourceClass.check(SourceClass.java:516)
      at sun.tools.javac.Main.compile(Main.java:306)
      at sun.tools.javac.Main.main(Main.java:456)
      ======================================================================
      [chamness 5/25/97] Marimba reported the same thing:

      Name: Klaas Waslander
      Company: Marimba Inc.
      Synopsis: copInLine error, when catching NoSuchMethodError in my class

      Description:
      The error:
      sun.tools.java.CompilerError: copyInline
              at sun.tools.tree.TryStatement.copyInline(TryStatement.java:180)
              at sun.tools.tree.CompoundStatement.copyInline(CompoundStatement.java:137)
              at sun.tools.tree.InlineMethodExpression.copyInline(InlineMethodExpression.java:75)
              at sun.tools.tree.MethodExpression.makeVarInits(MethodExpression.java:565)
              at sun.tools.tree.MethodExpression.checkValue(MethodExpression.java:304)
              at sun.tools.tree.MethodExpression.check(MethodExpression.java:340)
              at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:46)
              at sun.tools.tree.Statement.checkBlockStatement(Statement.java:120)
              at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:70)
              at sun.tools.tree.Statement.checkMethod(Statement.java:98)
              at sun.tools.javac.SourceField.check(SourceField.java:402)
              at sun.tools.javac.SourceClass.checkFields(SourceClass.java:852)
              at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:615)
              at sun.tools.javac.SourceClass.check(SourceClass.java:566)
              at sun.tools.javac.Main.compile(Main.java:318)
              at sun.tools.javac.Main.main(Main.java:473)


      Example source code that gives the error:

      import java.awt.*;
      public class Test extends Panel {
          {
      try {
      enableEvents(
      AWTEvent.COMPONENT_EVENT_MASK |
      AWTEvent.CONTAINER_EVENT_MASK |
      AWTEvent.FOCUS_EVENT_MASK |
      AWTEvent.KEY_EVENT_MASK |
      AWTEvent.MOUSE_EVENT_MASK |
      AWTEvent.MOUSE_MOTION_EVENT_MASK |
      AWTEvent.WINDOW_EVENT_MASK |
      AWTEvent.ACTION_EVENT_MASK |
      AWTEvent.ADJUSTMENT_EVENT_MASK |
      AWTEvent.ITEM_EVENT_MASK |
      AWTEvent.TEXT_EVENT_MASK
      );
      } catch (NoSuchMethodError e) {
      System.out.println("Not converting JDK11 events...");
      }
          }
      }

      Now: when commenting out the try/catch everything works fine!
      company - Marimba Inc. , email - ###@###.###

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


      roger.lewis@Eng 1997-07-16

      elease: 1.1.3
      Hardware: i586
      OSversion: win_95

      Synopsis: sun.tools.java.CompilerError: copyInline

      Description:
      Compiling my source code, which yields this exception:
      javac c:\Dev\M1\src\liebert\dpg\framework\db\LxLogManager.java
      sun.tools.java.CompilerError: copyInline
      at sun.tools.tree.TryStatement.copyInline(TryStatement.java:180)
      at sun.tools.tree.CompoundStatement.copyInline(CompoundStatement.java:137)
      at sun.tools.tree.InlineMethodExpression.copyInline(InlineMethodExpression.java:75)
      at sun.tools.tree.MethodExpression.makeVarInits(MethodExpression.java:565)
      at sun.tools.tree.MethodExpression.checkValue(MethodExpression.java:304)
      at sun.tools.tree.MethodExpression.check(MethodExpression.java:340)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:46)
      at sun.tools.tree.Statement.checkBlockStatement(Statement.java:120)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:70)
      at sun.tools.tree.Statement.checkMethod(Statement.java:98)
      at sun.tools.javac.SourceField.check(SourceField.java:402)
      at sun.tools.javac.SourceClass.checkFields(SourceClass.java:852)
      at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:615)
      at sun.tools.javac.SourceClass.check(SourceClass.java:566)
      at sun.tools.javac.Main.compile(Main.java:318)
      at sun.tools.javac.Main.main(Main.java:473)
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error

      I have just added the folowwing class initializer:
      public abstract class LxLogManager implements LxDebugScaffolding
      {
      {
      s_PlugInManager =
      new LxPlugInManager("liebert.dpg.framework.db.LxLogManager$LxLogger");
      try
      {
      s_PlugInManager.loadPlugIns("liebert\\dpg\\framework\\db", false);
      }
      catch (Throwable oops)
      {
      LxDBG.log("loadEm(): Caught " + oops.toString());
      }
      }

          // ....

           protected static LxPlugInManager s_PlugInManager;
         }
      company - Liebert Systems , email - ###@###.###

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

            tturnidgsunw Todd Turnidge (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: