diff options
32 files changed, 499 insertions, 200 deletions
@@ -32,7 +32,6 @@ the common tasks and can be called on to run the main aspects of all the sub-scr <property name="rt-openjdk8" location="lib/openJDK8Environment/openjdk8_rt.jar" /> <available file="${rt-openjdk6}" property="rt-openjdk6.available" /> <available file="${rt-openjdk8}" property="rt-openjdk8.available" /> - <property environment="env"/> <path id="build.path"> <fileset dir="lib/build"> @@ -368,43 +367,6 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo> <property name="lombok.dist.built" value="true" /> </target> - <target name="-mvn-ext"> - <condition property="mvn-ext" value=".cmd" else=""> - <os family="windows" /> - </condition> - </target> - - <target name="generate-pom" depends="version,dist"> - <echo message="Lombok version: ${lombok.version}-SNAPSHOT" /> - - <echo file="build/pom.xml"><![CDATA[<project> - <modelVersion>4.0.0</modelVersion> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>]]>${lombok.version}-SNAPSHOT<![CDATA[</version> -</project>]]></echo> - </target> - - <target name="install-maven" depends="generate-pom,-mvn-ext" description="Install THE lombok.jar into the local maven repository using Apache Maven"> - <condition property="mvn-exe" value="${env.MAVEN_HOME}/bin/mvn${mvn-ext}" else="mvn${mvn-ext}"> - <isset property="env.MAVEN_HOME" /> - </condition> - - <exec executable="${mvn-exe}" failifexecutionfails="false" resultproperty="mvn-result"> - <arg value="install:install-file" /> - <arg value="-Dfile=dist/lombok-${lombok.version}.jar" /> - <arg value="-DgroupId=org.projectlombok" /> - <arg value="-DartifactId=lombok" /> - <arg value="-Dversion=${lombok.version}-SNAPSHOT" /> - <arg value="-Dpackaging=jar" /> - <arg value="-DpomFile=build/pom.xml" /> - </exec> - <condition property="mvn-notfound" value="true"> - <not><isset property="mvn-result" /></not> - </condition> - <fail message="mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue." if="mvn-notfound" /> - </target> - <target name="dist-utils" description="Builds lombok-utils.jar, which is a library used by i.e. lombok.ast project." depends="version, compile"> <mkdir dir="dist" /> <jar destfile="dist/lombok-utils-${lombok.version}.jar"> @@ -835,7 +797,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The </ant> </target> - <target name="maven" depends="version, dist, javadoc" description="Build a maven artifact bundle."> + <target name="-prepare-maven" depends="version, dist, javadoc"> <jar destfile="dist/lombok-${lombok.version}-javadoc.jar"> <fileset dir="doc/api" /> </jar> @@ -850,13 +812,18 @@ You can also create your own by writing a 'testenvironment.properties' file. The <fileset dir="test/core/src" /> </jar> <mkdir dir="build/mavenPublish" /> + <!-- Could already be set for edge releases --> + <property name="lombok.version.mvn" value="${lombok.version}" /> <copy tofile="build/mavenPublish/pom.xml" overwrite="true" file="doc/maven-pom.xml"> <filterchain> <replacetokens> - <token key="VERSION" value="${lombok.version}" /> + <token key="VERSION" value="${lombok.version.mvn}" /> </replacetokens> </filterchain> </copy> + </target> + + <target name="maven" depends="-prepare-maven" description="Build a maven artifact bundle."> <tar destfile="build/mavenPublish/mavenPublish.tar.bz2" compression="bzip2"> <tarfileset dir="dist"> <include name="lombok-${lombok.version}.jar" /> @@ -924,12 +891,13 @@ You can also create your own by writing a 'testenvironment.properties' file. The username="${ssh.username}" keyfile="${ssh.keyfile}" knownHosts="ssh.knownHosts" /> + <echo>WARNING: You should now immediately run an edge release!</echo> </target> <target name="publish-all" depends="clean, version, website-publish, maven-publish, publish" description="Publishes lombok itself, updates the maven repository and the website." /> - <target name="edge-release" depends="config-ssh, clean, version, dist" + <target name="edge-release" depends="config-ssh, clean, version, dist, make-edge-as-maven_snapshot_repo" description="Publishes an edge release for those who need to test a cutting edge build."> <ant antfile="buildScripts/website.ant.xml" target="edgeRelease" inheritAll="false"> <property name="lombok.version" value="${lombok.version}" /> @@ -991,7 +959,42 @@ You can also create your own by writing a 'testenvironment.properties' file. The <property name="ssh.keyfile" value="${ssh.keyfile}" /> </ant> </target> - + + <target name="-mvn-ext"> + <condition property="mvn-ext" value=".cmd" else=""> + <os family="windows" /> + </condition> + </target> + + <target name="-version-edge"> + <property name="lombok.version.mvn" value="edge-SNAPSHOT" /> + </target> + + <target name="make-edge-as-maven_snapshot_repo" depends="-version-edge,-mvn-ext,-prepare-maven" description="Create a maven repo for the current snapshot into a build dir. The intent is for you to put that on a server someplace. Will invoke your local mvn installation."> + <property environment="env" /> + <delete quiet="true" dir="build/edge-releases" /> + <mkdir dir="build/edge-releases" /> + <condition property="mvn-exe" value="${env.MAVEN_HOME}/bin/mvn${mvn-ext}" else="mvn${mvn-ext}"> + <isset property="env.MAVEN_HOME" /> + </condition> + + <exec executable="${mvn-exe}" failifexecutionfails="false" resultproperty="mvn-result"> + <arg value="deploy:deploy-file" /> + <arg value="-Dfile=dist/lombok-${lombok.version}.jar" /> + <arg value="-Dsources=dist/lombok-${lombok.version}-sources.jar" /> + <arg value="-Djavadoc=dist/lombok-${lombok.version}-javadoc.jar" /> + <arg value="-DgroupId=org.projectlombok" /> + <arg value="-DartifactId=lombok" /> + <arg value="-Dversion=edge-SNAPSHOT" /> + <arg value="-DpomFile=build/mavenPublish/pom.xml" /> + <arg value="-Durl=file://${basedir}/build/edge-releases" /> + </exec> + <condition property="mvn-notfound" value="true"> + <not><isset property="mvn-result" /></not> + </condition> + <fail message="mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue." if="mvn-notfound" /> + </target> + <target name="testAp-compile" depends="ensureBuildDeps"> <delete file="build/testAP/META-INF/services/javax.annotation.processing.Processor" quiet="true" /> <ivy:compile destdir="build/testAP" source="1.7" target="1.7"> diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.24.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.24.xml deleted file mode 100644 index 87e1594f..00000000 --- a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.24.xml +++ /dev/null @@ -1,14 +0,0 @@ -<ivy-module version="2.0"> - <info organisation="org.projectlombok" module="lombok.patcher" revision="0.24" publication="20171128000000"> - <license name="MIT License" url="http://www.opensource.org/licenses/mit-license.php" /> - <ivyauthor name="rzwitserloot" url="http://zwitserloot.com/" /> - <ivyauthor name="rspilker" url="http://github.com/rspilker" /> - <description homepage="https://projectlombok.org/" /> - </info> - <configurations> - <conf name="default" /> - </configurations> - <publications> - <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.24.jar" /> - </publications> -</ivy-module> diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.28.xml index 6525604f..5ff77341 100644 --- a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml +++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.28.xml @@ -1,5 +1,5 @@ <ivy-module version="2.0"> - <info organisation="org.projectlombok" module="lombok.patcher" revision="0.26" publication="20180528200000"> + <info organisation="org.projectlombok" module="lombok.patcher" revision="0.28" publication="20180910222000"> <license name="MIT License" url="https://www.opensource.org/licenses/mit-license.php" /> <ivyauthor name="rzwitserloot" url="https://github.com/rzwitserloot" /> <ivyauthor name="rspilker" url="https://github.com/rspilker" /> @@ -9,6 +9,6 @@ <conf name="default" /> </configurations> <publications> - <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.26.jar" /> + <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.28.jar" /> </publications> </ivy-module> diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index 4eed2fa6..15c03ed1 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -18,7 +18,7 @@ <conf name="supporters" /> </configurations> <dependencies> - <dependency org="org.projectlombok" name="lombok.patcher" rev="0.26" conf="buildBase->default; runtime->default" /> + <dependency org="org.projectlombok" name="lombok.patcher" rev="0.28" conf="buildBase->default; runtime->default" /> <dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" /> <dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" /> diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 5c996fc6..a799e7fe 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -185,9 +185,11 @@ such as applying the templates to produce the website, converting the changelog <arg value="build/website-edge/download-edge.html" /> </java> <copy file="dist/lombok.jar" tofile="build/website-edge/lombok-edge.jar" /> - <tar destfile="dist/website-edge.tar.bz2" compression="bzip2"> <tarfileset dir="build/website-edge" /> + <tarfileset dir="build"> + <include name="edge-releases/**" /> + </tarfileset> </tar> </target> @@ -209,6 +211,23 @@ such as applying the templates to produce the website, converting the changelog username="${ssh.username}" keyfile="${ssh.keyfile}" knownHosts="ssh.knownHosts" /> + <exec executable="/usr/bin/git" failonerror="true"> + <arg value="merge-base" /> + <arg value="--is-ancestor" /> + <arg value="edge" /> + <arg value="master" /> + </exec> + <exec executable="/usr/bin/git"> + <arg value="branch" /> + <arg value="-f" /> + <arg value="edge" /> + <arg value="master" /> + </exec> + <exec executable="/usr/bin/git"> + <arg value="push" /> + <arg value="origin" /> + <arg value="edge:refs/heads/edge" /> + </exec> </target> <target name="javadoc" description="Generates the javadoc" depends="-ensure-version, -ensure-fullversion" unless="skip.javadoc"> diff --git a/doc/changelog.markdown b/doc/changelog.markdown index a294d6a1..04c9a052 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -2,10 +2,13 @@ Lombok Changelog ---------------- ### v1.18.3 "Edgy Guinea Pig" +* PLATFORM: Support for Eclipse Photon. [Issue #1831](https://github.com/rzwitserloot/lombok/issues/1831) * FEATURE: The `@FieldNameConstants` feature has been completely redesigned. [Issue #1774](https://github.com/rzwitserloot/lombok/issues/1774) [FieldNameConstants documentation](https://projectlombok.org/features/experimental/FieldNameConstants) * BUGFIX: When using lombok to compile modularized (`module-info.java`-style) code, if the module name has dots in it, it wouldn't work. [Issue #1808](https://github.com/rzwitserloot/lombok/issues/1808) * BUGFIX: Errors about lombok not reading a module providing `org.mapstruct.ap.spi` when trying to use lombok in jigsaw-mode on JDK 11. [Issue #1806](https://github.com/rzwitserloot/lombok/issues/1806) * BUGFIX: Fix NetBeans compile on save. [Issue #1770](https://github.com/rzwitserloot/lombok/issues/1770) +* PLATFORM: Angular IDE is now recognized by the installer [Issue #1830](https://github.com/rzwitserloot/lombok/issues/1830) + ### v1.18.2 (July 26th, 2018) * BUGFIX: mapstruct + lombok in eclipse should hopefully work again. [Issue #1359](https://github.com/rzwitserloot/lombok/issues/1359) and [mapstruct issue #1159](https://github.com/mapstruct/mapstruct/issues/1159) @@ -14,7 +17,6 @@ Lombok Changelog * BUGFIX: Lombok and gradle v4.9 didn't work together; that's been fixed. [Issue #1716](https://github.com/rzwitserloot/lombok/issues/1716) and [gradle-apt-plugin issue #87](https://github.com/tbroyer/gradle-apt-plugin/issues/87) * FEATURE: You can now make builders for type hierarchies, using the new (experimental) `@SuperBuilder` annotation. Thanks for the contribution, Jan Rieke. [`@SuperBuilder` documentation](https://projectlombok.org/features/experimental/SuperBuilder) * FEATURE: `@NoArgsConstructor`, including forcing one with `lombok.config: lombok.noArgsConstructor.extraPrivate=true` now take any defaults set with `@Builder.Default` into account. [Issue #1347](https://github.com/rzwitserloot/lombok/issues/1347) - ### v1.18.0 (June 5th, 2018) * BREAKING CHANGE: The in 1.16.22 introduced configuration key `lombok.noArgsConstructor.extraPrivate` is now `false` by default. [Issue #1708](https://github.com/rzwitserloot/lombok/issues/1708) * BUGFIX: Do not generate a private no-args constructor if that breaks the code. [Issue #1703](https://github.com/rzwitserloot/lombok/issues/1703), [Issue #1704](https://github.com/rzwitserloot/lombok/issues/1704), [Issue #1712](https://github.com/rzwitserloot/lombok/issues/1712) diff --git a/doc/maven-pom.xml b/doc/maven-pom.xml index baba7ca6..99643f64 100644 --- a/doc/maven-pom.xml +++ b/doc/maven-pom.xml @@ -21,8 +21,8 @@ <url>http://github.com/rzwitserloot/lombok</url> </scm> <issueManagement> - <system>Google Code</system> - <url>http://code.google.com/p/projectlombok/issues</url> + <system>GitHub Issues</system> + <url>https://github.com/rzwitserloot/lombok/issues</url> </issueManagement> <developers> <developer> @@ -30,18 +30,13 @@ <name>Reinier Zwitserloot</name> <email>reinier@projectlombok.org</email> <url>http://zwitserloot.com</url> - <timezone>+1</timezone> + <timezone>Europe/Amsterdam</timezone> </developer> <developer> <id>rspilker</id> <name>Roel Spilker</name> <email>roel@projectlombok.org</email> - <timezone>+1</timezone> - </developer> - <developer> - <id>rgrootjans</id> - <name>Robbert Jan Grootjans</name> - <timezone>+1</timezone> + <timezone>Europe/Amsterdam</timezone> </developer> </developers> </project> diff --git a/jitpack.yml b/jitpack.yml deleted file mode 100644 index b8c08047..00000000 --- a/jitpack.yml +++ /dev/null @@ -1,5 +0,0 @@ -jdk: -- openjdk10 -install: -- echo "Running a custom install command" -- ant install-maven
\ No newline at end of file diff --git a/src/core/lombok/eclipse/EclipseASTVisitor.java b/src/core/lombok/eclipse/EclipseASTVisitor.java index b2fd4b2f..37bda5e3 100644 --- a/src/core/lombok/eclipse/EclipseASTVisitor.java +++ b/src/core/lombok/eclipse/EclipseASTVisitor.java @@ -34,9 +34,14 @@ import org.eclipse.jdt.internal.compiler.ast.Argument; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.Initializer; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation; +import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; +import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; +import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; @@ -351,7 +356,23 @@ public interface EclipseASTVisitor { } public void visitAnnotationOnMethod(AbstractMethodDeclaration method, EclipseNode node, Annotation annotation) { - forcePrint("<ANNOTATION%s: %s%s />", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + forcePrint("<ANNOTATION%s: %s%s>", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + if (annotation instanceof MarkerAnnotation || disablePrinting != 0) { + forcePrint("<ANNOTATION%s: %s%s />", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + } else { + forcePrint("<ANNOTATION%s: %s%s>", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + indent++; + if (annotation instanceof SingleMemberAnnotation) { + Expression expr = ((SingleMemberAnnotation) annotation).memberValue; + print("<SINGLE-MEMBER-VALUE %s /> %s", expr.getClass(), expr); + } + if (annotation instanceof NormalAnnotation) { + for (MemberValuePair mvp : ((NormalAnnotation) annotation).memberValuePairs) { + print("<Member %s: %s /> %s", new String(mvp.name), mvp.value.getClass(), mvp.value); + } + } + indent--; + } } public void endVisitMethod(EclipseNode node, AbstractMethodDeclaration method) { diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index f89ef061..1e29764a 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -24,8 +24,10 @@ package lombok.eclipse.handlers; import static lombok.core.handlers.HandlerUtil.*; import static lombok.eclipse.Eclipse.*; import static lombok.eclipse.EclipseAugments.*; +import static lombok.eclipse.handlers.EclipseHandlerUtil.EclipseReflectiveMembers.*; import java.lang.reflect.Constructor; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -64,14 +66,22 @@ import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.CastExpression; +import org.eclipse.jdt.internal.compiler.ast.CharLiteral; +import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral; import org.eclipse.jdt.internal.compiler.ast.EqualExpression; import org.eclipse.jdt.internal.compiler.ast.Expression; +import org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral; +import org.eclipse.jdt.internal.compiler.ast.FalseLiteral; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.FieldReference; +import org.eclipse.jdt.internal.compiler.ast.FloatLiteral; import org.eclipse.jdt.internal.compiler.ast.IfStatement; import org.eclipse.jdt.internal.compiler.ast.IntLiteral; +import org.eclipse.jdt.internal.compiler.ast.Literal; +import org.eclipse.jdt.internal.compiler.ast.LongLiteral; import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation; import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; import org.eclipse.jdt.internal.compiler.ast.MessageSend; @@ -89,8 +99,10 @@ import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.StringLiteral; +import org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation; import org.eclipse.jdt.internal.compiler.ast.ThisReference; import org.eclipse.jdt.internal.compiler.ast.ThrowStatement; +import org.eclipse.jdt.internal.compiler.ast.TrueLiteral; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.eclipse.jdt.internal.compiler.ast.TypeReference; @@ -250,6 +262,9 @@ 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 */ } return ann; } @@ -257,8 +272,10 @@ public class EclipseHandlerUtil { SingleMemberAnnotation ann = new SingleMemberAnnotation(copyType(annotation.type, source), pS); setGeneratedBy(ann, source); ann.declarationSourceEnd = ann.sourceEnd = ann.statementEnd = pE; - //TODO memberValue(s) need to be copied as well (same for copying a NormalAnnotation as below). - ann.memberValue = ((SingleMemberAnnotation)annotation).memberValue; + 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 */ } return ann; } @@ -266,13 +283,138 @@ public class EclipseHandlerUtil { NormalAnnotation ann = new NormalAnnotation(copyType(annotation.type, source), pS); setGeneratedBy(ann, source); ann.declarationSourceEnd = ann.statementEnd = ann.sourceEnd = pE; - ann.memberValuePairs = ((NormalAnnotation)annotation).memberValuePairs; + MemberValuePair[] inPairs = ((NormalAnnotation) annotation).memberValuePairs; + if (inPairs == null) { + ann.memberValuePairs = null; + } else { + ann.memberValuePairs = new MemberValuePair[inPairs.length]; + 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 */ } return ann; } return annotation; } + static class EclipseReflectiveMembers { + public static final Field STRING_LITERAL__LINE_NUMBER; + public static final Field ANNOTATION__MEMBER_VALUE_PAIR_NAME; + public static final Field TYPE_REFERENCE__ANNOTATIONS; + static { + STRING_LITERAL__LINE_NUMBER = getField(StringLiteral.class, "lineNumber"); + ANNOTATION__MEMBER_VALUE_PAIR_NAME = getField(Annotation.class, "memberValuePairName"); + TYPE_REFERENCE__ANNOTATIONS = getField(TypeReference.class, "annotations"); + } + + public static int reflectInt(Field f, Object o) { + try { + return ((Number) f.get(o)).intValue(); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public static void reflectSet(Field f, Object o, Object v) { + try { + f.set(o, v); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public static Object reflect(Field f, Object o) { + try { + return f.get(o); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + private static Field getField(Class<?> c, String fName) { + try { + Field f = c.getDeclaredField(fName); + f.setAccessible(true); + return f; + } catch (Exception e) { + return null; + } + } + } + + private static Expression copyAnnotationMemberValue(Expression in) { + Expression out = copyAnnotationMemberValue0(in); + out.constant = in.constant; + return out; + } + + private static Expression copyAnnotationMemberValue0(Expression in) { + int s = in.sourceStart, e = in.sourceEnd; + + // literals + + if (in instanceof FalseLiteral) return new FalseLiteral(s, e); + if (in instanceof TrueLiteral) return new TrueLiteral(s, e); + if (in instanceof NullLiteral) return new NullLiteral(s, e); + + if (in instanceof CharLiteral) return new CharLiteral(((Literal) in).source(), s, e); + if (in instanceof DoubleLiteral) return new DoubleLiteral(((Literal) in).source(), s, e); + if (in instanceof FloatLiteral) return new FloatLiteral(((Literal) in).source(), s, e); + if (in instanceof IntLiteral) return IntLiteral.buildIntLiteral(((Literal) in).source(), s, e); + if (in instanceof LongLiteral) return LongLiteral.buildLongLiteral(((Literal) in).source(), s, e); + + if (in instanceof StringLiteral) return new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1); + if (in instanceof ExtendedStringLiteral) { + StringLiteral str = new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1); + StringLiteral empty = new StringLiteral(new char[0], s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1); + return new ExtendedStringLiteral(str, empty); + } + if (in instanceof StringLiteralConcatenation) { + Expression[] literals = ((StringLiteralConcatenation) in).literals; + // 0 and 1 len shouldn't happen. + if (literals.length == 0) return new StringLiteral(new char[0], s, e, 0); + if (literals.length == 1) return copyAnnotationMemberValue0(literals[0]); + StringLiteralConcatenation c = new StringLiteralConcatenation((StringLiteral) literals[0], (StringLiteral) literals[1]); + for (int i = 2; i < literals.length; i++) c = c.extendsWith((StringLiteral) literals[i]); + return c; + } + + // enums and field accesses (as long as those are references to compile time constant literals that's also acceptable) + + if (in instanceof SingleNameReference) { + SingleNameReference snr = (SingleNameReference) in; + long p = (long) s << 32 | e; + return new SingleNameReference(snr.token, p); + } + if (in instanceof QualifiedNameReference) { + QualifiedNameReference qnr = (QualifiedNameReference) in; + return new QualifiedNameReference(qnr.tokens, qnr.sourcePositions, s, e); + } + + // class refs + if (in instanceof ClassLiteralAccess) return new ClassLiteralAccess(e, copyType(((ClassLiteralAccess) in).type)); + + // arrays + if (in instanceof ArrayInitializer) { + Expression[] exprs = ((ArrayInitializer) in).expressions; + Expression[] copy = new Expression[exprs.length]; + for (int i = 0; i < exprs.length; i++) copy[i] = copyAnnotationMemberValue(exprs[i]); + ArrayInitializer out = new ArrayInitializer(); + out.sourceStart = s; + out.sourceEnd = e; + out.bits = in.bits; + out.implicitConversion = in.implicitConversion; + out.statementEnd = in.statementEnd; + out.expressions = copy; + return out; + } + + return in; + } + /** * You can't share TypeParameter objects or bad things happen; for example, one 'T' resolves differently * from another 'T', even for the same T in a single class file. Unfortunately the TypeParameter type hierarchy @@ -368,6 +510,7 @@ public class EclipseHandlerUtil { } TypeReference typeRef = new ParameterizedQualifiedTypeReference(iRef.tokens, args, iRef.dimensions(), copy(iRef.sourcePositions)); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } @@ -375,6 +518,7 @@ public class EclipseHandlerUtil { if (ref instanceof ArrayQualifiedTypeReference) { ArrayQualifiedTypeReference iRef = (ArrayQualifiedTypeReference) ref; TypeReference typeRef = new ArrayQualifiedTypeReference(iRef.tokens, iRef.dimensions(), copy(iRef.sourcePositions)); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } @@ -382,6 +526,7 @@ public class EclipseHandlerUtil { if (ref instanceof QualifiedTypeReference) { QualifiedTypeReference iRef = (QualifiedTypeReference) ref; TypeReference typeRef = new QualifiedTypeReference(iRef.tokens, copy(iRef.sourcePositions)); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } @@ -398,32 +543,36 @@ public class EclipseHandlerUtil { } } - TypeReference typeRef = new ParameterizedSingleTypeReference(iRef.token, args, iRef.dimensions(), (long)iRef.sourceStart << 32 | iRef.sourceEnd); + TypeReference typeRef = new ParameterizedSingleTypeReference(iRef.token, args, iRef.dimensions(), (long) iRef.sourceStart << 32 | iRef.sourceEnd); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } if (ref instanceof ArrayTypeReference) { ArrayTypeReference iRef = (ArrayTypeReference) ref; - TypeReference typeRef = new ArrayTypeReference(iRef.token, iRef.dimensions(), (long)iRef.sourceStart << 32 | iRef.sourceEnd); + TypeReference typeRef = new ArrayTypeReference(iRef.token, iRef.dimensions(), (long) iRef.sourceStart << 32 | iRef.sourceEnd); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } if (ref instanceof Wildcard) { - Wildcard original = (Wildcard)ref; + Wildcard original = (Wildcard) ref; Wildcard wildcard = new Wildcard(original.kind); wildcard.sourceStart = original.sourceStart; wildcard.sourceEnd = original.sourceEnd; if (original.bound != null) wildcard.bound = copyType(original.bound, source); + copyTypeAnns(ref, wildcard); if (source != null) setGeneratedBy(wildcard, source); return wildcard; } if (ref instanceof SingleTypeReference) { SingleTypeReference iRef = (SingleTypeReference) ref; - TypeReference typeRef = new SingleTypeReference(iRef.token, (long)iRef.sourceStart << 32 | iRef.sourceEnd); + TypeReference typeRef = new SingleTypeReference(iRef.token, (long) iRef.sourceStart << 32 | iRef.sourceEnd); + copyTypeAnns(ref, typeRef); if (source != null) setGeneratedBy(typeRef, source); return typeRef; } @@ -431,6 +580,30 @@ public class EclipseHandlerUtil { return ref; } + private static void copyTypeAnns(TypeReference in, TypeReference out) { + Annotation[][] a; + try { + a = (Annotation[][]) reflect(TYPE_REFERENCE__ANNOTATIONS, in); + } catch (Exception e) { + return; + } + + if (a == null) { + reflectSet(TYPE_REFERENCE__ANNOTATIONS, out, null); + return; + } + + Annotation[][] b = new Annotation[a.length][]; + for (int i = 0; i < a.length; i++) { + b[i] = new Annotation[a[i].length]; + for (int j = 0 ; j < a[i].length; j++) { + b[i][j] = copyAnnotation(a[i][j], a[i][j]); + } + } + + reflectSet(TYPE_REFERENCE__ANNOTATIONS, out, b); + } + public static Annotation[] copyAnnotations(ASTNode source, Annotation[]... allAnnotations) { List<Annotation> result = null; for (Annotation[] annotations : allAnnotations) { @@ -525,7 +698,7 @@ public class EclipseHandlerUtil { public static TypeReference cloneSelfType(EclipseNode context, ASTNode source) { int pS = source == null ? 0 : source.sourceStart, pE = source == null ? 0 : source.sourceEnd; - long p = (long)pS << 32 | pE; + long p = (long) pS << 32 | pE; EclipseNode type = context; TypeReference result = null; while (type != null && type.getKind() != Kind.TYPE) type = type.up(); diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 5d417bde..3b10483d 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -541,6 +541,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> { MessageSend emptyList = new MessageSend(); emptyList.receiver = generateQualifiedNameRef(source, TypeConstants.JAVA, TypeConstants.UTIL, "Collections".toCharArray()); emptyList.selector = EMPTY_LIST; + emptyList.typeArguments = copyTypes(bfd.singularData.getTypeArgs().toArray(new TypeReference[0])); ms.arguments = new Expression[] {new ConditionalExpression(ifNull, emptyList, tgt[1])}; } ms.receiver = receiver; diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index 91cd4abb..201b5048 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -516,7 +516,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { arg = tgt[0]; } else { JCExpression eqNull = maker.Binary(CTC_EQUAL, tgt[0], maker.Literal(CTC_BOT, null)); - JCExpression emptyList = maker.Apply(List.<JCExpression>nil(), chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil()); + List<JCExpression> tas = cloneTypes(maker, bfd.singularData.getTypeArgs(), ast, type.getContext()); + JCExpression emptyList = maker.Apply(tas, chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil()); arg = maker.Conditional(eqNull, emptyList, tgt[1]); } diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 570d1a7e..92c642d4 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1583,6 +1583,14 @@ public class JavacHandlerUtil { return node; } + public static List<JCExpression> cloneTypes(JavacTreeMaker maker, List<JCExpression> in, JCTree source, Context context) { + if (in.isEmpty()) return List.nil(); + if (in.size() == 1) return List.of(cloneType(maker, in.get(0), source, context)); + ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>(); + for (JCExpression expr : in) lb.append(cloneType(maker, expr, source, context)); + return lb.toList(); + } + /** * Creates a full clone of a given javac AST type node. Every part is cloned (every identifier, every select, every wildcard, every type apply). * diff --git a/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java b/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java new file mode 100644 index 00000000..6d580e13 --- /dev/null +++ b/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2018 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok.installer.eclipse; + +import java.util.Collections; + +import org.mangosdk.spi.ProviderFor; + +import lombok.installer.IdeLocationProvider; + +@ProviderFor(IdeLocationProvider.class) +public class AngularIDELocationProvider extends EclipseProductLocationProvider { + + private static final EclipseProductDescriptor ANGULAR = new StandardProductDescriptor( + "Angular IDE", + "angularide", + "angular", + AngularIDELocationProvider.class.getResource("angular.png"), + Collections.<String>emptySet() + ); + + public AngularIDELocationProvider() { + super(ANGULAR); + } +} diff --git a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java index 47e103aa..9bd3ae94 100644 --- a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java +++ b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java @@ -21,6 +21,7 @@ */ package lombok.installer.eclipse; +import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -34,7 +35,7 @@ import lombok.installer.OsUtils; public class StandardProductDescriptor implements EclipseProductDescriptor { private static final String USER_HOME = System.getProperty("user.home", "."); - private static final String[] WINDOWS_ROOTS = {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME}; + private static final String[] WINDOWS_ROOTS = windowsRoots(); private static final String[] MAC_ROOTS = {"/Applications", USER_HOME}; private static final String[] UNIX_ROOTS = {USER_HOME}; @@ -155,4 +156,16 @@ public class StandardProductDescriptor implements EclipseProductDescriptor { } return base + pathSeparator + alternative.replaceAll("[\\/]", "\\" + pathSeparator); } + + private static String[] windowsRoots() { + String localAppData = windowsLocalAppData(); + if (localAppData == null) return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME}; + return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME, localAppData}; + } + + private static String windowsLocalAppData() { + String localAppData = System.getenv("LOCALAPPDATA"); + File file = localAppData == null ? null : new File(localAppData); + return file != null && file.exists() && file.canRead() && file.isDirectory() ? localAppData : null; + } } diff --git a/src/installer/lombok/installer/eclipse/angular.png b/src/installer/lombok/installer/eclipse/angular.png Binary files differnew file mode 100644 index 00000000..d3204cd7 --- /dev/null +++ b/src/installer/lombok/installer/eclipse/angular.png diff --git a/src/utils/lombok/core/ClassLiteral.java b/src/utils/lombok/core/ClassLiteral.java index 077ead31..2008484b 100644 --- a/src/utils/lombok/core/ClassLiteral.java +++ b/src/utils/lombok/core/ClassLiteral.java @@ -1,13 +1,34 @@ +/* + * Copyright (C) 2018 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package lombok.core; public class ClassLiteral { - private final String className; - - public ClassLiteral(String className) { - this.className = className; - } - - public String getClassName() { - return className; - } + private final String className; + + public ClassLiteral(String className) { + this.className = className; + } + + public String getClassName() { + return className; + } } diff --git a/src/utils/lombok/core/FieldSelect.java b/src/utils/lombok/core/FieldSelect.java index ab784401..4c055105 100644 --- a/src/utils/lombok/core/FieldSelect.java +++ b/src/utils/lombok/core/FieldSelect.java @@ -1,13 +1,34 @@ +/* + * Copyright (C) 2018 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package lombok.core; public class FieldSelect { - private final String finalPart; - - public FieldSelect(String finalPart) { - this.finalPart = finalPart; - } - - public String getFinalPart() { - return finalPart; - } + private final String finalPart; + + public FieldSelect(String finalPart) { + this.finalPart = finalPart; + } + + public String getFinalPart() { + return finalPart; + } } diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 943a7a7a..5dbe3e2d 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -186,11 +186,11 @@ public class Eclipse { default: return null; } } else if (e instanceof ClassLiteralAccess) { - return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName())); + return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess) e).type.getTypeName())); } else if (e instanceof SingleNameReference) { return new FieldSelect(new String(((SingleNameReference)e).token)); } else if (e instanceof QualifiedNameReference) { - String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens); + String qName = Eclipse.toQualifiedName(((QualifiedNameReference) e).tokens); int idx = qName.lastIndexOf('.'); return new FieldSelect(idx == -1 ? qName : qName.substring(idx+1)); } else if (e instanceof UnaryExpression) { diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java index 1f472438..b0563858 100644 --- a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java +++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java @@ -58,6 +58,6 @@ class BuilderSingularToBuilderWithNull { } @java.lang.SuppressWarnings("all") public BuilderSingularToBuilderWithNullBuilder toBuilder() { - return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.emptyList() : this.elems); + return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.<String>emptyList() : this.elems); } } diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java index b644a16f..8615a40b 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilder.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java @@ -86,7 +86,7 @@ class BuilderWithToBuilder<T> { } @java.lang.SuppressWarnings("all") public BuilderWithToBuilderBuilder<T> toBuilder() { - return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.emptyList() : this.bars); + return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.<T>emptyList() : this.bars); } } class ConstructorWithToBuilder<T> { diff --git a/test/transform/resource/after-delombok/TypeUseAnnotations.java b/test/transform/resource/after-delombok/TypeUseAnnotations.java new file mode 100644 index 00000000..1e1536bf --- /dev/null +++ b/test/transform/resource/after-delombok/TypeUseAnnotations.java @@ -0,0 +1,14 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface TA { + int x(); +} +class TypeUseAnnotations { + List<@TA(x = 5) String> foo; + @java.lang.SuppressWarnings("all") + public List<@TA(x = 5) String> getFoo() { + return this.foo; + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java index 7265e17a..7feff6e9 100644 --- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java @@ -52,6 +52,6 @@ import lombok.Singular; return new BuilderSingularToBuilderWithNullBuilder(); } public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() { - return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.emptyList() : this.elems)); + return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.<String>emptyList() : this.elems)); } } diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java index b9cc27dd..a8935107 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java @@ -74,7 +74,7 @@ import lombok.Builder; return new BuilderWithToBuilderBuilder<T>(); } public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> toBuilder() { - return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(((this.bars == null) ? java.util.Collections.emptyList() : this.bars)); + return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(((this.bars == null) ? java.util.Collections.<T>emptyList() : this.bars)); } } @lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder<T> { diff --git a/test/transform/resource/after-ecj/TypeUseAnnotations.java b/test/transform/resource/after-ecj/TypeUseAnnotations.java new file mode 100644 index 00000000..156643b9 --- /dev/null +++ b/test/transform/resource/after-ecj/TypeUseAnnotations.java @@ -0,0 +1,15 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA { + int x(); +} +class TypeUseAnnotations { + @lombok.Getter List<@TA(x = 5) String> foo; + TypeUseAnnotations() { + super(); + } + public @java.lang.SuppressWarnings("all") List<@TA(x = 5) String> getFoo() { + return this.foo; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/TypeUseAnnotations.java b/test/transform/resource/before/TypeUseAnnotations.java new file mode 100644 index 00000000..c09a291d --- /dev/null +++ b/test/transform/resource/before/TypeUseAnnotations.java @@ -0,0 +1,11 @@ +//version 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface TA { + int x(); +} +class TypeUseAnnotations { + @lombok.Getter List<@TA(x=5) String> foo; +} diff --git a/website/resources/css/custom.css b/website/resources/css/custom.css index f81a3dd9..995f298a 100644 --- a/website/resources/css/custom.css +++ b/website/resources/css/custom.css @@ -7,6 +7,10 @@ margin-bottom: 40px; } +pre { + text-align: left; +} + .buttonLike { cursor: pointer; background: -webkit-linear-gradient(top, #FFFEF7, #CFCEC7); diff --git a/website/resources/files/pom.xml b/website/resources/files/pom.xml deleted file mode 100644 index 6562afe8..00000000 --- a/website/resources/files/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.projectlombok</groupId> - <artifactId>eclipse-compiler-test</artifactId> - <version>1.0-SNAPSHOT</version> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <lombok.version>1.16.8</lombok.version> - </properties> - - <dependencies> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.5.1</version> - <configuration> - <compilerId>eclipse</compilerId> - <source>1.8</source> - <target>1.8</target> - </configuration> - <dependencies> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-compiler-eclipse</artifactId> - <version>2.7</version> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - </dependency> - </dependencies> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>2.10</version> - <executions> - <execution> - <id>get-lombok</id> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - <type>jar</type> - <outputDirectory>${project.build.directory}</outputDirectory> - <destFileName>lombok.jar</destFileName> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> - </build> -</project> diff --git a/website/resources/js/supporters.js b/website/resources/js/supporters.js index 58db28cc..62beca81 100644 --- a/website/resources/js/supporters.js +++ b/website/resources/js/supporters.js @@ -77,7 +77,7 @@ ji.attr("title", n.text()); a.prepend(ji); }; - i.src = 'files/' + this.logo; + i.src = '/files/' + this.logo; } return d; } @@ -132,6 +132,7 @@ var supPerBar = 4; function updateSupporterBar() { var s = $(".supporterBar"); + if (s.length === 0) return; s.find(".introText").show(); s.append($("<div />").addClass("sbCnt")); var sf = s.find(".supporterFooter").show(); diff --git a/website/templates/_download-edge.html b/website/templates/_download-edge.html index 3fa28f83..0e04596c 100644 --- a/website/templates/_download-edge.html +++ b/website/templates/_download-edge.html @@ -10,7 +10,39 @@ </div><div class="row text-center"> <h2><a href="/lombok-edge.jar" id="downloadLink">Download edge release now!</a></h2> <p> - You can use the edge release also from your build tool using <a href="https://jitpack.io/#org.projectlombok/lombok/master-SNAPSHOT">the JitPack repository</a>. + You can use the edge release from maven using the projectlombok.org repository:<pre> +<repositories> + <repository> + <id>projectlombok.org</id> + <url>https://projectlombok.org/edge-releases</url> + </repository> +</repositories></pre> +<pre> +<dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>edge-SNAPSHOT</version> + <scope>provided</scope> + </dependency> +</dependencies></pre> + </p> + <p> + You can use the edge release from gradle using the projectlombok.org repository:<pre> +repositories { + mavenCentral() + maven { url 'https://projectlombok.org/edge-releases' } +} + +plugins { + id 'net.ltgt.apt' version '0.10' +} + +dependencies { + compileOnly 'org.projectlombok:lombok:edge-SNAPSHOT' + + apt 'org.projectlombok:lombok:edge-SNAPSHOT' +}</pre> </p> </div><div class="row text-center"> <p> diff --git a/website/templates/features/delombok.html b/website/templates/features/delombok.html index 6f41fc46..56b02f7d 100644 --- a/website/templates/features/delombok.html +++ b/website/templates/features/delombok.html @@ -17,22 +17,19 @@ <p> Delombok is included in <code>lombok.jar</code>. To use it, all you need to run on the command line is: - <div class="snippet"> - <pre>java -jar lombok.jar delombok src -d src-delomboked</pre> - </div><br /> + <pre>java -jar lombok.jar delombok src -d src-delomboked</pre> + <br /> Which will duplicate the contents of the <code>src</code> directory into the <code>src-delomboked</code> directory, which will be created if it doesn't already exist, but delomboked of course. Delombok on the command line has a few more options; use the <code>--help</code> parameter to see more options. </p><p> To let delombok print the transformation result of a single java file directly to standard output, you can use: - <div class="snippet"> - <pre>java -jar lombok.jar delombok -p MyJavaFile.java</pre> - </div> + <pre>java -jar lombok.jar delombok -p MyJavaFile.java</pre> </p> <@f.main.h3 title="Running delombok in ant" /> <p> <code>lombok.jar</code> includes an ant task which can apply delombok for you. For example, to create javadoc for your project, your <code>build.xml</code> file would look something like: - <div class="snippet"><pre><target name="javadoc"> + <pre><target name="javadoc"> <taskdef classname="lombok.delombok.ant.Tasks$Delombok" classpath="lib/lombok.jar" name="delombok" /> <mkdir dir="build/src-delomboked" /> <strong><delombok verbose="true" encoding="UTF-8" to="build/src-delomboked" from="src"></strong> @@ -41,7 +38,7 @@ <mkdir dir="build/api" /> <javadoc sourcepath="build/src-delomboked" defaultexcludes="yes" destdir="build/api" /> </target></pre> - </div><br /> + <br /> Instead of a <code>from</code> attribute, you can also nest <code><fileset></code> nodes. </p> diff --git a/website/templates/setup/gradle.html b/website/templates/setup/gradle.html index 41d90dcc..b3c7de3a 100644 --- a/website/templates/setup/gradle.html +++ b/website/templates/setup/gradle.html @@ -29,13 +29,13 @@ repositories { } plugins { - id 'net.ltgt.apt' version '0.10' + id 'net.ltgt.apt' version '0.10' } dependencies { compileOnly 'org.projectlombok:lombok:${version}' - apt "org.projectlombok:lombok:${version}" + apt 'org.projectlombok:lombok:${version}' }</pre> </p><p> Remember that you still have to download <code>lombok.jar</code> (or find it in gradle's caches) and run it as a jarfile, if you wish to program in eclipse. The plugin makes that part easier. |