# HG changeset patch # User Doug Simon # Date 1407947066 -7200 # Node ID 216ac26009a2559d2d27ffcc3cf8480af949861e # Parent 1a8d95626af78696562e27dab36e756fcd08fc19 check that all Node classes are annotated with @NodeInfo diff -r 1a8d95626af7 -r 216ac26009a2 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Wed Aug 13 18:23:04 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Wed Aug 13 18:24:26 2014 +0200 @@ -38,6 +38,7 @@ import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess; import com.oracle.graal.debug.*; +import com.oracle.graal.graph.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; @@ -113,6 +114,8 @@ for (String className : classNames) { try { Class c = Class.forName(className, false, CheckGraalInvariants.class.getClassLoader()); + executor.execute(() -> checkClass(c, metaAccess)); + for (Method m : c.getDeclaredMethods()) { if (Modifier.isNative(m.getModifiers()) || Modifier.isAbstract(m.getModifiers())) { // ignore @@ -169,6 +172,22 @@ } /** + * @param metaAccess + */ + private static void checkClass(Class c, MetaAccessProvider metaAccess) { + if (Node.class.isAssignableFrom(c)) { + if (c.getAnnotation(GeneratedNode.class) == null) { + if (Modifier.isFinal(c.getModifiers())) { + throw new AssertionError(String.format("Node subclass %s must not be final", c.getName())); + } + if (c.getAnnotation(NodeInfo.class) == null) { + throw new AssertionError(String.format("Node subclass %s requires %s annotation", c.getName(), NodeClass.class.getSimpleName())); + } + } + } + } + + /** * Checks the invariants for a single graph. */ private static void checkGraph(HighTierContext context, StructuredGraph graph, boolean verifyEquals) {