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

Error occurred in compiler while compiling a case statement with final variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • tools
    • None
    • x86
    • windows_nt



      Name: diC59631 Date: 08/20/97


      I took this part of code from the original
      program and reproduced it in a test class:

      public class TestBug {

      private static String tw_sstr_TradeOutputFile;
      private static String tw_sstr_NewSecurityOutFile;
      private static String tw_sstr_PriceOutFile;
      private static String tw_sstr_PositionOutFile;
      private static String tw_sstr_EndOfTransOutFile;
      private static String tw_istr_OutputFile;

      private final char ONLINE_TRADE_FEED = '1';
      private final char ONLINE_NEW_SECURITY = '2';
      private final char ONLINE_PRICE_FEED = '3';
      private final char ONLINE_POSITION_FEED = '4';
      private final char END_OF_TRANSMISSION_RECORD = '5';

      TestBug()
      {
      char l_DataType = '0';

      //Get type of file
      switch (l_DataType) {
      case ONLINE_TRADE_FEED:
      tw_istr_OutputFile = tw_sstr_TradeOutputFile;
      break;
      case ONLINE_NEW_SECURITY:
      tw_istr_OutputFile = tw_sstr_NewSecurityOutFile;
      break;
      case ONLINE_PRICE_FEED:
      tw_istr_OutputFile = tw_sstr_PriceOutFile;
      break;
      case ONLINE_POSITION_FEED:
      tw_istr_OutputFile = tw_sstr_PositionOutFile;
      break;
      case END_OF_TRANSMISSION_RECORD:
      tw_istr_OutputFile = tw_sstr_EndOfTransOutFile;
      break;
      default:
      break;
      }

      }

      }

      When I try to compile the code, I get
      the following error:

      sun.tools.java.CompilerError: addReference TestBug this
       at sun.tools.java.ClassDefinition.addReference(ClassDefinition.java:1077)
       at sun.tools.java.ClassDefinition.getReference(ClassDefinition.java:1072)
       at sun.tools.tree.Context.noteReference(Context.java:308)
       at sun.tools.tree.Context.makeReference(Context.java:329)
       at sun.tools.tree.ThisExpression.checkValue(ThisExpression.java:76)
       at sun.tools.tree.Expression.checkAmbigName(Expression.java:210)
       at sun.tools.tree.FieldExpression.checkCommon(FieldExpression.java:135)
       at sun.tools.tree.FieldExpression.checkValue(FieldExpression.java:111)
       at sun.tools.tree.IdentifierExpression.checkValue(IdentifierExpression.java:224)
       at sun.tools.tree.CaseStatement.check(CaseStatement.java:46)
       at sun.tools.tree.SwitchStatement.check(SwitchStatement.java:66)
       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
      Tool returned code: 1

      company - UpTick Technologies, Inc. , email - ###@###.###
      ======================================================================

            tturnidgsunw Todd Turnidge (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: