X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Futils%2FValueFromMethod.java;h=1c8c6431f89b16310fd41232b8fd580294463215;hp=70160dee2615b4e284e637134b1efcf7e03e84a5;hb=29a9155f55ac9ccaef1b3fd163e7c4230fcd4d1c;hpb=06ee0c4c71cd9e372969da1570e7fcac2c4397a5 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ValueFromMethod.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ValueFromMethod.java index 70160dee2..1c8c6431f 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ValueFromMethod.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ValueFromMethod.java @@ -27,8 +27,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, p0); return returnsVoid ? Tuple0.INSTANCE : ret; } catch (ReflectiveOperationException e) { - if (e instanceof InvocationTargetException) - throw new RuntimeException(e.getCause()); + if (e instanceof InvocationTargetException) { + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + throw (RuntimeException)cause; + else + throw new RuntimeException(cause); + } throw new RuntimeException(e); } } @@ -66,6 +71,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, p0, p1); return returnsVoid ? Tuple0.INSTANCE : ret; } catch (ReflectiveOperationException e) { + if (e instanceof InvocationTargetException) { + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + throw (RuntimeException)cause; + else + throw new RuntimeException(cause); + } throw new RuntimeException(e); } } @@ -103,6 +115,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, p0, p1, p2); return returnsVoid ? Tuple0.INSTANCE : ret; } catch (ReflectiveOperationException e) { + if (e instanceof InvocationTargetException) { + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + throw (RuntimeException)cause; + else + throw new RuntimeException(cause); + } throw new RuntimeException(e); } } @@ -140,6 +159,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, p0, p1, p2, p3); return returnsVoid ? Tuple0.INSTANCE : ret; } catch (ReflectiveOperationException e) { + if (e instanceof InvocationTargetException) { + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + throw (RuntimeException)cause; + else + throw new RuntimeException(cause); + } throw new RuntimeException(e); } } @@ -178,6 +204,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, ps); return returnsVoid ? Tuple0.INSTANCE : ret; } catch (ReflectiveOperationException e) { + if (e instanceof InvocationTargetException) { + Throwable cause = e.getCause(); + if(cause instanceof RuntimeException) + throw (RuntimeException)cause; + else + throw new RuntimeException(cause); + } throw new RuntimeException(e); } }