diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-12-04 00:52:30 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-12-04 00:52:40 +0100 |
commit | 2b3556878831612bac045808e27030f4a8b30a34 (patch) | |
tree | 11dab3478230e3cdf2594fc4a5d24f3b14dc5b0b /src/utils/lombok/permit | |
parent | b59db90acffd7f31c3c1108961ad96b9791b24f2 (diff) | |
download | lombok-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/lombok/permit')
-rw-r--r-- | src/utils/lombok/permit/Permit.java | 23 |
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; + } + } |