mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 18:18:48 +00:00
thoroughly updated the launch targets for testing lombok in eclipse;
they should now be able to handle running JDK8 etc tests. CAREFUL: You MUST name your JDK8 'JavaSE-1.8' or it won't work. Also added a basic test for JDK8 features.
This commit is contained in:
1 parent
e890428077
commit
7079271802
5 files changed
+41
-24
No files matched your search
@@ -431,9 +431,12 @@ ${sourceWarning}</echo>
|
||||
overwrite="true">
|
||||
<filterset>
|
||||
<filter token="JAVAC_LOCATION" value="${test.location.javac}" />
|
||||
<filter token="ECJ_LOCATION" value="${test.location.ecj}" />
|
||||
<filter token="RT_LOCATION" value="${test.location.bootclasspath}" />
|
||||
<filter token="JAVA_VERSION" value="${test.javaversion}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
<echo>WARNING: If you wish to test JDK8 features in eclipse, there must be a JDK8 installation configured in your eclipse, and it must be called 'JavaSE-1.8'.</echo>
|
||||
</target>
|
||||
|
||||
<target name="setupJavaOpenJDK6TestEnvironment" description="Sets up the test so that 'ant test' will test against OpenJDK6.">
|
||||
@@ -445,6 +448,7 @@ ${sourceWarning}</echo>
|
||||
<entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" />
|
||||
<entry key="test.location.bootclasspath" value="lib/openJDK6Environment/rt-openjdk6.jar" />
|
||||
<entry key="test.location.name" value="OpenJDK6" />
|
||||
<entry key="test.javaversion" value="6" />
|
||||
</propertyfile>
|
||||
<echo>Tests will now run against OpenJDK6</echo>
|
||||
<antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" />
|
||||
@@ -459,6 +463,7 @@ ${sourceWarning}</echo>
|
||||
<entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" />
|
||||
<entry key="test.location.bootclasspath" value="lib/openJDK7Environment/rt-openjdk7.jar" />
|
||||
<entry key="test.location.name" value="OpenJDK7" />
|
||||
<entry key="test.javaversion" value="7" />
|
||||
</propertyfile>
|
||||
<echo>Tests will now run against OpenJDK7</echo>
|
||||
<antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" />
|
||||
@@ -473,6 +478,7 @@ ${sourceWarning}</echo>
|
||||
<entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" />
|
||||
<entry key="test.location.bootclasspath" value="lib/oracleJDK7Environment/rt.jar" />
|
||||
<entry key="test.location.name" value="OracleJDK7" />
|
||||
<entry key="test.javaversion" value="7" />
|
||||
</propertyfile>
|
||||
<echo>Tests will now run against Oracle JDK7</echo>
|
||||
<antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" />
|
||||
@@ -487,12 +493,13 @@ ${sourceWarning}</echo>
|
||||
<entry key="test.location.ecj" value="lib/ecj8/org.eclipse.custom-ecj.jar" />
|
||||
<entry key="test.location.bootclasspath" value="lib/oracleJDK8Environment/rt.jar" />
|
||||
<entry key="test.location.name" value="OracleJDK8" />
|
||||
<entry key="test.javaversion" value="8" />
|
||||
</propertyfile>
|
||||
<echo>Tests will now run against Oracle JDK8</echo>
|
||||
<antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" />
|
||||
</target>
|
||||
|
||||
<target name="-failIfNoTestEnvironmentProperties" unless="test.location.ecj">
|
||||
<target name="-failIfNoTestEnvironmentProperties" unless="test.javaversion">
|
||||
<fail>ERROR: No test environment set up.
|
||||
|
||||
You need to set up a test environment, which consists of a version of javac, and a JRE runtime classpath ('rt.jar').
|
||||
@@ -513,6 +520,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The
|
||||
* test.location.ecj = /path/to/ecj6.jar
|
||||
* test.location.bootclasspath = /path/to/rt.jar
|
||||
* test.location.name = RandomUsefulNameToIdentifyThisSetup
|
||||
* test.javaversion = 6
|
||||
</fail>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/lombok/test/core/src/lombok/RunAllTests.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="lombok.RunAllTests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lombok"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:dist/lombok.jar -Xbootclasspath/p:@JAVAC_LOCATION@ -Ddelombok.bootclasspath=@RT_LOCATION@"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/lombok/test/core/src/lombok/RunAllTests.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.@JAVA_VERSION@" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/@ECJ_LOCATION@" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/@JAVAC_LOCATION@" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="lombok"/> </runtimeClasspathEntry> "/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.@JAVA_VERSION@"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="lombok.RunAllTests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lombok"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:dist/lombok.jar -Ddelombok.bootclasspath=@RT_LOCATION@"/>
|
||||
</launchConfiguration>
|
||||
@@ -70,22 +70,22 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore");
|
||||
warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore");
|
||||
warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore");
|
||||
warnings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
|
||||
warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion());
|
||||
options.set(warnings);
|
||||
return options;
|
||||
}
|
||||
|
||||
protected IErrorHandlingPolicy ecjErrorHandlingPolicy() {
|
||||
return new IErrorHandlingPolicy() {
|
||||
@Override public boolean stopOnFirstError() {
|
||||
public boolean stopOnFirstError() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean proceedOnErrors() {
|
||||
public boolean proceedOnErrors() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean ignoreAllErrors() {
|
||||
public boolean ignoreAllErrors() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -124,7 +124,8 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
|
||||
CompilationUnitDeclaration cud = compilationUnit_.get();
|
||||
|
||||
result.append(cud.toString());
|
||||
if (cud == null) result.append("---- NO CompilationUnit provided by ecj ----");
|
||||
else result.append(cud.toString());
|
||||
}
|
||||
|
||||
private FileSystem createFileSystem(File file) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//version 7
|
||||
import java.io.IOException;
|
||||
public class ValInTryWithResources {
|
||||
public void whyTryInsteadOfCleanup() throws IOException {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//version 7
|
||||
//version 7:
|
||||
import lombok.val;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
Reference in new issue
Block a user