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=4efd2a8d404e7037925fd7d005d782e1fa5c8d3f;hb=29a9155f55ac9ccaef1b3fd163e7c4230fcd4d1c;hpb=c26409b1caf2f1e560d37c5befd11b442399c3fe 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 4efd2a8d4..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 @@ -1,5 +1,6 @@ package org.simantics.scl.compiler.internal.codegen.utils; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.simantics.scl.runtime.function.FunctionImpl1; @@ -26,6 +27,13 @@ public class ValueFromMethod { Object ret = method.invoke(null, p0); 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); } } @@ -63,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); } } @@ -100,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); } } @@ -137,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); } } @@ -175,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); } }