diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2016-12-13 00:52:32 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2017-01-19 21:53:00 +0100 |
commit | b867f81b8a251a8a32e42f53c2be34d520938bd7 (patch) | |
tree | 2f1e248439cf2d0bf9cc6667f66aa8b073e004e7 /src/testAP/org | |
parent | cc28ef24ecda90862b42df4fa3072b924bb8b5ab (diff) | |
download | lombok-b867f81b8a251a8a32e42f53c2be34d520938bd7.tar.gz lombok-b867f81b8a251a8a32e42f53c2be34d520938bd7.tar.bz2 lombok-b867f81b8a251a8a32e42f53c2be34d520938bd7.zip |
Lombok will now also fix the typemirror info when generating bean-related methods/constructors, to allow other annotation processors to see these generated methods/constructors too.
Diffstat (limited to 'src/testAP/org')
-rw-r--r-- | src/testAP/org/projectlombok/testAp/TestAp.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/testAP/org/projectlombok/testAp/TestAp.java b/src/testAP/org/projectlombok/testAp/TestAp.java index 3deaf1c5..b5f20d21 100644 --- a/src/testAP/org/projectlombok/testAp/TestAp.java +++ b/src/testAP/org/projectlombok/testAp/TestAp.java @@ -30,7 +30,9 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; +import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeMirror; @SupportedAnnotationTypes("org.projectlombok.testAp.ExampleAnnotation") public final class TestAp extends AbstractProcessor { @@ -54,14 +56,17 @@ public final class TestAp extends AbstractProcessor { for (Element annotated : roundEnv.getElementsAnnotatedWith(ExampleAnnotation.class)) { annotatedElemCount++; for (Element child : annotated.getEnclosedElements()) { - if (child.getSimpleName().equals("getTest") && child.getKind() == ElementKind.METHOD) foundGetTest = true; - System.out.println(child); + if (child.getSimpleName().toString().equals("getTest") && child.getKind() == ElementKind.METHOD) foundGetTest = true; + if (child instanceof ExecutableElement) { + TypeMirror returnType = ((ExecutableElement) child).getReturnType(); + System.out.println("RETURN TYPE for " + child.getSimpleName() + ": " + returnType.getClass() + " -- " + returnType.toString()); + } } } if (foundGetTest) log("RESULT: POSITIVE -- found the getTest method"); - else if (annotatedElemCount > 0) log("RESULT: NEGATIVE-T1 -- found the example class but there's no getTest method in it according to the type mirror."); - else log("RESULT: NEGATIVE-T2 -- The example class is not provided by 'getElementsAnnotatedWith' in this rond."); + else if (annotatedElemCount > 0) log("RESULT: NEGATIVE -- found the example class but there's no getTest method in it according to the type mirror."); + else log("RESULT: AMBIVALENT -- The example class is not provided by 'getElementsAnnotatedWith' in this round. Not an issue, unless previously you got a NEGATIVE result."); return false; } |