Ejemplo n.º 1
0
 @Override
 public void visitInnerClass(String name, String outerName, String innerName, int access) {
   // logger.debug(String.format("[Inner Class] Name: %s, outerName: %s, innerName: %s,
   // templateName: %s, newName: %s.",
   // name, outerName, innerName, templateName, newName));
   if (name.startsWith(set.precompiled.slash)) {
     //      outerName = outerName.replace(precompiled.slash, generated.slash);
     name = name.replace(set.precompiled.slash, set.generated.slash);
     int i = name.lastIndexOf('$');
     outerName = name.substring(0, i);
     super.visitInnerClass(name, outerName, innerName, access);
   } else {
     super.visitInnerClass(name, outerName, innerName, access);
   }
 }
Ejemplo n.º 2
0
 @Override
 public void visitInnerClass(String name, String outerName,
         String innerName, int access) {
     // TODO should innerName be changed?
     super.visitInnerClass(remapper.mapType(name), outerName == null ? null
             : remapper.mapType(outerName), innerName, access);
 }
  // GroovyClassVisitor interface
  // -------------------------------------------------------------------------
  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,
          (String) null,
          internalBaseClassName,
          BytecodeHelper.getClassInternalNames(classNode.getInterfaces()));

      classNode.visitContents(this);

      for (Iterator iter = innerClasses.iterator(); iter.hasNext(); ) {
        ClassNode innerClass = (ClassNode) iter.next();
        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;
    }
  }
Ejemplo n.º 4
0
 @Override
 public void visitInnerClass(String name, String outerName, String innerName, int access) {
   super.visitInnerClass(name, outerName, innerName, access);
 }