1 11 12 13 package org.codehaus.groovy.classgen; 14 15 import java.util.ArrayList ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 19 import org.codehaus.groovy.ast.ClassNode; 20 import org.codehaus.groovy.ast.ConstructorNode; 21 import org.codehaus.groovy.ast.FieldNode; 22 import org.codehaus.groovy.ast.GroovyClassVisitor; 23 import org.codehaus.groovy.ast.MethodNode; 24 import org.codehaus.groovy.ast.PropertyNode; 25 import org.objectweb.asm.Constants; 26 27 28 32 public class ClassCompletionVerifier implements Constants, GroovyClassVisitor { 33 34 ClassNode classNode; 35 36 public ClassNode getClassNode() { 37 return classNode; 38 } 39 40 41 44 public void visitClass(ClassNode a_node) { 45 classNode = a_node; 46 if ((classNode.getModifiers() & Constants.ACC_ABSTRACT) == 0 ) { 47 List abstractMethods = classNode.getAbstractMethods(); 48 if (abstractMethods != null) { 49 List methodNames = new ArrayList (); 50 for (Iterator iter = abstractMethods.iterator(); iter.hasNext();) { 51 MethodNode method = (MethodNode) iter.next(); 52 String methodName = method.getTypeDescriptor(); 53 methodNames.add(methodName); 54 } 55 throw new RuntimeIncompleteClassException(methodNames, classNode); 56 } 57 } 58 } 59 60 63 public void visitConstructor(ConstructorNode a_node) { 64 } 65 66 69 public void visitMethod(MethodNode a_node) { 70 } 71 72 75 public void visitField(FieldNode a_node) { 76 } 77 78 81 public void visitProperty(PropertyNode a_node) { 82 } 83 84 } 85 | Popular Tags |