Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java @ 14042:2864cb92fa9a
TruffleDSL: retire NodeFactory#createNodeGeneric
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 26 Feb 2014 15:34:59 +0100 |
parents | 5a0c694ef735 |
children | 5f5e2711dc24 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java Wed Feb 26 13:48:47 2014 +0100 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java Wed Feb 26 15:34:59 2014 +0100 @@ -24,6 +24,7 @@ import static org.junit.Assert.*; +import java.lang.reflect.*; import java.util.*; import com.oracle.truffle.api.*; @@ -61,7 +62,17 @@ } static <E extends ValueNode> E createGenericNode(NodeFactory<E> factory, Object... constants) { - return factory.createNodeGeneric(createNode(factory, constants)); + Method createGenericMethod; + try { + createGenericMethod = factory.getClass().getMethod("createGeneric", factory.getNodeClass()); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + try { + return factory.getNodeClass().cast(createGenericMethod.invoke(null, createNode(factory, constants))); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } } static <E extends ValueNode> TestRootNode<E> createRoot(NodeFactory<E> factory, Object... constants) {