groovy-all-1.8.0

16:21:40.497 INFO  jd.cli.Main - Decompiling groovy-all-1.8.0.jar
package groovy.beans;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.codehaus.groovy.transform.GroovyASTTransformationClass;

@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.TYPE})
@GroovyASTTransformationClass({"groovy.beans.BindableASTTransformation"})
public @interface Bindable {}

/* Location:
 * Qualified Name:     groovy.beans.Bindable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovyjarjarasm.asm.Opcodes;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.List;
import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.AnnotatedNode;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.Parameter;
import org.codehaus.groovy.ast.PropertyNode;
import org.codehaus.groovy.ast.expr.ArgumentListExpression;
import org.codehaus.groovy.ast.expr.BinaryExpression;
import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.expr.ConstructorCallExpression;
import org.codehaus.groovy.ast.expr.DeclarationExpression;
import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.ast.expr.FieldExpression;
import org.codehaus.groovy.ast.expr.MethodCallExpression;
import org.codehaus.groovy.ast.expr.VariableExpression;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.ast.stmt.ReturnStatement;
import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.control.ErrorCollector;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.messages.SimpleMessage;
import org.codehaus.groovy.control.messages.SyntaxErrorMessage;
import org.codehaus.groovy.runtime.MetaClassHelper;
import org.codehaus.groovy.syntax.SyntaxException;
import org.codehaus.groovy.syntax.Token;
import org.codehaus.groovy.transform.ASTTransformation;
import org.codehaus.groovy.transform.GroovyASTTransformation;

@GroovyASTTransformation(phase=CompilePhase.CANONICALIZATION)
public class BindableASTTransformation
  implements ASTTransformation, Opcodes
{
  protected static ClassNode boundClassNode = ClassHelper.make(Bindable.class);
  protected ClassNode pcsClassNode = ClassHelper.make(PropertyChangeSupport.class);
  
  public static boolean hasBindableAnnotation(AnnotatedNode node)
  {
    for (AnnotationNode annotation : node.getAnnotations()) {
      if (boundClassNode.equals(annotation.getClassNode())) {
        return true;
      }
    }
    return false;
  }
  
  public void visit(ASTNode[] nodes, SourceUnit source)
  {
    if ((!(nodes[0] instanceof AnnotationNode)) || (!(nodes[1] instanceof AnnotatedNode))) {
      throw new RuntimeException("Internal error: wrong types: $node.class / $parent.class");
    }
    AnnotationNode node = (AnnotationNode)nodes[0];
    AnnotatedNode parent = (AnnotatedNode)nodes[1];
    if (VetoableASTTransformation.hasVetoableAnnotation(parent)) {
      return;
    }
    ClassNode declaringClass = parent.getDeclaringClass();
    if ((parent instanceof FieldNode))
    {
      if ((((FieldNode)parent).getModifiers() & 0x10) != 0) {
        source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException("@groovy.beans.Bindable cannot annotate a final property.", node.getLineNumber(), node.getColumnNumber()), source));
      }
      if (VetoableASTTransformation.hasVetoableAnnotation(parent.getDeclaringClass())) {
        return;
      }
      addListenerToProperty(source, node, declaringClass, (FieldNode)parent);
    }
    else if ((parent instanceof ClassNode))
    {
      addListenerToClass(source, node, (ClassNode)parent);
    }
  }
  
  private void addListenerToProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field)
  {
    String fieldName = field.getName();
    for (PropertyNode propertyNode : declaringClass.getProperties()) {
      if (propertyNode.getName().equals(fieldName))
      {
        if (field.isStatic())
        {
          source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException("@groovy.beans.Bindable cannot annotate a static property.", node.getLineNumber(), node.getColumnNumber()), source));
        }
        else
        {
          if (needsPropertyChangeSupport(declaringClass, source)) {
            addPropertyChangeSupport(declaringClass);
          }
          createListenerSetter(source, node, declaringClass, propertyNode);
        }
        return;
      }
    }
    source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException("@groovy.beans.Bindable must be on a property, not a field.  Try removing the private, protected, or public modifier.", node.getLineNumber(), node.getColumnNumber()), source));
  }
  
  private void addListenerToClass(SourceUnit source, AnnotationNode node, ClassNode classNode)
  {
    if (needsPropertyChangeSupport(classNode, source)) {
      addPropertyChangeSupport(classNode);
    }
    for (PropertyNode propertyNode : classNode.getProperties())
    {
      FieldNode field = propertyNode.getField();
      if ((!hasBindableAnnotation(field)) && ((field.getModifiers() & 0x10) == 0) && (!field.isStatic()) && (!VetoableASTTransformation.hasVetoableAnnotation(field))) {
        createListenerSetter(source, node, classNode, propertyNode);
      }
    }
  }
  
  private void wrapSetterMethod(ClassNode classNode, String propertyName)
  {
    String getterName = "get" + MetaClassHelper.capitalize(propertyName);
    MethodNode setter = classNode.getSetterMethod("set" + MetaClassHelper.capitalize(propertyName));
    if (setter != null)
    {
      Statement code = setter.getCode();
      
      VariableExpression oldValue = new VariableExpression("$oldValue");
      VariableExpression newValue = new VariableExpression("$newValue");
      BlockStatement block = new BlockStatement();
      
      block.addStatement(new ExpressionStatement(new DeclarationExpression(oldValue, Token.newSymbol(100, 0, 0), new MethodCallExpression(VariableExpression.THIS_EXPRESSION, getterName, ArgumentListExpression.EMPTY_ARGUMENTS))));
      
      block.addStatement(code);
      
      block.addStatement(new ExpressionStatement(new DeclarationExpression(newValue, Token.newSymbol(100, 0, 0), new MethodCallExpression(VariableExpression.THIS_EXPRESSION, getterName, ArgumentListExpression.EMPTY_ARGUMENTS))));
      
      block.addStatement(new ExpressionStatement(new MethodCallExpression(VariableExpression.THIS_EXPRESSION, "firePropertyChange", new ArgumentListExpression(new Expression[] { new ConstantExpression(propertyName), oldValue, newValue }))));
      
      setter.setCode(block);
    }
  }
  
  private void createListenerSetter(SourceUnit source, AnnotationNode node, ClassNode classNode, PropertyNode propertyNode)
  {
    String setterName = "set" + MetaClassHelper.capitalize(propertyNode.getName());
    if (classNode.getMethods(setterName).isEmpty())
    {
      Expression fieldExpression = new FieldExpression(propertyNode.getField());
      Statement setterBlock = createBindableStatement(propertyNode, fieldExpression);
      
      createSetterMethod(classNode, propertyNode, setterName, setterBlock);
    }
    else
    {
      wrapSetterMethod(classNode, propertyNode.getName());
    }
  }
  
  protected Statement createBindableStatement(PropertyNode propertyNode, Expression fieldExpression)
  {
    return new ExpressionStatement(new MethodCallExpression(VariableExpression.THIS_EXPRESSION, "firePropertyChange", new ArgumentListExpression(new Expression[] { new ConstantExpression(propertyNode.getName()), fieldExpression, new BinaryExpression(fieldExpression, Token.newSymbol(100, 0, 0), new VariableExpression("value")) })));
  }
  
  protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock)
  {
    Parameter[] setterParameterTypes = { new Parameter(propertyNode.getType(), "value") };
    MethodNode setter = new MethodNode(setterName, propertyNode.getModifiers(), ClassHelper.VOID_TYPE, setterParameterTypes, ClassNode.EMPTY_ARRAY, setterBlock);
    
    setter.setSynthetic(true);
    
    declaringClass.addMethod(setter);
  }
  
  protected boolean needsPropertyChangeSupport(ClassNode declaringClass, SourceUnit sourceUnit)
  {
    boolean foundAdd = false;boolean foundRemove = false;boolean foundFire = false;
    ClassNode consideredClass = declaringClass;
    while (consideredClass != null)
    {
      for (MethodNode method : consideredClass.getMethods())
      {
        foundAdd = (foundAdd) || ((method.getName().equals("addPropertyChangeListener")) && (method.getParameters().length == 1));
        foundRemove = (foundRemove) || ((method.getName().equals("removePropertyChangeListener")) && (method.getParameters().length == 1));
        foundFire = (foundFire) || ((method.getName().equals("firePropertyChange")) && (method.getParameters().length == 3));
        if ((foundAdd) && (foundRemove) && (foundFire)) {
          return false;
        }
      }
      consideredClass = consideredClass.getSuperClass();
    }
    consideredClass = declaringClass.getSuperClass();
    while (consideredClass != null)
    {
      if (hasBindableAnnotation(consideredClass)) {
        return false;
      }
      for (FieldNode field : consideredClass.getFields()) {
        if (hasBindableAnnotation(field)) {
          return false;
        }
      }
      consideredClass = consideredClass.getSuperClass();
    }
    if ((foundAdd) || (foundRemove) || (foundFire))
    {
      sourceUnit.getErrorCollector().addErrorAndContinue(new SimpleMessage("@Bindable cannot be processed on " + declaringClass.getName() + " because some but not all of addPropertyChangeListener, removePropertyChange, and firePropertyChange were declared in the current or super classes.", sourceUnit));
      
      return false;
    }
    return true;
  }
  
  protected void addPropertyChangeSupport(ClassNode declaringClass)
  {
    ClassNode pcsClassNode = ClassHelper.make(PropertyChangeSupport.class);
    ClassNode pclClassNode = ClassHelper.make(PropertyChangeListener.class);
    
    FieldNode pcsField = declaringClass.addField("this$propertyChangeSupport", 4114, pcsClassNode, new ConstructorCallExpression(pcsClassNode, new ArgumentListExpression(new Expression[] { new VariableExpression("this") })));
    
    declaringClass.addMethod(new MethodNode("addPropertyChangeListener", 4097, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(pclClassNode, "listener") }, ClassNode.EMPTY_ARRAY, new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "addPropertyChangeListener", new ArgumentListExpression(new Expression[] { new VariableExpression("listener") })))));
    
    declaringClass.addMethod(new MethodNode("addPropertyChangeListener", 4097, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(ClassHelper.STRING_TYPE, "name"), new Parameter(pclClassNode, "listener") }, ClassNode.EMPTY_ARRAY, new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "addPropertyChangeListener", new ArgumentListExpression(new Expression[] { new VariableExpression("name"), new VariableExpression("listener") })))));
    
    declaringClass.addMethod(new MethodNode("removePropertyChangeListener", 4097, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(pclClassNode, "listener") }, ClassNode.EMPTY_ARRAY, new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "removePropertyChangeListener", new ArgumentListExpression(new Expression[] { new VariableExpression("listener") })))));
    
    declaringClass.addMethod(new MethodNode("removePropertyChangeListener", 4097, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(ClassHelper.STRING_TYPE, "name"), new Parameter(pclClassNode, "listener") }, ClassNode.EMPTY_ARRAY, new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "removePropertyChangeListener", new ArgumentListExpression(new Expression[] { new VariableExpression("name"), new VariableExpression("listener") })))));
    
    declaringClass.addMethod(new MethodNode("firePropertyChange", 4097, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(ClassHelper.STRING_TYPE, "name"), new Parameter(ClassHelper.OBJECT_TYPE, "oldValue"), new Parameter(ClassHelper.OBJECT_TYPE, "newValue") }, ClassNode.EMPTY_ARRAY, new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "firePropertyChange", new ArgumentListExpression(new Expression[] { new VariableExpression("name"), new VariableExpression("oldValue"), new VariableExpression("newValue") })))));
    
    declaringClass.addMethod(new MethodNode("getPropertyChangeListeners", 4097, pclClassNode.makeArray(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new ReturnStatement(new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "getPropertyChangeListeners", ArgumentListExpression.EMPTY_ARGUMENTS)))));
    
    declaringClass.addMethod(new MethodNode("getPropertyChangeListeners", 4097, pclClassNode.makeArray(), new Parameter[] { new Parameter(ClassHelper.STRING_TYPE, "name") }, ClassNode.EMPTY_ARRAY, new ReturnStatement(new ExpressionStatement(new MethodCallExpression(new FieldExpression(pcsField), "getPropertyChangeListeners", new ArgumentListExpression(new Expression[] { new VariableExpression("name") }))))));
  }
}

/* Location:
 * Qualified Name:     groovy.beans.BindableASTTransformation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Target;
import org.codehaus.groovy.transform.GroovyASTTransformationClass;

@Documented
@Target({java.lang.annotation.ElementType.FIELD})
@GroovyASTTransformationClass({"groovy.beans.ListenerListASTTransformation"})
public @interface ListenerList
{
  String name() default "";
  
  boolean synchronize() default false;
}

/* Location:
 * Qualified Name:     groovy.beans.ListenerList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovy.lang.Closure;
import groovy.lang.Reference;
import org.codehaus.groovy.ast.Parameter;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.callsite.CallSite;

class ListenerListASTTransformation$_addFireMethods_closure3
  extends Closure<V>
  implements GeneratedClosure
{
  public ListenerListASTTransformation$_addFireMethods_closure3(Object _outerInstance, Object _thisObject, Reference<T> args)
  {
    super(_outerInstance, _thisObject);
    Object localObject = args;
    this.args = ((Reference)localObject);
  }
  
  public Object doCall(Parameter parameter)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();return arrayOfCallSite[0].call(args.get(), arrayOfCallSite[1].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[2].callGetProperty(parameter)));return null;
  }
  
  public Object call(Parameter parameter)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return arrayOfCallSite[3].callCurrent(this, parameter);
    return null;
  }
  
  public Object getArgs()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return args.get();
    return null;
  }
  
  static {}
}

/* Location:
 * Qualified Name:     groovy.beans.ListenerListASTTransformation._addFireMethods_closure3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovy.lang.Closure;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
import org.codehaus.groovy.runtime.callsite.CallSite;

class ListenerListASTTransformation$_addFireMethods_closure4
  extends Closure<V>
  implements GeneratedClosure
{
  public ListenerListASTTransformation$_addFireMethods_closure4(Object _outerInstance, Object _thisObject)
  {
    super(_outerInstance, _thisObject);
  }
  
  public Object doCall(Object it)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();Object localObject1 = arrayOfCallSite[0].call($get$$class$org$codehaus$groovy$ast$ClassHelper(), arrayOfCallSite[1].callGetProperty(arrayOfCallSite[2].callGetProperty(it)));Object cn = localObject1;
    arrayOfCallSite[3].call(cn, arrayOfCallSite[4].callGetProperty(it));
    return arrayOfCallSite[5].callConstructor($get$$class$org$codehaus$groovy$ast$Parameter(), arrayOfCallSite[6].call($get$$class$org$codehaus$groovy$ast$ClassHelper(), cn), arrayOfCallSite[7].callGetProperty(it));return null;
  }
  
  public Object doCall()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return arrayOfCallSite[8].callCurrent(this, ScriptBytecodeAdapter.createPojoWrapper(null, $get$$class$java$lang$Object()));
    return null;
  }
  
  static {}
}

/* Location:
 * Qualified Name:     groovy.beans.ListenerListASTTransformation._addFireMethods_closure4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovy.lang.Closure;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
import org.codehaus.groovy.runtime.callsite.CallSite;
import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;

class ListenerListASTTransformation$_visit_closure1
  extends Closure<V>
  implements GeneratedClosure
{
  public ListenerListASTTransformation$_visit_closure1(Object _outerInstance, Object _thisObject)
  {
    super(_outerInstance, _thisObject);
  }
  
  public Object doCall(MethodNode m)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    if (DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[0].call(m))) {}
    if (((!DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[1].call(m)) ? 1 : 0) != 0 ? 1 : 0) != 0) {}
    return ScriptBytecodeAdapter.castToType((Boolean)DefaultTypeTransformation.box((!DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[2].call(m)) ? 1 : 0) != 0 ? 1 : 0), $get$$class$java$lang$Object());return null;
  }
  
  public Object call(MethodNode m)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return arrayOfCallSite[3].callCurrent(this, m);
    return null;
  }
  
  static {}
}

/* Location:
 * Qualified Name:     groovy.beans.ListenerListASTTransformation._visit_closure1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovy.lang.Closure;
import groovy.lang.Reference;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.runtime.ArrayUtil;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
import org.codehaus.groovy.runtime.callsite.CallSite;

class ListenerListASTTransformation$_visit_closure2
  extends Closure<V>
  implements GeneratedClosure
{
  public ListenerListASTTransformation$_visit_closure2(Object _outerInstance, Object _thisObject, Reference<T> field, Reference<T> node, Reference<T> declaringClass, Reference<T> source, Reference<T> synchronize)
  {
    super(_outerInstance, _thisObject);
    FieldNode localFieldNode = field;
    this.field = localFieldNode;
    AnnotationNode localAnnotationNode = node;
    this.node = localAnnotationNode;
    ClassNode localClassNode = declaringClass;
    this.declaringClass = localClassNode;
    SourceUnit localSourceUnit = source;
    this.source = localSourceUnit;
    Object localObject = synchronize;
    this.synchronize = ((Reference)localObject);
  }
  
  public Object doCall(MethodNode method)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();return arrayOfCallSite[0].callCurrent(this, ArrayUtil.createArray(source.get(), node.get(), declaringClass.get(), field.get(), synchronize.get(), method));return null;
  }
  
  public Object call(MethodNode method)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return arrayOfCallSite[1].callCurrent(this, method);
    return null;
  }
  
  public FieldNode getField()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return (FieldNode)ScriptBytecodeAdapter.castToType(field.get(), $get$$class$org$codehaus$groovy$ast$FieldNode());
    return null;
  }
  
  public AnnotationNode getNode()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return (AnnotationNode)ScriptBytecodeAdapter.castToType(node.get(), $get$$class$org$codehaus$groovy$ast$AnnotationNode());
    return null;
  }
  
  public ClassNode getDeclaringClass()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return (ClassNode)ScriptBytecodeAdapter.castToType(declaringClass.get(), $get$$class$org$codehaus$groovy$ast$ClassNode());
    return null;
  }
  
  public SourceUnit getSource()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return (SourceUnit)ScriptBytecodeAdapter.castToType(source.get(), $get$$class$org$codehaus$groovy$control$SourceUnit());
    return null;
  }
  
  public Object getSynchronize()
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return synchronize.get();
    return null;
  }
  
  static {}
}

/* Location:
 * Qualified Name:     groovy.beans.ListenerListASTTransformation._visit_closure2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package groovy.beans;

import groovy.lang.Closure;
import groovy.lang.GroovyObject;
import groovy.lang.MetaClass;
import groovy.lang.Reference;
import groovyjarjarasm.asm.Opcodes;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.Parameter;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.runtime.ArrayUtil;
import org.codehaus.groovy.runtime.GStringImpl;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
import org.codehaus.groovy.runtime.callsite.CallSite;
import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
import org.codehaus.groovy.transform.ASTTransformation;
import org.codehaus.groovy.transform.GroovyASTTransformation;

@GroovyASTTransformation(phase=CompilePhase.CANONICALIZATION)
public class ListenerListASTTransformation
  implements ASTTransformation, Opcodes, GroovyObject
{
  private static final Class MY_CLASS;
  private static final ClassNode COLLECTION_TYPE;
  
  static
  {
    __$swapInit();Long localLong1 = (Long)DefaultTypeTransformation.box(0L);__timeStamp__239_neverHappen1303908893208 = DefaultTypeTransformation.longUnbox(localLong1);Long localLong2 = (Long)DefaultTypeTransformation.box(1303908893208L);__timeStamp = DefaultTypeTransformation.longUnbox(localLong2);Class localClass = $get$$class$groovy$beans$ListenerList();MY_CLASS = localClass;Object localObject = $getCallSiteArray()[242].call($get$$class$org$codehaus$groovy$ast$ClassHelper(), $get$$class$java$util$Collection());COLLECTION_TYPE = (ClassNode)ScriptBytecodeAdapter.castToType(localObject, $get$$class$org$codehaus$groovy$ast$ClassNode());
  }
  
  class _visit_closure1
    extends Closure<V>
    implements GeneratedClosure
  {
    public _visit_closure1(Object _thisObject)
    {
      super(_thisObject);
    }
    
    public Object doCall(MethodNode m)
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      if (DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[0].call(m))) {}
      if (((!DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[1].call(m)) ? 1 : 0) != 0 ? 1 : 0) != 0) {}
      return ScriptBytecodeAdapter.castToType((Boolean)DefaultTypeTransformation.box((!DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[2].call(m)) ? 1 : 0) != 0 ? 1 : 0), $get$$class$java$lang$Object());return null;
    }
    
    public Object call(MethodNode m)
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return arrayOfCallSite[3].callCurrent(this, m);
      return null;
    }
    
    static {}
  }
  
  class _visit_closure2
    extends Closure<V>
    implements GeneratedClosure
  {
    public _visit_closure2(Object _thisObject, Reference<T> field, Reference<T> node, Reference<T> declaringClass, Reference<T> source, Reference<T> synchronize)
    {
      super(_thisObject);
      FieldNode localFieldNode = field;
      this.field = localFieldNode;
      AnnotationNode localAnnotationNode = node;
      this.node = localAnnotationNode;
      ClassNode localClassNode = declaringClass;
      this.declaringClass = localClassNode;
      SourceUnit localSourceUnit = source;
      this.source = localSourceUnit;
      Object localObject = synchronize;
      this.synchronize = ((Reference)localObject);
    }
    
    public Object doCall(MethodNode method)
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();return arrayOfCallSite[0].callCurrent(this, ArrayUtil.createArray(source.get(), node.get(), declaringClass.get(), field.get(), synchronize.get(), method));return null;
    }
    
    public Object call(MethodNode method)
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return arrayOfCallSite[1].callCurrent(this, method);
      return null;
    }
    
    public FieldNode getField()
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return (FieldNode)ScriptBytecodeAdapter.castToType(field.get(), $get$$class$org$codehaus$groovy$ast$FieldNode());
      return null;
    }
    
    public AnnotationNode getNode()
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return (AnnotationNode)ScriptBytecodeAdapter.castToType(node.get(), $get$$class$org$codehaus$groovy$ast$AnnotationNode());
      return null;
    }
    
    public ClassNode getDeclaringClass()
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return (ClassNode)ScriptBytecodeAdapter.castToType(declaringClass.get(), $get$$class$org$codehaus$groovy$ast$ClassNode());
      return null;
    }
    
    public SourceUnit getSource()
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return (SourceUnit)ScriptBytecodeAdapter.castToType(source.get(), $get$$class$org$codehaus$groovy$control$SourceUnit());
      return null;
    }
    
    public Object getSynchronize()
    {
      CallSite[] arrayOfCallSite = $getCallSiteArray();
      return synchronize.get();
      return null;
    }
    
    static {}
  }
  
  private static Object addError(AnnotationNode node, SourceUnit source, String message)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();
    return arrayOfCallSite[45].call(arrayOfCallSite[46].callGetProperty(source), arrayOfCallSite[47].callConstructor($get$$class$org$codehaus$groovy$control$messages$SyntaxErrorMessage(), arrayOfCallSite[48].callConstructor($get$$class$org$codehaus$groovy$syntax$SyntaxException(), message, arrayOfCallSite[49].callGetProperty(node), arrayOfCallSite[50].callGetProperty(node)), source));return null;
  }
  
  public void addAddListener(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field, ClassNode listener, String name, Object synchronize)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();Object localObject1 = DefaultTypeTransformation.booleanUnbox(synchronize) ? arrayOfCallSite[51].call(arrayOfCallSite[52].callGroovyObjectGetProperty(this), arrayOfCallSite[53].callGroovyObjectGetProperty(this)) : arrayOfCallSite[54].callGroovyObjectGetProperty(this);Object methodModifiers = localObject1;
    Object localObject2 = arrayOfCallSite[55].call($get$$class$org$codehaus$groovy$ast$ClassHelper(), arrayOfCallSite[56].callGetProperty($get$$class$java$lang$Void()));Object methodReturnType = localObject2;
    GStringImpl localGStringImpl = new GStringImpl(new Object[] { arrayOfCallSite[57].call(name) }, new String[] { "add", "" });Object methodName = localGStringImpl;
    Parameter[] arrayOfParameter = (Parameter[])ScriptBytecodeAdapter.asType(ScriptBytecodeAdapter.createList(new Object[] { arrayOfCallSite[58].callConstructor($get$$class$org$codehaus$groovy$ast$Parameter(), listener, "listener") }), $get$array$$class$org$codehaus$groovy$ast$Parameter());Object methodParameter = arrayOfParameter;
    if (DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[59].call(declaringClass, methodName, methodParameter)))
    {
      arrayOfCallSite[60].callStatic($get$$class$groovy$beans$ListenerListASTTransformation(), node, source, new GStringImpl(new Object[] { arrayOfCallSite[61].callGetProperty(MY_CLASS), arrayOfCallSite[62].callGetProperty(declaringClass), methodName }, new String[] { "Conflict using @", ". Class ", " already has method ", "" }));
      return;
    }
    Object localObject3 = arrayOfCallSite[63].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$BlockStatement());BlockStatement block = (BlockStatement)ScriptBytecodeAdapter.castToType(localObject3, $get$$class$org$codehaus$groovy$ast$stmt$BlockStatement());
    arrayOfCallSite[64]
    
      .call(block, ScriptBytecodeAdapter.createList(new Object[] {arrayOfCallSite[65].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$IfStatement(), arrayOfCallSite[66].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BooleanExpression(), arrayOfCallSite[67].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[68].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), "listener"), arrayOfCallSite[69].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[70].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[71].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression()))), arrayOfCallSite[72].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ReturnStatement(), arrayOfCallSite[73].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression())), arrayOfCallSite[74].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$EmptyStatement())), arrayOfCallSite[75].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$IfStatement(), arrayOfCallSite[76].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BooleanExpression(), arrayOfCallSite[77].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[78].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[79].callGetProperty(field)), arrayOfCallSite[80].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[81].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[82].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression()))), arrayOfCallSite[83].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ExpressionStatement(), arrayOfCallSite[84].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[85].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[86].callGetProperty(field)), arrayOfCallSite[87].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[88].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[89].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ListExpression()))), arrayOfCallSite[90].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$EmptyStatement())), arrayOfCallSite[91].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ExpressionStatement(), arrayOfCallSite[92].callConstructor($get$$class$org$codehaus$groovy$ast$expr$MethodCallExpression(), arrayOfCallSite[93].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[94].callGetProperty(field)), arrayOfCallSite[95].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression(), "add"), arrayOfCallSite[96].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ArgumentListExpression(), arrayOfCallSite[97].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), "listener")))) }));
    
    arrayOfCallSite[98].call(declaringClass, arrayOfCallSite[99].callConstructor($get$$class$org$codehaus$groovy$ast$MethodNode(), ArrayUtil.createArray(methodName, methodModifiers, methodReturnType, methodParameter, ScriptBytecodeAdapter.createPojoWrapper((ClassNode[])ScriptBytecodeAdapter.asType(ScriptBytecodeAdapter.createList(new Object[0]), $get$array$$class$org$codehaus$groovy$ast$ClassNode()), $get$array$$class$org$codehaus$groovy$ast$ClassNode()), block)));
  }
  
  public void addRemoveListener(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field, ClassNode listener, String name, Object synchronize)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();Object localObject1 = DefaultTypeTransformation.booleanUnbox(synchronize) ? arrayOfCallSite[100].call(arrayOfCallSite[101].callGroovyObjectGetProperty(this), arrayOfCallSite[102].callGroovyObjectGetProperty(this)) : arrayOfCallSite[103].callGroovyObjectGetProperty(this);Object methodModifiers = localObject1;
    Object localObject2 = arrayOfCallSite[104].call($get$$class$org$codehaus$groovy$ast$ClassHelper(), arrayOfCallSite[105].callGetProperty($get$$class$java$lang$Void()));Object methodReturnType = localObject2;
    GStringImpl localGStringImpl = new GStringImpl(new Object[] { arrayOfCallSite[106].call(name) }, new String[] { "remove", "" });Object methodName = localGStringImpl;
    Parameter[] arrayOfParameter = (Parameter[])ScriptBytecodeAdapter.asType(ScriptBytecodeAdapter.createList(new Object[] { arrayOfCallSite[107].callConstructor($get$$class$org$codehaus$groovy$ast$Parameter(), listener, "listener") }), $get$array$$class$org$codehaus$groovy$ast$Parameter());Object methodParameter = arrayOfParameter;
    if (DefaultTypeTransformation.booleanUnbox(arrayOfCallSite[108].call(declaringClass, methodName, methodParameter)))
    {
      arrayOfCallSite[109].callStatic($get$$class$groovy$beans$ListenerListASTTransformation(), node, source, new GStringImpl(new Object[] { arrayOfCallSite[110].callGetProperty(MY_CLASS), arrayOfCallSite[111].callGetProperty(declaringClass), methodName }, new String[] { "Conflict using @", ". Class ", " already has method ", "" }));
      return;
    }
    Object localObject3 = arrayOfCallSite[112].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$BlockStatement());BlockStatement block = (BlockStatement)ScriptBytecodeAdapter.castToType(localObject3, $get$$class$org$codehaus$groovy$ast$stmt$BlockStatement());
    arrayOfCallSite[113]
    
      .call(block, ScriptBytecodeAdapter.createList(new Object[] {arrayOfCallSite[114].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$IfStatement(), arrayOfCallSite[115].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BooleanExpression(), arrayOfCallSite[116].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[117].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), "listener"), arrayOfCallSite[118].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[119].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[120].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression()))), arrayOfCallSite[121].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ReturnStatement(), arrayOfCallSite[122].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression())), arrayOfCallSite[123].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$EmptyStatement())), arrayOfCallSite[124].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$IfStatement(), arrayOfCallSite[125].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BooleanExpression(), arrayOfCallSite[126].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[127].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[128].callGetProperty(field)), arrayOfCallSite[129].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[130].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[131].callGetProperty($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression()))), arrayOfCallSite[132].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ExpressionStatement(), arrayOfCallSite[133].callConstructor($get$$class$org$codehaus$groovy$ast$expr$BinaryExpression(), arrayOfCallSite[134].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[135].callGetProperty(field)), arrayOfCallSite[136].call($get$$class$org$codehaus$groovy$syntax$Token(), arrayOfCallSite[137].callGetProperty($get$$class$org$codehaus$groovy$syntax$Types()), (Integer)DefaultTypeTransformation.box(0), (Integer)DefaultTypeTransformation.box(0)), arrayOfCallSite[138].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ListExpression()))), arrayOfCallSite[139].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$EmptyStatement())), arrayOfCallSite[140].callConstructor($get$$class$org$codehaus$groovy$ast$stmt$ExpressionStatement(), arrayOfCallSite[141].callConstructor($get$$class$org$codehaus$groovy$ast$expr$MethodCallExpression(), arrayOfCallSite[142].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), arrayOfCallSite[143].callGetProperty(field)), arrayOfCallSite[144].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ConstantExpression(), "remove"), arrayOfCallSite[145].callConstructor($get$$class$org$codehaus$groovy$ast$expr$ArgumentListExpression(), arrayOfCallSite[146].callConstructor($get$$class$org$codehaus$groovy$ast$expr$VariableExpression(), "listener")))) }));
    
    arrayOfCallSite[147].call(declaringClass, arrayOfCallSite[148].callConstructor($get$$class$org$codehaus$groovy$ast$MethodNode(), ArrayUtil.createArray(methodName, methodModifiers, methodReturnType, methodParameter, ScriptBytecodeAdapter.createPojoWrapper((ClassNode[])ScriptBytecodeAdapter.asType(ScriptBytecodeAdapter.createList(new Object[0]), $get$array$$class$org$codehaus$groovy$ast$ClassNode()), $get$array$$class$org$codehaus$groovy$ast$ClassNode()), block)));
  }
  
  public void addGetListeners(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field, ClassNode listener, String name, Object synchronize)
  {
    CallSite[] arrayOfCallSite = $getCallSiteArray();Object localObject1 = DefaultTypeTransformation.booleanUnbox(synchronize) ? arrayOfCallSite[149].call(arrayOfCallSite[150].callGroovyObjectGetProperty(this), arrayOfCallSit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd