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

Compiler crashes when trying to compile class using annotations not avail on CP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 6u18
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_18"
      Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I have also tested this issue on:
      SunOS io 5.10 Generic_118833-33 sun4v sparc SUNW,Sun-Fire-T200

      A DESCRIPTION OF THE PROBLEM :
      The JDK compiler crashes when trying to compile a class that imports a class, which has been already compiled (*) and uses the @TransactionAttribute annotation from the javax.ejb jar.

      (*) Of course this 2nd class has been compiled with the java.ejb jar available on the classpath.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1> mkdir a
      2> mkdir b
      3> mkdir j
      4> copy "%MAVEN_REPOSITORY%\javax\ejb\ejb\3.0\ejb-3.0.jar" j
      5> echo package a; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; public class C { @TransactionAttribute(Transactio
      nAttributeType.NOT_SUPPORTED)void m(){ } } > a\C.java
      6> echo import a.C; class T { void m() { } } > b\T.java
      7> javac -cp j\ejb-3.0.jar a\C.java
      8> javac b\T.java


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      .\a\C.class: warning: Cannot find annotation method 'value()' in type 'javax.ejb.TransactionAttribute': class file for javax.ejb.TransactionAttribute not found
      An exception has occurred in the compiler (1.6.0_18). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.ejb.TransactionAttributeType not found

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      File a\C.java:
      package a;
      import javax.ejb.TransactionAttribute;
      import javax.ejb.TransactionAttributeType;
      public class C {
      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
      void m(){ }
      }

      File b\T.java:
      import a.C;
      class T {
      void m() {
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Add the javax.ejb jar to the compiler classpath.

            jjg Jonathan Gibbons
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: