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

javac crash with ClassCastException excpetion throws

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description


      ###@###.### 2004-03-08

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b40)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b40, mixed mode)

      Does this problem occur on J2SE 1.3.x or 1.4.x? Yes / No (pick one)
        No

      Operating System Configuration Information (be specific):
        Linux

      Hardware Configuration Information (be specific):
        PC

      Bug Description:

      javac -source 1.5 UncheckedExceptions.java

      An exception has occurred in the compiler (1.5.0-beta2). Please file a
      bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug
      Parade for duplicates. Include your program and the following diagnostic
      in your report. Thank you.

      java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$ClassSymbol
          at com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1607)
          at com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1530)
          at com.sun.tools.javac.comp.Check.validateAnnotations(Check.java:1524)
          at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:514)
          at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:482)
          at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
          at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
          at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2337)
          at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2270)
          at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2221)
          at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:410)
          at com.sun.tools.javac.main.Main.compile(Main.java:586)
          at com.sun.tools.javac.main.Main.compile(Main.java:538)
          at com.sun.tools.javac.Main.compile(Main.java:44)
          at com.sun.tools.javac.Main.main(Main.java:35)

      Compilation exited abnormally with code 4 at Fri Mar 5 23:20:25



      Steps to Reproduce (be specific):

        Try to compile the following code with the build 40 javac:

      /**
       * Specifies one or more unchecked exceptions that may be thrown by a method.
       * The single member is an array of classes, and elements of the array must
       * extend RuntimeException. Classes that extend Error are not allowed.
       */
      public @interface UncheckedExceptions {

          public @interface Type {
          Class<? extends RuntimeException> value();
          }

          Type[] value();
      }

      class test {
          @UncheckedExceptions(
              {
              @UncheckedExceptions.Type(IllegalArgumentException.class),
              @UncheckedExceptions.Type(ArrayIndexOutOfBoundsException.class)
          }
          )
          public void foo() {
          throw new RuntimeException();
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gafter Neal Gafter
              Reporter:
              tyao Ting-Yun Ingrid Yao (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: