aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok
diff options
context:
space:
mode:
authorBulgakov Alexander <buls@yandex.ru>2019-05-07 10:49:50 +0300
committerBulgakov Alexander <buls@yandex.ru>2019-05-07 10:49:50 +0300
commit8f8cbae631ff2e7091a2a9b70339b778177122cc (patch)
tree936824b3998eff0bde662655ec89e1175e6e4c0e /src/utils/lombok
parent06fb1034eac690f5775e104c4bc82df3ad929cc9 (diff)
parent3496a3e9633cd6526745bcc390877653afad7f09 (diff)
downloadlombok-8f8cbae631ff2e7091a2a9b70339b778177122cc.tar.gz
lombok-8f8cbae631ff2e7091a2a9b70339b778177122cc.tar.bz2
lombok-8f8cbae631ff2e7091a2a9b70339b778177122cc.zip
Merge remote-tracking branch 'lombok/master' into feature/typeInferenceImprovements
Diffstat (limited to 'src/utils/lombok')
-rw-r--r--src/utils/lombok/core/SpiLoadUtil.java10
-rw-r--r--src/utils/lombok/javac/Javac.java8
2 files changed, 13 insertions, 5 deletions
diff --git a/src/utils/lombok/core/SpiLoadUtil.java b/src/utils/lombok/core/SpiLoadUtil.java
index 02c02496..e685acd6 100644
--- a/src/utils/lombok/core/SpiLoadUtil.java
+++ b/src/utils/lombok/core/SpiLoadUtil.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URL;
@@ -108,10 +109,13 @@ public class SpiLoadUtil {
@Override public C next() {
try {
- return target.cast(Class.forName(names.next(), true, fLoader).newInstance());
+ return target.cast(Class.forName(names.next(), true, fLoader).getConstructor().newInstance());
} catch (Exception e) {
- if (e instanceof RuntimeException) throw (RuntimeException)e;
- throw new RuntimeException(e);
+ Throwable t = e;
+ if (t instanceof InvocationTargetException) t = t.getCause();
+ if (t instanceof RuntimeException) throw (RuntimeException) t;
+ if (t instanceof Error) throw (Error) t;
+ throw new RuntimeException(t);
}
}
diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java
index 7a264e39..3cc72f4e 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -409,10 +409,14 @@ public class Javac {
} else {
try {
if (CTC_VOID.equals(tag)) {
- return (Type) JC_VOID_TYPE.newInstance();
+ return (Type) JC_VOID_TYPE.getConstructor().newInstance();
} else {
- return (Type) JC_NO_TYPE.newInstance();
+ return (Type) JC_NO_TYPE.getConstructor().newInstance();
}
+ } catch (InvocationTargetException e) {
+ throw sneakyThrow(e.getCause());
+ } catch (NoSuchMethodException e) {
+ throw sneakyThrow(e);
} catch (IllegalAccessException e) {
throw sneakyThrow(e);
} catch (InstantiationException e) {