From 5bf3b5b5ece4321b0f9c4573a2863d4cc427e476 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 8 Aug 2011 23:48:13 +0200 Subject: Made the annotation processor 'work' on java6 and java7 without any warnings --- src/core/lombok/core/AnnotationProcessor.java | 9 +++++++-- src/core/lombok/javac/apt/Processor.java | 5 ----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/lombok/core/AnnotationProcessor.java b/src/core/lombok/core/AnnotationProcessor.java index 90f64352..f0260067 100644 --- a/src/core/lombok/core/AnnotationProcessor.java +++ b/src/core/lombok/core/AnnotationProcessor.java @@ -38,7 +38,6 @@ import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; @@ -47,7 +46,6 @@ import javax.tools.Diagnostic.Kind; import lombok.patcher.inject.LiveInjector; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class AnnotationProcessor extends AbstractProcessor { private static String trace(Throwable t) { StringWriter w = new StringWriter(); @@ -173,4 +171,11 @@ public class AnnotationProcessor extends AbstractProcessor { return handled; } + + /** + * We just return the latest version of whatever JDK we run on. Stupid? Yeah, but it's either that or warnings on all versions but 1. Blame Joe. + */ + @Override public SourceVersion getSupportedSourceVersion() { + return SourceVersion.values()[SourceVersion.values().length - 1]; + } } diff --git a/src/core/lombok/javac/apt/Processor.java b/src/core/lombok/javac/apt/Processor.java index ee9a9704..99170be1 100644 --- a/src/core/lombok/javac/apt/Processor.java +++ b/src/core/lombok/javac/apt/Processor.java @@ -37,9 +37,6 @@ import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Messager; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; @@ -67,8 +64,6 @@ import com.sun.tools.javac.util.Context; * To actually enable lombok in a javac compilation run, this class should be in the classpath when * running javac; that's the only requirement. */ -@SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_6) public class Processor extends AbstractProcessor { private JavacProcessingEnvironment processingEnv; -- cgit