aboutsummaryrefslogtreecommitdiff
path: root/src/delombok/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-12-04 02:54:22 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-12-04 02:54:22 +0100
commit2e78a2e03f8fdba4d3d468b2900d30f7e7317641 (patch)
tree617a4f36b044fa7b1f87cd2e525bd7308b6f0163 /src/delombok/lombok
parent815f7d0fe82df761c038907043abd1a33d491f5d (diff)
parent9e7c75a0fef387c173af289626aa04d5c2942710 (diff)
downloadlombok-2e78a2e03f8fdba4d3d468b2900d30f7e7317641.tar.gz
lombok-2e78a2e03f8fdba4d3d468b2900d30f7e7317641.tar.bz2
lombok-2e78a2e03f8fdba4d3d468b2900d30f7e7317641.zip
Merge branch 'shadowLauncher'
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r--src/delombok/lombok/delombok/DelombokApp.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/delombok/lombok/delombok/DelombokApp.java b/src/delombok/lombok/delombok/DelombokApp.java
index 276bd7de..aa753fc8 100644
--- a/src/delombok/lombok/delombok/DelombokApp.java
+++ b/src/delombok/lombok/delombok/DelombokApp.java
@@ -88,7 +88,7 @@ public class DelombokApp extends LombokApp {
// Since we only read from it, not closing it should not be a problem.
@SuppressWarnings({"resource", "all"}) final JarFile toolsJarFile = new JarFile(toolsJar);
- ClassLoader loader = new ClassLoader() {
+ ClassLoader loader = new ClassLoader(DelombokApp.class.getClassLoader()) {
private Class<?> loadStreamAsClass(String name, boolean resolve, InputStream in) throws ClassNotFoundException {
try {
try {
@@ -107,16 +107,24 @@ public class DelombokApp extends LombokApp {
} finally {
in.close();
}
- } catch (IOException e2) {
+ } catch (Exception e2) {
throw new ClassNotFoundException(name, e2);
}
}
@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- String rawName = name.replace(".", "/") + ".class";
+ String rawName, altName; {
+ String binName = name.replace(".", "/");
+ rawName = binName + ".class";
+ altName = binName + ".SCL.lombok";
+ }
JarEntry entry = toolsJarFile.getJarEntry(rawName);
if (entry == null) {
- if (name.startsWith("lombok.")) return loadStreamAsClass(name, resolve, super.getResourceAsStream(rawName));
+ if (name.startsWith("lombok.")) {
+ InputStream res = getParent().getResourceAsStream(rawName);
+ if (res == null) res = getParent().getResourceAsStream(altName);
+ return loadStreamAsClass(name, resolve, res);
+ }
return super.loadClass(name, resolve);
}