diff options
5 files changed, 44 insertions, 13 deletions
diff --git a/buildScripts/compile.ant.xml b/buildScripts/compile.ant.xml index 54017496..bc1d3e8d 100644 --- a/buildScripts/compile.ant.xml +++ b/buildScripts/compile.ant.xml @@ -298,6 +298,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo> <attribute name="Can-Redefine-Classes" value="true" /> <attribute name="Main-Class" value="lombok.launch.Main" /> <attribute name="Lombok-Version" value="${lombok.version}" /> + <attribute name="Automatic-Module-Name" value="lombok" /> </manifest> </jar> <delete file="release-timestamp.txt" /> diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 053b102e..b58c2996 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -291,9 +291,7 @@ public class EclipseHandlerUtil { MarkerAnnotation ann = new MarkerAnnotation(copyType(annotation.type, source), pS); setGeneratedBy(ann, source); ann.declarationSourceEnd = ann.sourceEnd = ann.statementEnd = pE; - try { - reflectSet(ANNOTATION__MEMBER_VALUE_PAIR_NAME, ann, reflect(ANNOTATION__MEMBER_VALUE_PAIR_NAME, annotation)); - } catch (Exception ignore) { /* Various eclipse versions don't have it */ } + copyMemberValuePairName(ann, annotation); return ann; } @@ -302,9 +300,7 @@ public class EclipseHandlerUtil { setGeneratedBy(ann, source); ann.declarationSourceEnd = ann.sourceEnd = ann.statementEnd = pE; ann.memberValue = copyAnnotationMemberValue(((SingleMemberAnnotation) annotation).memberValue); - try { - reflectSet(ANNOTATION__MEMBER_VALUE_PAIR_NAME, ann, reflect(ANNOTATION__MEMBER_VALUE_PAIR_NAME, annotation)); - } catch (Exception ignore) { /* Various eclipse versions don't have it */ } + copyMemberValuePairName(ann, annotation); return ann; } @@ -320,15 +316,21 @@ public class EclipseHandlerUtil { for (int i = 0; i < inPairs.length; i++) ann.memberValuePairs[i] = new MemberValuePair(inPairs[i].name, inPairs[i].sourceStart, inPairs[i].sourceEnd, copyAnnotationMemberValue(inPairs[i].value)); } - try { - reflectSet(ANNOTATION__MEMBER_VALUE_PAIR_NAME, ann, reflect(ANNOTATION__MEMBER_VALUE_PAIR_NAME, annotation)); - } catch (Exception ignore) { /* Various eclipse versions don't have it */ } + copyMemberValuePairName(ann, annotation); return ann; } return annotation; } + private static void copyMemberValuePairName(Annotation source, Annotation target) { + if (ANNOTATION__MEMBER_VALUE_PAIR_NAME == null) return; + + try { + reflectSet(ANNOTATION__MEMBER_VALUE_PAIR_NAME, source, reflect(ANNOTATION__MEMBER_VALUE_PAIR_NAME, target)); + } catch (Exception ignore) { /* Various eclipse versions don't have it */ } + } + static class EclipseReflectiveMembers { public static final Field STRING_LITERAL__LINE_NUMBER; public static final Field ANNOTATION__MEMBER_VALUE_PAIR_NAME; diff --git a/test/configuration/src/lombok/core/configuration/TestConfiguration.java b/test/configuration/src/lombok/core/configuration/TestConfiguration.java index 504c36b2..ebb556de 100644 --- a/test/configuration/src/lombok/core/configuration/TestConfiguration.java +++ b/test/configuration/src/lombok/core/configuration/TestConfiguration.java @@ -65,8 +65,8 @@ public class TestConfiguration { outStream.flush(); errStream.flush(); - String out = new String(rawOut.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim(); - String err = new String(rawErr.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim(); + String out = new String(rawOut.toByteArray()).replace('\\', '/').replace("\r", "").replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim(); + String err = new String(rawErr.toByteArray()).replace('\\', '/').replace("\r", "").replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim(); checkContent(directory, out, "out"); checkContent(directory, err, "err"); diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java index e23a0f57..1498e635 100644 --- a/test/core/src/lombok/LombokTestSource.java +++ b/test/core/src/lombok/LombokTestSource.java @@ -65,11 +65,20 @@ public class LombokTestSource { public boolean runOnPlatform(String platform) { if (platforms == null || platforms.isEmpty()) return true; + int inclusiveCount = 0; for (String pl : platforms) { - if (pl.startsWith("!") && pl.regionMatches(true, 1, platform, 0, platform.length())) return false; + if (pl.startsWith("!")) continue; + inclusiveCount++; if (pl.equalsIgnoreCase(platform)) return true; } - return false; + if (inclusiveCount == platforms.size()) { + return false; + } + for (String pl : platforms) { + if (!pl.startsWith("!")) continue; + if (pl.regionMatches(true, 1, platform, 0, platform.length())) return false; + } + return true; } public boolean versionWithinLimit(int version) { diff --git a/test/transform/resource/before/DelegateOnLocalClass.java b/test/transform/resource/before/DelegateOnLocalClass.java new file mode 100644 index 00000000..7376c087 --- /dev/null +++ b/test/transform/resource/before/DelegateOnLocalClass.java @@ -0,0 +1,19 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. +//skip compare content +//ignore: crashed javac with NPE, should be enabled when that bug is fixed +import lombok.experimental.Delegate; +import lombok.Getter; + +interface DelegateOnLocalClass { + void test1() { + class DelegateOnStatic { + @Delegate private final java.lang.Runnable field = null; + } + } + + void test2() { + Runnable r = new Runnable() { + @Delegate private final java.lang.Runnable field = null; + } + } +} |