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

error in source crashes compiler with java.lang.StringIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1fcs
    • CPU:
      sparc
    • OS:
      solaris_2.4, solaris_2.5
    • Verification:
      Not verified

      Description



      Name: laC46010 Date: 01/20/97


      The test below causes compiler crash (jdk1.1beta3).
      jdk1.1beta2 reports a proper error message.

      t.java:
      public class t {
      void f() {
      float [] f = {1.0f};
      boolean b = false % f;
      }
      }

      /home/leo/java/bug> /export/ld32/dest/jdk1.1beta3/solaris/bin/javac t.java
      java.lang.StringIndexOutOfBoundsException: String index out of range: 1
      at java.lang.String.charAt(String.java)
      at java.text.MessageFormat.format(MessageFormat.java)
      at java.text.MessageFormat.format(MessageFormat.java)
      at java.text.MessageFormat.format(MessageFormat.java)
      at java.text.MessageFormat.format(MessageFormat.java)
      at sun.tools.javac.Main.getText(Main.java)
      at sun.tools.javac.BatchEnvironment.errorString(BatchEnvironment.java)
      at sun.tools.javac.BatchEnvironment.error(BatchEnvironment.java)
      at sun.tools.java.Environment.error(Environment.java)
      at sun.tools.java.Environment.error(Environment.java)
      at sun.tools.java.Environment.error(Environment.java)
      at sun.tools.java.Environment.error(Environment.java)
      at sun.tools.tree.Node.convert(Node.java)
      at sun.tools.tree.BinaryArithmeticExpression.selectType(BinaryArithmeticExpression.java)
      at sun.tools.tree.BinaryExpression.checkValue(BinaryExpression.java)
      at sun.tools.tree.Expression.checkInitializer(Expression.java)
      at sun.tools.tree.VarDeclarationStatement.checkDeclaration(VarDeclarationStatement.java)
      at sun.tools.tree.DeclarationStatement.check(DeclarationStatement.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 exception has occurred in the compiler; please file a bug report (###@###.###).
      1 error

      /home/leo/java/bug> /export/ld32/dest/jdk1.1beta2/solaris/bin/javac t.java
      t.java:4: Incompatible type for declaration. Can't convert int to boolean.
      boolean b = false % f;
      ^
      t.java:4: Incompatible type for %. Can't convert boolean to int.
      boolean b = false % f;
      ^
      t.java:4: Incompatible type for %. Can't convert float[] to int.
      boolean b = false % f;
      ^
      3 errors



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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tlindholsunw Timothy Lindholm (Inactive)
              Reporter:
              leosunw Leo Leo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: