aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lombok/javac/apt/Processor.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/lombok/javac/apt/Processor.java b/src/lombok/javac/apt/Processor.java
index 1ff1ee88..9c851762 100644
--- a/src/lombok/javac/apt/Processor.java
+++ b/src/lombok/javac/apt/Processor.java
@@ -64,26 +64,46 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class Processor extends AbstractProcessor {
+ private ProcessingEnvironment rawProcessingEnv;
private JavacProcessingEnvironment processingEnv;
private HandlerLibrary handlers;
private Trees trees;
+ private String errorToShow;
/** {@inheritDoc} */
@Override public void init(ProcessingEnvironment procEnv) {
super.init(procEnv);
- if (!(procEnv instanceof JavacProcessingEnvironment)) {
- procEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.");
+ this.rawProcessingEnv = procEnv;
+ String className = procEnv.getClass().getName();
+ if (className.startsWith("org.eclipse.jdt.")) {
+ errorToShow = "You should not install lombok.jar as an annotation processor in eclipse. Instead, run lombok.jar as a java application and follow the instructions.";
+ procEnv.getMessager().printMessage(Kind.WARNING, errorToShow);
this.processingEnv = null;
+ } else if (!procEnv.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment")) {
+ procEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.\n" +
+ "Your processor class is: " + className);
+ this.processingEnv = null;
+ this.errorToShow = null;
} else {
this.processingEnv = (JavacProcessingEnvironment) procEnv;
handlers = HandlerLibrary.load(procEnv.getMessager());
trees = Trees.instance(procEnv);
+ this.errorToShow = null;
}
}
/** {@inheritDoc} */
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (processingEnv == null) return false;
+ if (processingEnv == null) {
+ if (errorToShow != null) {
+ Set<? extends Element> rootElements = roundEnv.getRootElements();
+ if (!rootElements.isEmpty()) {
+ rawProcessingEnv.getMessager().printMessage(Kind.WARNING, errorToShow, rootElements.iterator().next());
+ errorToShow = null;
+ }
+ }
+ return false;
+ }
IdentityHashMap<JCCompilationUnit, Void> units = new IdentityHashMap<JCCompilationUnit, Void>();
for (Element element : roundEnv.getRootElements()) {