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

javax.lang.model.element.TypeElement.getKind() throws CompletionFailure

XMLWordPrintable

    • generic, x86
    • generic, windows_xp

      It seems that since Mustang b75 the method javax.lang.model.element.TypeElement.getKind() throws unexpected exception for nonexistent type. Please see example below:

      ===
      import javax.annotation.processing.AbstractProcessor;
      import javax.annotation.processing.RoundEnvironment;
      import javax.annotation.processing.SupportedAnnotationTypes;
      import javax.lang.model.element.TypeElement;
      import java.util.Set;

      @SupportedAnnotationTypes("*")
      public class Test extends AbstractProcessor {
           public boolean process(Set<? extends TypeElement> tes,
              RoundEnvironment renv) {
               System.out.println("kind: " + processingEnv.getElementUtils().
              getTypeElement("nOneXisTenT").getKind());
               return true;
           }
      }
      ===
      ---------
      F:\projects\jck>Z:\lnk\re\jdk\6.0\latest\binaries\windows-i586\bin\javac.exe -cp classes -processor
      Test src/Test.java


      An annotation processor threw an uncaught exception.
      Consult the following stack trace for details.
      com.sun.tools.javac.code.Symbol$CompletionFailure: class file for nOneXisTenT not found

      Reproduced on jdk6 b75, windows xp, intel i586
      ---------

      It seems this behavior contradicts to spec that says
      ====
      TypeElement getTypeElement(String name)
      ...
           Returns:
               the named type element, or null if it cannot be found
      ===

            jjg Jonathan Gibbons
            agavrilosunw Alexey Gavrilov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: