aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-01-21 01:10:50 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-01-21 01:10:50 +0100
commitef60d1af001204622b428e78894c967a9aee7e91 (patch)
treeba5767291b6fa7f4ea2e17d6a8e14d1c1e8dc74a
parentf153f1cda304d56f9b20cd5e39adf83e74067045 (diff)
downloadlombok-ef60d1af001204622b428e78894c967a9aee7e91.tar.gz
lombok-ef60d1af001204622b428e78894c967a9aee7e91.tar.bz2
lombok-ef60d1af001204622b428e78894c967a9aee7e91.zip
* Fixed running ecj tests within eclipse
-rw-r--r--buildScripts/eclipse-run-tests.template3
-rw-r--r--src/core/lombok/Singular.java2
-rw-r--r--src/eclipseAgent/lombok/launch/PatchFixesHider.java15
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java3
4 files changed, 18 insertions, 5 deletions
diff --git a/buildScripts/eclipse-run-tests.template b/buildScripts/eclipse-run-tests.template
index b7bc8b0d..2a856315 100644
--- a/buildScripts/eclipse-run-tests.template
+++ b/buildScripts/eclipse-run-tests.template
@@ -18,11 +18,12 @@
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.@JAVA_VERSION@&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/@ECJ_LOCATION@&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/@JAVAC_LOCATION@&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
+ <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/lib/test/com.google.guava-guava.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;lombok&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
</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@"/>
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:dist/lombok.jar -Dshadow.override.lombok=${project_loc:lombok}/bin:${project_loc:lombok}/lib/runtime/* -Ddelombok.bootclasspath=@RT_LOCATION@"/>
</launchConfiguration>
diff --git a/src/core/lombok/Singular.java b/src/core/lombok/Singular.java
index 7f22b008..15dec4a5 100644
--- a/src/core/lombok/Singular.java
+++ b/src/core/lombok/Singular.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 The Project Lombok Authors.
+ * Copyright (C) 2015 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
diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index 23774d0f..2472ca3c 100644
--- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java
+++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
@@ -74,9 +74,22 @@ final class PatchFixesHider {
/** These utility methods are only used 'internally', but because of transplant methods, the class (and its methods) still have to be public! */
public static final class Util {
+ private static ClassLoader shadowLoader;
+
public static Class<?> shadowLoadClass(String name) {
try {
- return Class.forName(name, true, Main.createShadowClassLoader());
+ if (shadowLoader == null) {
+ try {
+ Class.forName("lombok.core.LombokNode");
+ // If we get here, then lombok is already available.
+ shadowLoader = Util.class.getClassLoader();
+ } catch (ClassNotFoundException e) {
+ // If we get here, it isn't, and we should use the shadowloader.
+ shadowLoader = Main.createShadowClassLoader();
+ }
+ }
+
+ return Class.forName(name, true, shadowLoader);
} catch (ClassNotFoundException e) {
throw sneakyThrow(e);
}
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 2b83b296..74fe6e92 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -112,8 +112,6 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
};
- // TODO: Create a configuration based on confLines and set this up so that this compile run will use them.
-
ecjCompiler.compile(new ICompilationUnit[] {sourceUnit});
CompilationResult compilationResult = compilationResult_.get();
@@ -137,6 +135,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
i.remove();
}
}
+ classpath.add("bin");
classpath.add("dist/lombok.jar");
classpath.add("lib/test/commons-logging-commons-logging.jar");
classpath.add("lib/test/org.slf4j-slf4j-api.jar");