1 /********************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
7 *
8 * Contributors:
9 * IBM - Initial API and implementation
10 ******************************************************************************/
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.Opcodes;
26
27
28 /***
29 * ClassCompletionVerifier
30 *
31 */
32 public class ClassCompletionVerifier implements Opcodes, GroovyClassVisitor {
33
34 ClassNode classNode;
35
36 public ClassNode getClassNode() {
37 return classNode;
38 }
39
40
41
42
43
44 public void visitClass(ClassNode a_node) {
45 classNode = a_node;
46 if ((classNode.getModifiers() & Opcodes.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
61
62
63 public void visitConstructor(ConstructorNode a_node) {
64 }
65
66
67
68
69 public void visitMethod(MethodNode a_node) {
70 }
71
72
73
74
75 public void visitField(FieldNode a_node) {
76 }
77
78
79
80
81 public void visitProperty(PropertyNode a_node) {
82 }
83
84 }