diff options
author | Jan Rieke <rieke@subshell.com> | 2017-03-13 16:49:20 +0100 |
---|---|---|
committer | Jan Rieke <rieke@subshell.com> | 2017-03-13 16:49:20 +0100 |
commit | 2346b15c8d2809b6efa9fc94f4f6cc56dcaa54b8 (patch) | |
tree | 238b9877ce1daa83b3e8d422eb4d2f7ab89f3864 /src/launch | |
parent | f51bbce3e396a0151bc0242d00e250f2bc720316 (diff) | |
parent | a2c10c70fa8e2c8736464a5c3d445e2ca6e8a296 (diff) | |
download | lombok-2346b15c8d2809b6efa9fc94f4f6cc56dcaa54b8.tar.gz lombok-2346b15c8d2809b6efa9fc94f4f6cc56dcaa54b8.tar.bz2 lombok-2346b15c8d2809b6efa9fc94f4f6cc56dcaa54b8.zip |
Merge remote-tracking branch 'upstream/master'
# Conflicts:
# src/core/lombok/eclipse/handlers/HandleBuilder.java
# src/core/lombok/eclipse/handlers/HandleConstructor.java
# src/core/lombok/javac/handlers/HandleBuilder.java
# src/core/lombok/javac/handlers/HandleConstructor.java
Diffstat (limited to 'src/launch')
-rw-r--r-- | src/launch/lombok/launch/ShadowClassLoader.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/launch/lombok/launch/ShadowClassLoader.java b/src/launch/lombok/launch/ShadowClassLoader.java index 37c479ee..72f006e8 100644 --- a/src/launch/lombok/launch/ShadowClassLoader.java +++ b/src/launch/lombok/launch/ShadowClassLoader.java @@ -118,12 +118,16 @@ class ShadowClassLoader extends ClassLoader { SELF_BASE = selfBase; SELF_BASE_LENGTH = selfBase.length(); } else { - String sclClassUrl = ShadowClassLoader.class.getResource("ShadowClassLoader.class").toString(); - if (!sclClassUrl.endsWith(SELF_NAME)) throw new InternalError("ShadowLoader can't find itself."); - SELF_BASE_LENGTH = sclClassUrl.length() - SELF_NAME.length(); + URL sclClassUrl = ShadowClassLoader.class.getResource("ShadowClassLoader.class"); + String sclClassStr = sclClassUrl == null ? null : sclClassUrl.toString(); + if (sclClassStr == null || !sclClassStr.endsWith(SELF_NAME)) { + ClassLoader cl = ShadowClassLoader.class.getClassLoader(); + throw new RuntimeException("ShadowLoader can't find itself. SCL loader type: " + (cl == null ? "*NULL*" : cl.getClass().toString())); + } + SELF_BASE_LENGTH = sclClassStr.length() - SELF_NAME.length(); String decoded; try { - decoded = URLDecoder.decode(sclClassUrl.substring(0, SELF_BASE_LENGTH), "UTF-8"); + decoded = URLDecoder.decode(sclClassStr.substring(0, SELF_BASE_LENGTH), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new InternalError("UTF-8 not available"); } @@ -451,7 +455,12 @@ class ShadowClassLoader extends ClassLoader { Class<?> alreadyDefined = highlanderMap.get(name); if (alreadyDefined != null) return alreadyDefined; } - throw e; + try { + c = this.findLoadedClass(name); + } catch (LinkageError e2) { + throw e; + } + if (c == null) throw e; } if (highlanders.contains(name)) { |