Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3333

Bindable/Vetoable ast transformations are missing a listener query method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-2
    • 1.6.3, 1.7-beta-1
    • None
    • None

    Description

      Both transformations do not add a method with the following signature

      public PropertyChangeListener[] getPropertyChangeListeners( String propName )
      

      The following code will remedy that situation

              // add method:
              // PropertyChangeSupport[] getPropertyChangeListeners(String name) {
              //   return this$propertyChangeSupport.getPropertyChangeListeners(name)
              // }
              declaringClass.addMethod(
                      new MethodNode(
                              "getPropertyChangeListeners",
                              ACC_PUBLIC | ACC_SYNTHETIC,
                              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")}))))));
      

      Attachments

        Activity

          People

            aalmiray Andres Almiray
            aalmiray Andres Almiray
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: