Java Code Examples for org.codehaus.groovy.ast.ClassNode#visitContents()
The following examples show how to use
org.codehaus.groovy.ast.ClassNode#visitContents() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtendedVerifier.java From groovy with Apache License 2.0 | 6 votes |
@Override public void visitClass(ClassNode node) { AnnotationConstantsVisitor acv = new AnnotationConstantsVisitor(); acv.visitClass(node, this.source); this.currentClass = node; if (node.isAnnotationDefinition()) { visitAnnotations(node, AnnotationNode.ANNOTATION_TARGET); } else { visitAnnotations(node, AnnotationNode.TYPE_TARGET); } PackageNode packageNode = node.getPackage(); if (packageNode != null) { visitAnnotations(packageNode, AnnotationNode.PACKAGE_TARGET); } node.visitContents(this); }
Example 2
Source File: GenericsVisitor.java From groovy with Apache License 2.0 | 5 votes |
@Override public void visitClass(ClassNode node) { boolean error = checkWildcard(node); if (error) return; boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode) node).isAnonymous(); checkGenericsUsage(node.getUnresolvedSuperClass(false), node.getSuperClass(), isAnon ? true : null); ClassNode[] interfaces = node.getInterfaces(); for (ClassNode anInterface : interfaces) { checkGenericsUsage(anInterface, anInterface.redirect()); } node.visitContents(this); }
Example 3
Source File: UnionTypeClassNode.java From groovy with Apache License 2.0 | 4 votes |
@Override public void visitContents(final GroovyClassVisitor visitor) { for (ClassNode delegate : delegates) { delegate.visitContents(visitor); } }
Example 4
Source File: DummyClassGenerator.java From groovy with Apache License 2.0 | 4 votes |
public void visitClass(ClassNode classNode) { try { this.classNode = classNode; this.internalClassName = BytecodeHelper.getClassInternalName(classNode); //System.out.println("Generating class: " + classNode.getName()); this.internalBaseClassName = BytecodeHelper.getClassInternalName(classNode.getSuperClass()); cv.visit( Opcodes.V1_3, classNode.getModifiers(), internalClassName, null, internalBaseClassName, BytecodeHelper.getClassInternalNames(classNode.getInterfaces()) ); classNode.visitContents(this); for (ClassNode innerClass : innerClasses) { ClassNode innerClassType = innerClass; String innerClassInternalName = BytecodeHelper.getClassInternalName(innerClassType); String outerClassName = internalClassName; // default for inner classes MethodNode enclosingMethod = innerClass.getEnclosingMethod(); if (enclosingMethod != null) { // local inner classes do not specify the outer class name outerClassName = null; } cv.visitInnerClass( innerClassInternalName, outerClassName, innerClassType.getName(), innerClass.getModifiers()); } cv.visitEnd(); } catch (GroovyRuntimeException e) { e.setModule(classNode.getModule()); throw e; } }