-
Bug
-
Resolution: Fixed
-
P2
-
6
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;
}
}
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;
}
}