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

Can't get tree from a top level class

    Details

    • Subcomponent:
    • Introduced In Build:
      b59
    • Introduced In Version:
      6
    • Resolved In Build:
      b59
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The annotation processor below throws a null pointer exception.

      import java.util.Set;
      import javax.annotation.processing.*;
      import javax.lang.model.element.*;
      import javax.lang.model.util.*;

      import com.sun.source.tree.*;
      import com.sun.tools.javac.api.Trees;

      @SupportedAnnotationTypes("*")
      public class MyAnnotationProcessor extends AbstractProcessor {
          public boolean process(Set<? extends TypeElement> annotations,
                                 RoundEnvironment roundEnvironment)
          {
              final Trees trees = Trees.instance(processingEnv);
              for (TypeElement e : roundEnvironment.getSpecifiedTypeElements()) {
                  ClassTree node = trees.getTree(e);
                  node.getClass();
              }
              return true;
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              ahe Peter Ahe
              Reporter:
              ahe Peter Ahe
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: