Merge branch 'master' of git@github.com:rzwitserloot/lombok

This commit is contained in:
Roel Spilker committed 2011-05-03 02:26:15 +02:00
commit b93a582985
32 files changed
+394 -171

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ ivyCache
google.properties
debug
LombokizedEclipse.launch
libertad-upload.key
escudo-upload.key
findbugsReport.html
lib
.settings
@@ -14,4 +14,4 @@ lib
.factorypath
lombok.iml
.idea
*.markdown.html
*.markdown.html
+50 -29
View File
@@ -164,12 +164,15 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<target name="dist" description="Builds THE lombok.jar file which contains everything." depends="version, compile">
<mkdir dir="dist" />
<copy file="doc/changelog.markdown" tofile="build/changelog.txt" />
<jar destfile="dist/lombok-${lombok.version}.jar">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/build/jarjar.jar" />
<jarjar destfile="dist/lombok-${lombok.version}.jar">
<fileset dir="build/lombok">
<exclude name="com/sun/**"/>
</fileset>
<fileset dir="build" includes="changelog.txt" />
<fileset dir="." includes="LICENSE" />
<rule pattern="com.zwitserloot.cmdreader.**" result="lombok.libs.com.zwitserloot.cmdreader.@1" />
<rule pattern="org.objectweb.asm.**" result="lombok.libs.org.objectweb.asm.@1" />
<manifest>
<attribute name="Premain-Class" value="lombok.core.Agent" />
<attribute name="Agent-Class" value="lombok.core.Agent" />
@@ -177,7 +180,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<attribute name="Main-Class" value="lombok.core.Main" />
<attribute name="Lombok-Version" value="${lombok.version}" />
</manifest>
</jar>
</jarjar>
<copy file="dist/lombok-${lombok.version}.jar" tofile="dist/lombok.jar" />
<property name="lombok.dist.built" value="true" />
</target>
@@ -274,42 +277,60 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<echo level="info">All tests successful.</echo>
</target>
<target name="maven" depends="version, dist, test" description="Build a maven repository.">
<ivy:make-maven-repo
group="org.projectlombok" artifact="lombok"
version="${lombok.version}"
url="http://projectlombok.org/mavenrepo"
outfile="dist/maven.tar.bz2"
artifactfile="dist/lombok-${lombok.version}.jar"
pomfile="doc/maven-pom.xml">
<sources>
<fileset dir="src/core" />
<fileset dir="src/eclipseAgent" />
<fileset dir="src/installer" />
<fileset dir="src/delombok" />
<fileset dir="experimental/src" />
<fileset dir="test/transform/src" />
<fileset dir="test/core/src" />
</sources>
</ivy:make-maven-repo>
<target name="maven" depends="version, dist, test" description="Build a maven artifact bundle.">
<ant antfile="buildScripts/website.ant.xml" target="javadoc" inheritAll="false">
<property name="lombok.version" value="${lombok.version}" />
</ant>
<jar destfile="dist/lombok-${lombok.version}-javadoc.jar">
<fileset dir="doc/api" />
</jar>
<jar destfile="dist/lombok-${lombok.version}-sources.jar">
<fileset dir="src/core" />
<fileset dir="src/eclipseAgent" />
<fileset dir="src/installer" />
<fileset dir="src/delombok" />
<fileset dir="test/transform/src" />
<fileset dir="test/core/src" />
</jar>
<mkdir dir="build/mavenPublish" />
<copy tofile="build/mavenPublish/pom.xml" overwrite="true" file="doc/maven-pom.xml">
<filterchain>
<replacetokens>
<token key="VERSION" value="${lombok.version}" />
</replacetokens>
</filterchain>
</copy>
<tar destfile="build/mavenPublish/mavenPublish.tar.bz2" compression="bzip2">
<tarfileset dir="dist">
<include name="lombok-${lombok.version}.jar" />
<include name="lombok-${lombok.version}-sources.jar" />
<include name="lombok-${lombok.version}-javadoc.jar" />
</tarfileset>
<tarfileset dir="build/mavenPublish" includes="pom.xml" />
</tar>
</target>
<target name="maven-publish" depends="maven" description="Build a maven repository then upload it to projectlombok.org.">
<target name="maven-publish" depends="maven" description="Build a maven artifact bundle then upload it to projectlombok.org and ask the server to upload it to maven central">
<taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="build.path" />
<taskdef name="sshexec" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="build.path" />
<available file="libertad-upload.key" property="libertad.key.available" />
<fail unless="libertad.key.available">You don't have the libertad-upload.key; you'll need it to get write access to the server.</fail>
<available file="escudo-upload.key" property="escudo.key.available" />
<fail unless="escudo.key.available">You don't have the escudo-upload.key; you'll need it to get write access to the server.</fail>
<scp
localFile="dist/maven.tar.bz2"
localFile="build/mavenPublish/mavenPublish.tar.bz2"
todir="lombokup@projectlombok.org:/staging"
keyfile="libertad-upload.key" passphrase=""
sftp="true" verbose="true" trust="true" />
keyfile="escudo-upload.key" passphrase=""
sftp="false" verbose="true" trust="true" />
<sshexec
host="projectlombok.org"
username="lombokup"
keyfile="libertad-upload.key" passphrase=""
trust="true" command="./deployMavenRepo" />
keyfile="escudo-upload.key" passphrase=""
trust="true" command="./publishToMavenCentral" />
<echo>The artifact has been published to staging. Now go to http://oss.sonatype.org/ and log in as Reinier, then doublecheck if all is well and 'release' it.</echo>
<sshexec
host="projectlombok.org"
username="lombokup"
keyfile="escudo-upload.key" passphrase=""
trust="true" command="./showMavenCentralPassword" />
</target>
<target name="-credentials">
@@ -1,14 +0,0 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="ecj" revision="3.6.0" publication="20100608091100">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://mirror.selfnet.de/eclipse/eclipse/downloads/drops/R-3.6-201006080911/ecj-3.6.jar" />
<artifact type="zip" conf="sources" url="http://mirror.selfnet.de/eclipse/eclipse/downloads/drops/R-3.6-201006080911/ecjsrc-3.6.zip" />
</publications>
</ivy-module>
@@ -1,12 +0,0 @@
<ivy-module version="2.0">
<info organisation="jcraft.com" module="jsch" revision="0.1.42" publication="20100225011200">
<license name="BSD" url="http://www.jcraft.com/jsch/LICENSE.txt" />
<description homepage="http://www.jcraft.com/jsch/" />
</info>
<configurations>
<conf name="build" />
</configurations>
<publications>
<artifact conf="build" url="http://mesh.dl.sourceforge.net/project/jsch/jsch.jar/0.1.42/jsch-0.1.42.jar" />
</publications>
</ivy-module>
@@ -1,14 +1,14 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="core.runtime" revision="3.6.0" publication="20100505120000">
<info organisation="org.eclipse.custom" module="core.runtime" revision="3.6.0" publication="20100505120000">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.core.runtime_3.6.0.v20100505.jar" />
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.core.runtime_3.6.0.v20100505.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.core.runtime_3.6.0.v20100505-sources.jar" />
</publications>
</ivy-module>
@@ -0,0 +1,14 @@
<ivy-module version="2.0">
<info organisation="org.eclipse.custom" module="ecj" revision="3.6.2" publication="20110401190400">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/ecj-3.6.2.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/ecjsrc-3.6.2.zip" />
</publications>
</ivy-module>
@@ -1,14 +1,14 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="equinox.common" revision="3.6.0" publication="20100503120000">
<info organisation="org.eclipse.custom" module="equinox.common" revision="3.6.0" publication="20100503120000">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.equinox.common_3.6.0.v20100503.jar" />
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.equinox.common_3.6.0.v20100503.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.equinox.common_3.6.0.v20100503-sources.jar" />
</publications>
</ivy-module>
</ivy-module>
@@ -1,14 +1,14 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="jdt.core" revision="3.6.0" publication="20100505120000">
<info organisation="org.eclipse.custom" module="jdt.core" revision="3.6.0" publication="20100505120000">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.core_3.6.0.v_A58.jar" />
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.core_3.6.0.v_A58.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.core_3.6.0.v_A58-sources.jar" />
</publications>
</ivy-module>
@@ -1,14 +1,14 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="jdt.ui" revision="3.6.0" publication="20100602160000">
<info organisation="org.eclipse.custom" module="jdt.ui" revision="3.6.0" publication="20100602160000">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.ui_3.6.0.v20100602-1600.jar" />
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.ui_3.6.0.v20100602-1600.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.jdt.ui_3.6.0.v20100602-1600-sources.jar" />
</publications>
</ivy-module>
@@ -1,14 +1,14 @@
<ivy-module version="2.0">
<info organisation="eclipse.org" module="osgi" revision="3.6.0" publication="20100517120000">
<info organisation="org.eclipse.custom" module="osgi" revision="3.6.0" publication="20100517120000">
<license name="Eclipse Public Licence v1.0" url="http://www.eclipse.org/org/documents/epl-v10.php" />
<description homepage="http://www.eclipse.org/eclipse/" />
</info>
<configurations>
<conf name="runtime" />
<conf name="default" />
<conf name="sources" />
</configurations>
<publications>
<artifact conf="runtime" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.osgi_3.6.0.v20100517.jar" />
<artifact conf="default" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.osgi_3.6.0.v20100517.jar" />
<artifact type="zip" conf="sources" url="http://projectlombok.org/ivyrepo/eclipse/org.eclipse.osgi_3.6.0.v20100517-sources.jar" />
</publications>
</ivy-module>
@@ -1,13 +0,0 @@
<ivy-module version="2.0">
<info organisation="projectlombok.org" module="junit" revision="4.8.1" publication="20100225011200">
<license name="MIT License" url="http://www.opensource.org/licenses/mit-license.php" />
<ivyauthor name="KentBeck" url="http://www.threeriversinstitute.org/Kent%20Beck.htm" />
<description homepage="http://junit.org/" />
</info>
<configurations>
<conf name="test" />
</configurations>
<publications>
<artifact conf="test" url="http://cloud.github.com/downloads/KentBeck/junit/junit-4.8.1.jar" />
</publications>
</ivy-module>
+14 -13
View File
@@ -12,31 +12,32 @@
<dependency org="projectlombok.org" name="lombok.patcher" rev="0.4" conf="build; runtime->build" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="build->runtime; runtime" />
<dependency org="projectlombok.org" name="junit" rev="4.8.1" conf="test" />
<dependency org="log4j" name="log4j" rev="1.2.16" conf="test->master"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->master"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->master"/>
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
<dependency org="log4j" name="log4j" rev="1.2.16" conf="test->default; contrib->sources" />
<dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->default; contrib->sources"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->default; contrib->sources"/>
<dependency org="com.googlecode.jarjar" name="jarjar" rev="1.1" conf="build->default" />
<dependency org="org.apache.ant" name="ant" rev="1.8.0" conf="build->master" />
<dependency org="org.apache.ant" name="ant" rev="1.8.0" conf="build->default; contrib->sources" />
<dependency org="projectlombok.org" name="spi" rev="0.2.4" conf="build" />
<dependency org="projectlombok.org" name="ant-googlecode" rev="0.0.2" conf="build" />
<dependency org="jcraft.com" name="jsch" rev="0.1.42" conf="build" />
<dependency org="com.jcraft" name="jsch" rev="0.1.42" conf="build->default" />
<dependency org="projectlombok.org" name="jsch-ant-fixed" rev="0.1.42" conf="build" />
<dependency org="projectlombok.org" name="markdownj" rev="1.02b4" conf="build" />
<dependency org="de.java2html" name="java2html" rev="5.0" conf="build->master" />
<dependency org="de.java2html" name="java2html" rev="5.0" conf="build->default" />
<dependency org="projectlombok.org" name="javac" rev="1.6.0.18" conf="build->runtime; contrib->sources" />
<dependency org="eclipse.org" name="ecj" rev="3.6.0" conf="build->runtime; contrib->sources" />
<dependency org="org.eclipse.custom" name="ecj" rev="3.6.2" conf="build->default; contrib->sources" />
<dependency org="netbeans.org" name="boot" rev="6.8beta" conf="netbeansBuild->build" />
<dependency org="netbeans.org" name="openide.modules" rev="6.8beta" conf="netbeansBuild->build" />
<dependency org="netbeans.org" name="openide.util" rev="6.8beta" conf="netbeansBuild->build" />
<dependency org="netbeans.org" name="modules.java.source" rev="6.8beta" conf="netbeansBuild->build" />
<dependency org="eclipse.org" name="core.runtime" rev="3.6.0" conf="eclipseBuild->runtime; contrib->sources" />
<dependency org="eclipse.org" name="jdt.core" rev="3.6.0" conf="eclipseBuild->runtime; contrib->sources" />
<dependency org="eclipse.org" name="jdt.ui" rev="3.6.0" conf="eclipseBuild->runtime; contrib->sources" />
<dependency org="eclipse.org" name="equinox.common" rev="3.6.0" conf="eclipseBuild->runtime; contrib->sources" />
<dependency org="eclipse.org" name="osgi" rev="3.6.0" conf="eclipseBuild->runtime; contrib->sources" />
<dependency org="org.eclipse.custom" name="core.runtime" rev="3.6.0" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="jdt.core" rev="3.6.0" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="jdt.ui" rev="3.6.0" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="equinox.common" rev="3.6.0" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="osgi" rev="3.6.0" conf="eclipseBuild->default; contrib->sources" />
</dependencies>
</ivy-module>
+3
View File
@@ -144,6 +144,9 @@ such as converting the changelog into HTML, and creating javadoc.
<antcall target="-integrateSnippet">
<param name="transformationName" value="Delegate" />
</antcall>
<antcall target="-integrateSnippet">
<param name="transformationName" value="onX" />
</antcall>
</target>
<target name="-website-dist">
+26 -9
View File
@@ -12,20 +12,37 @@
<licenses>
<license>
<name>The MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<url>http://projectlombok.org/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/rzwitserloot/lombok.git</connection>
<url>scm:git:git://github.com/rzwitserloot/lombok.git</url>
<url>http://github.com/rzwitserloot/lombok</url>
</scm>
<!--
For auto-syncing to the main maven repository:
"org.projectlombok","mavensync@projectlombok.org:/home/mavensync/public_html/m2repo","rsync_ssh","Reinier Zwitserloot", "reinier@projectlombok.org",,
For deploying to the remote repo on projectlombok.org:
mvn deploy:deploy-file -DrepositoryId=projectlombok.org url=scp://reinier@projectlombok.org/home/mavensync/public_html/m2repo -Dfile=dist/lombok.jar -DpomFile=doc/maven-pom.xml
-->
<issueManagement>
<system>Google Code</system>
<url>http://code.google.com/p/projectlombok/issues</url>
</issueManagement>
<developers>
<developer>
<id>rzwitserloot</id>
<name>Reinier Zwitserloot</name>
<email>reinier@projectlombok.org</email>
<url>http://zwitserloot.com</url>
<timezone>+1</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>
</developer>
</developers>
</project>
+2
View File
@@ -10,4 +10,6 @@ Step #4: git push && git push --tags
Step #5: ant publish-all
Step #6: Follow the instructions that flew by when the maven-publish task ran, which involves going to http://oss.sonatype.org/ and logging in with the username/pass that are in your scroll log, to test and then 'release' the staged repo to maven central. Note that once you do this there's no turning back, and that version number is forever associated with this release.
Step #6: Change src/core/lombok/core/Version.java to "0.8.2-EDGE", and commit this.
+58 -19
View File
@@ -1,5 +1,5 @@
/*
* Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
* Copyright © 2009-2011 Reinier Zwitserloot and Roel Spilker.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -89,46 +89,85 @@ public class Eclipse {
/**
* Generates an error in the Eclipse error log. Note that most people never look at it!
*/
public static void error(CompilationUnitDeclaration cud, String message) {
error(cud, message, DEFAULT_BUNDLE, null);
}
/**
* Generates an error in the Eclipse error log. Note that most people never look at it!
*
* @param cud The {@code CompilationUnitDeclaration} where the error occurred.
* An error will be generated on line 0 linking to the error log entry. Can be {@code null}.
* @param message Human readable description of the problem.
* @param error The associated exception. Can be {@code null}.
*/
public static void error(CompilationUnitDeclaration cud, String message, Throwable error) {
error(cud, message, DEFAULT_BUNDLE, error);
}
/**
* Generates an error in the Eclipse error log. Note that most people never look at it!
*/
public static void error(CompilationUnitDeclaration cud, String message, String bundleName) {
error(cud, message, bundleName, null);
error(cud, message, null, error);
}
/**
* Generates an error in the Eclipse error log. Note that most people never look at it!
*
* @param cud The {@code CompilationUnitDeclaration} where the error occurred.
* An error will be generated on line 0 linking to the error log entry. Can be {@code null}.
* @param message Human readable description of the problem.
* @param bundleName Can be {@code null} to default to {@code org.eclipse.jdt.core} which is usually right.
* @param error The associated exception. Can be {@code null}.
*/
public static void error(CompilationUnitDeclaration cud, String message, String bundleName, Throwable error) {
if (bundleName == null) bundleName = DEFAULT_BUNDLE;
try {
new EclipseWorkspaceLogger().error(message, bundleName, error);
} catch (NoClassDefFoundError e) { //standalone ecj does not jave Platform, ILog, IStatus, and friends.
} catch (NoClassDefFoundError e) { //standalone ecj does not jave Platform, ILog, IStatus, and friends.
new TerminalLogger().error(message, bundleName, error);
}
if (cud != null) EclipseAST.addProblemToCompilationResult(cud, false, message + " - See error log.", 0, 0);
}
/**
* Generates a warning in the Eclipse error log. Note that most people never look at it!
*
* @param cud The {@code CompilationUnitDeclaration} where the error occurred.
* An error will be generated on line 0 linking to the error log entry. Can be {@code null}.
* @param message Human readable description of the problem.
* @param error The associated exception. Can be {@code null}.
*/
public static void warning(String message, Throwable error) {
warning(message, null, error);
}
/**
* Generates a warning in the Eclipse error log. Note that most people never look at it!
*
* @param message Human readable description of the problem.
* @param bundleName Can be {@code null} to default to {@code org.eclipse.jdt.core} which is usually right.
* @param error The associated exception. Can be {@code null}.
*/
public static void warning(String message, String bundleName, Throwable error) {
if (bundleName == null) bundleName = DEFAULT_BUNDLE;
try {
new EclipseWorkspaceLogger().warning(message, bundleName, error);
} catch (NoClassDefFoundError e) { //standalone ecj does not jave Platform, ILog, IStatus, and friends.
new TerminalLogger().warning(message, bundleName, error);
}
}
private static class TerminalLogger {
void error(String message, String bundleName, Throwable error) {
System.err.println(message);
error.printStackTrace();
if (error != null) error.printStackTrace();
}
void warning(String message, String bundleName, Throwable error) {
System.err.println(message);
if (error != null) error.printStackTrace();
}
}
private static class EclipseWorkspaceLogger {
void error(String message, String bundleName, Throwable error) {
msg(IStatus.ERROR, message, bundleName, error);
}
void warning(String message, String bundleName, Throwable error) {
msg(IStatus.WARNING, message, bundleName, error);
}
private void msg(int msgType, String message, String bundleName, Throwable error) {
Bundle bundle = Platform.getBundle(bundleName);
if (bundle == null) {
System.err.printf("Can't find bundle %s while trying to report error:\n%s\n", bundleName, message);
@@ -137,7 +176,7 @@ public class Eclipse {
ILog log = Platform.getLog(bundle);
log.log(new Status(IStatus.ERROR, bundleName, message, error));
log.log(new Status(msgType, bundleName, message, error));
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ public class HandlerLibrary {
SpiLoadUtil.findAnnotationClass(handler.getClass(), EclipseAnnotationHandler.class);
AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
if (lib.annotationHandlers.put(container.annotationClass.getName(), container) != null) {
Eclipse.error(null, "Duplicate handlers for annotation type: " + container.annotationClass.getName());
Eclipse.error(null, "Duplicate handlers for annotation type: " + container.annotationClass.getName(), null);
}
lib.typeLibrary.addType(container.annotationClass.getName());
} catch (Throwable t) {
@@ -506,6 +506,27 @@ public class EclipseHandlerUtil {
method.annotations = createSuppressWarningsAll(method, method.annotations);
TypeDeclaration parent = (TypeDeclaration) type.get();
if (parent.scope != null && method.scope == null) {
// We think this means heisenbug #164 is about to happen later in some other worker thread.
// To improve our ability to figure out what the heck is going on, let's generate a log so we can ask those who stumble on this about it,
// and thus see a far more useful stack trace.
boolean report = true;
for (StackTraceElement elem : Thread.currentThread().getStackTrace()) {
// We intentionally hook into the middle of ClassScope filling in BlockScopes for PatchDelegate,
// meaning that will trigger a false positive. Detect it and do not report the occurence of #164 if so.
if ("lombok.eclipse.agent.PatchDelegate".equals(elem.getClassName())) {
report = false;
break;
}
}
if (report) {
Eclipse.warning("We believe you may have just stumbled on lombok issue #164. Please " +
"report the stack trace associated with this message at:\n" +
"http://code.google.com/p/projectlombok/issues/detail?id=164", new Throwable());
}
}
if (parent.methods == null) {
parent.methods = new AbstractMethodDeclaration[1];
parent.methods[0] = method;
@@ -42,6 +42,7 @@ import org.eclipse.jdt.internal.compiler.ast.CastExpression;
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.IfStatement;
import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
@@ -174,16 +175,7 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
NullLiteral nullLiteral = new NullLiteral(pS, pE);
Eclipse.setGeneratedBy(nullLiteral, ast);
MessageSend preventNullAnalysis = new MessageSend();
Eclipse.setGeneratedBy(preventNullAnalysis, ast);
preventNullAnalysis.receiver = createNameReference("lombok.Lombok", ast);
preventNullAnalysis.selector = "preventNullAnalysis".toCharArray();
preventNullAnalysis.arguments = new Expression[] { varName };
preventNullAnalysis.nameSourcePosition = p;
preventNullAnalysis.sourceStart = pS;
preventNullAnalysis.sourceEnd = preventNullAnalysis.statementEnd = pE;
MessageSend preventNullAnalysis = preventNullAnalysis(ast, varName);
EqualExpression equalExpression = new EqualExpression(preventNullAnalysis, nullLiteral, OperatorIds.NOT_EQUAL);
equalExpression.sourceStart = pS; equalExpression.sourceEnd = pE;
@@ -195,8 +187,6 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
Eclipse.setGeneratedBy(closeBlock, ast);
IfStatement ifStatement = new IfStatement(equalExpression, closeBlock, 0, 0);
Eclipse.setGeneratedBy(ifStatement, ast);
finallyBlock[0] = ifStatement;
tryStatement.finallyBlock = new Block(0);
@@ -219,6 +209,35 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
return true;
}
private MessageSend preventNullAnalysis(Annotation ast, Expression expr) {
MessageSend singletonList = new MessageSend();
Eclipse.setGeneratedBy(singletonList, ast);
int pS = ast.sourceStart, pE = ast.sourceEnd;
long p = (long)pS << 32 | pE;
singletonList.receiver = createNameReference("java.util.Collections", ast);
singletonList.selector = "singletonList".toCharArray();
singletonList.arguments = new Expression[] { expr };
singletonList.nameSourcePosition = p;
singletonList.sourceStart = pS;
singletonList.sourceEnd = singletonList.statementEnd = pE;
MessageSend preventNullAnalysis = new MessageSend();
Eclipse.setGeneratedBy(preventNullAnalysis, ast);
preventNullAnalysis.receiver = singletonList;
preventNullAnalysis.selector = "get".toCharArray();
preventNullAnalysis.arguments = new Expression[] { new IntLiteral(new char[] { '0' }, pS, pE) };
preventNullAnalysis.nameSourcePosition = p;
preventNullAnalysis.sourceStart = pS;
preventNullAnalysis.sourceEnd = singletonList.statementEnd = pE;
return preventNullAnalysis;
}
private void doAssignmentCheck(EclipseNode node, Statement[] tryBlock, char[] varName) {
for (Statement statement : tryBlock) doAssignmentCheck0(node, statement, varName);
}
@@ -117,7 +117,7 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> {
List<JCStatement> cleanupCall = List.<JCStatement>of(maker.Exec(
maker.Apply(List.<JCExpression>nil(), cleanupMethod, List.<JCExpression>nil())));
JCMethodInvocation preventNullAnalysis = maker.Apply(List.<JCExpression>nil(), JavacHandlerUtil.chainDotsString(maker, annotationNode, "lombok.Lombok.preventNullAnalysis"), List.<JCExpression>of(maker.Ident(decl.name)));
JCMethodInvocation preventNullAnalysis = preventNullAnalysis(maker, annotationNode, maker.Ident(decl.name));
JCBinary isNull = maker.Binary(Javac.getCTCint(JCTree.class, "NE"), preventNullAnalysis, maker.Literal(Javac.getCTCint(TypeTags.class, "BOT"), null));
JCIf ifNotNullCleanup = maker.If(isNull, maker.Block(0, cleanupCall), null);
@@ -139,6 +139,12 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> {
return true;
}
private JCMethodInvocation preventNullAnalysis(TreeMaker maker, JavacNode node, JCExpression expression) {
JCMethodInvocation singletonList = maker.Apply(List.<JCExpression>nil(), JavacHandlerUtil.chainDotsString(maker, node, "java.util.Collections.singletonList"), List.of(expression));
JCMethodInvocation cleanedExpr = maker.Apply(List.<JCExpression>nil(), maker.Select(singletonList, node.toName("get")) , List.<JCExpression>of(maker.Literal(TypeTags.INT, 0)));
return cleanedExpr;
}
private void doAssignmentCheck(JavacNode node, List<JCStatement> statements, Name name) {
for (JCStatement statement : statements) doAssignmentCheck0(node, statement, name);
}
@@ -74,7 +74,6 @@ import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -475,7 +474,7 @@ public class PatchDelegate {
inner = binding;
}
if (inner instanceof MemberTypeBinding) {
if (inner instanceof SourceTypeBinding) {
ClassScope cs = ((SourceTypeBinding)inner).scope;
if (cs != null) {
try {
@@ -527,6 +526,7 @@ public class PatchDelegate {
private static final List<String> METHODS_IN_OBJECT = Collections.unmodifiableList(Arrays.asList(
"hashCode()",
"canEqual(java.lang.Object)", //Not in j.l.Object, but it goes with hashCode and equals so if we ignore those two, we should ignore this one.
"equals(java.lang.Object)",
"wait()",
"wait(long)",
@@ -4,7 +4,7 @@ class CleanupName {
try {
System.out.println(o);
} finally {
if (lombok.Lombok.preventNullAnalysis(o) != null) {
if (java.util.Collections.singletonList(o).get(0) != null) {
o.toString();
}
}
@@ -14,7 +14,7 @@ class CleanupName {
try {
System.out.println(o);
} finally {
if (lombok.Lombok.preventNullAnalysis(o) != null) {
if (java.util.Collections.singletonList(o).get(0) != null) {
o.toString();
}
}
@@ -9,12 +9,12 @@ class CleanupPlain {
out.flush();
}
} finally {
if (lombok.Lombok.preventNullAnalysis(out) != null) {
if (java.util.Collections.singletonList(out).get(0) != null) {
out.close();
}
}
} finally {
if (lombok.Lombok.preventNullAnalysis(in) != null) {
if (java.util.Collections.singletonList(in).get(0) != null) {
in.close();
}
}
@@ -10,7 +10,7 @@ class CleanupName {
}
finally
{
if ((lombok.Lombok.preventNullAnalysis(o) != null))
if ((java.util.Collections.singletonList(o).get(0) != null))
{
o.toString();
}
@@ -24,7 +24,7 @@ class CleanupName {
}
finally
{
if ((lombok.Lombok.preventNullAnalysis(o) != null))
if ((java.util.Collections.singletonList(o).get(0) != null))
{
o.toString();
}
@@ -18,7 +18,7 @@ class CleanupPlain {
}
finally
{
if ((lombok.Lombok.preventNullAnalysis(out) != null))
if ((java.util.Collections.singletonList(out).get(0) != null))
{
out.close();
}
@@ -26,7 +26,7 @@ class CleanupPlain {
}
finally
{
if ((lombok.Lombok.preventNullAnalysis(in) != null))
if ((java.util.Collections.singletonList(in).get(0) != null))
{
in.close();
}
+42
View File
@@ -0,0 +1,42 @@
import com.google.inject.Inject;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.Min;
public class OnMethodOnParamExample {
private int bananas;
private int radishes;
@Deprecated
public int getBananas() {
return bananas;
}
@Min(10)
public int setRadishes(int radishes) {
this.radishes = radishes;
}
@Override public String toString() {
return String.format("I have %d bananas and %d beautiful radishes", bananas, radishes);
}
}
class OnConstructorExample {
private final Fireman fireman;
private int fires = 10;
@Inject
public OnConstructorExample(Fireman fireman) {
this.fireman = fireman;
}
public void setFires(@SuppressWarnings("all") int fires) {
this.fires = fires;
}
@Override public String toString() {
return String.format("Fireman: %s has %d fires", fireman, fires);
}
}
+24
View File
@@ -0,0 +1,24 @@
import com.google.inject.Inject;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.Min;
public class OnMethodOnParamExample {
@Getter(onMethod=@Deprecated) private int bananas;
@Setter(onMethod=@Min(10)) private int radishes;
@Override public String toString() {
return String.format("I have %d bananas and %d beautiful radishes", bananas, radishes);
}
}
@RequiredArgsConstructor(onConstructor=@Inject)
class OnConstructorExample {
private final Fireman fireman;
@Setter(onParam=@SuppressWarnings("all")) private int fires = 10;
@Override public String toString() {
return String.format("Fireman: %s has %d fires", fireman, fires);
}
}
+4
View File
@@ -71,6 +71,10 @@
</p><p>
<code>@XArgsConstructor</code> can also be used on an enum definition. The generated constructor will always be
private, because non-private constructors aren't legal in enums. You don't have to specify <code>AccessLevel.PRIVATE</code>.
</p><p>
While <code>suppressConstructorProperties</code> has been marked deprecated in anticipation of a world where all java environments have the
<code>@ConstructorProperties</code> annotation available, first GWT 2.2 and Android 2.3.3, which do not (yet) have this annotation, will have
to be ancient history before this annotation parameter will be removed.
</p>
</div>
</div>
+1 -1
View File
@@ -51,7 +51,7 @@
<div>
</div>
<div class="footer">
<a href="index.html">Back to features</a> | <a href="val.html">Previous feature (val)</a> | <span class="disabled">Next feature</span><br />
<a href="index.html">Back to features</a> | <a href="val.html">Previous feature (val)</a> | <a href="onX.html">Next feature (onMethod=,onParameter=,onConstructor=)</a><br />
<a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright &copy; 2010-2011 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span>
</div>
<div style="clear: both;"></div>
+2
View File
@@ -38,6 +38,8 @@
<dd>Finally! hassle-free final local variables.</dd>
<dt><a href="Delegate.html"><code>@Delegate</code></a></dt>
<dd>Don't lose your composition</dd>
<dt><a href="onX.html"><code>onMethod=,onParam=,onConstructor=</code></a></dt>
<dd>Annotate this! Add you favorite annotation to methods generated by lombok.</dd>
</dl>
</div>
<div class="pointer">
+58
View File
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../logi/reset.css" />
<link rel="stylesheet" type="text/css" href="features.css" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta name="description" content="Spice up your java" />
<title>onMethod=,onParam=,onConstructor=</title>
</head><body><div id="pepper">
<div class="minimumHeight"></div>
<div class="meat">
<div class="header"><a href="../index.html">Project Lombok</a></div>
<h1>onMethod=,onParam=,onConstructor=</h1>
<div class="byline">Annotate this! Add you favorite annotation to methods generated by lombok.</div>
<div class="overview">
<h3>Overview</h3>
<p>
Lombok lets you add your favorite annotation to methods generated by <code>@Getter</code> and <code>@Setter</code> by using the attribute <code>onMethod</code>
on the lombok annotation. You can specify annotations to the parameters of the method on <code>@Setter</code> with the attribute <code>onParameter</code>.
You can add annotation to constructors generated by <code>@NoArgsConstructor, @RequiredArgsConstructor and @AllArgsConstructor</code> by using the attribute
<code>onConstructor</code>
</p>
</div>
<div class="snippets">
<div class="pre">
<h3>With Lombok</h3>
<div class="snippet">@HTML_PRE@</div>
</div>
<div class="sep"></div>
<div class="post">
<h3>Vanilla Java</h3>
<div class="snippet">@HTML_POST@</div>
</div>
</div>
<div style="clear: left;"></div>
<div class="overview">
<h3>Small print</h3><div class="smallprint">
When the @Getter or @Setter annotation is placed on the type in stead of a field, using the attribute is not supported and it will result in a warning.
</div>
</div>
<div class="footer">
<a href="index.html">Back to features</a> | <a href="Delegate.html">Previous feature (@Delegate)</a> | <span class="disabled">Next feature</span><br />
<a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright &copy; 2011 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span>
</div>
<div style="clear: both;"></div>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9884254-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body></html>
+8 -19
View File
@@ -43,7 +43,7 @@
</style>
</head><body>
<div class="meat">
<h1>Use Lombok via Maven</h1>
<h1>Use Lombok via Maven or ivy</h1>
<div>
You can use lombok with maven by adding the following to your <strong>pom.xml</strong>:
<div class="snippet">&lt;dependencies&gt;
@@ -53,25 +53,14 @@
&lt;version&gt;@VERSION@&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;projectlombok.org&lt;/id&gt;
&lt;url&gt;http://projectlombok.org/mavenrepo&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;</div>
&lt;/dependencies&gt;</div>
</div>
<div>
<em><strong>CAREFUL:</strong></em> lombok requires using the javac v1.6 compiler. If this is not your default compiler, you'll need to add the following to your
pom file to explicitly set the java compiler version to use:
<div class="snippet">&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;compilerVersion&gt;1.6&lt;/compilerVersion&gt;
&lt;source&gt;1.6&lt;/source&gt;
&lt;target&gt;1.6&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;</div>
You can use lombok with ivy by adding the following to your <strong>ivy.xml</strong>:
<div class="snippet">&lt;dependency org="projectlombok.org" name="lombok" rev="@VERSION@" conf="build" /&gt;</div>
</div>
<div>
<em><strong>CAREFUL:</strong></em> lombok requires using the javac v1.6 compiler or higher.
</div>
That's all there is to it!<br />
<em>note:</em> You'll still need to download lombok, or doubleclick on the lombok.jar file downloaded by maven, to install lombok into your eclipse installation.<br />