aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-12-04 00:52:30 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-12-04 00:52:40 +0100
commit2b3556878831612bac045808e27030f4a8b30a34 (patch)
tree11dab3478230e3cdf2594fc4a5d24f3b14dc5b0b /src/utils
parentb59db90acffd7f31c3c1108961ad96b9791b24f2 (diff)
downloadlombok-2b3556878831612bac045808e27030f4a8b30a34.tar.gz
lombok-2b3556878831612bac045808e27030f4a8b30a34.tar.bz2
lombok-2b3556878831612bac045808e27030f4a8b30a34.zip
[build] The 'utils' source files had a dep on main which is not okay; I need to address the build so that this causes errors.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/permit/Permit.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/utils/lombok/permit/Permit.java b/src/utils/lombok/permit/Permit.java
index c0006559..5101e7b0 100644
--- a/src/utils/lombok/permit/Permit.java
+++ b/src/utils/lombok/permit/Permit.java
@@ -38,8 +38,6 @@ import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.util.List;
-import lombok.Lombok;
-
// sunapi suppresses javac's warning about using Unsafe; 'all' suppresses eclipse's warning about the unspecified 'sunapi' key. Leave them both.
// Yes, javac's definition of the word 'all' is quite contrary to what the dictionary says it means. 'all' does NOT include 'sunapi' according to javac.
@SuppressWarnings({"sunapi", "all"})
@@ -223,9 +221,9 @@ public class Permit {
return null;
} catch (IllegalAccessException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InvocationTargetException e) {
- throw Lombok.sneakyThrow(e.getCause());
+ throw sneakyThrow(e.getCause());
} catch (RuntimeException e) {
handleReflectionDebug(e, initError);
throw e;
@@ -276,12 +274,12 @@ public class Permit {
return null;
} catch (IllegalAccessException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InstantiationException e) {
handleReflectionDebug(e, initError);
- throw Lombok.sneakyThrow(e);
+ throw sneakyThrow(e);
} catch (InvocationTargetException e) {
- throw Lombok.sneakyThrow(e.getCause());
+ throw sneakyThrow(e.getCause());
} catch (RuntimeException e) {
handleReflectionDebug(e, initError);
throw e;
@@ -329,4 +327,15 @@ public class Permit {
initError.printStackTrace(System.err);
}
}
+
+ public static RuntimeException sneakyThrow(Throwable t) {
+ if (t == null) throw new NullPointerException("t");
+ return Permit.<RuntimeException>sneakyThrow0(t);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Throwable> T sneakyThrow0(Throwable t) throws T {
+ throw (T)t;
+ }
+
}