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

Consolidate methods for collecting interfaces

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.0-beta-1
    • None

    Description

      There are a number of options presented for collecting interfaces or methods, each with some subtle difference.

      // interface collection
      
      org.codehaus.groovy.ast.tools.GeneralUtils#getInterfacesAndSuperInterfaces(ClassNode) // if parameter is interface, returns singleton set (IMO it was not intended to work this way)
      
      org.codehaus.groovy.ast.ClassNode#getAllInterfaces() // includes this, excludes super types
      
      org.codehaus.groovy.transform.trait.Traits.collectAllInterfacesReverseOrder(ClassNode, LinkedHashSet<ClassNode>) // parameterizes results
      
      org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.collectAllInterfaces(ClassNode) // unused by current codebase; redundant with GeneralUtils#getInterfacesAndSuperInterfaces if "singleton set" bug is fixed
      
      // method collection
      
      org.codehaus.groovy.ast.ClassNode#getAllDeclaredMethods() // deduplicated by MethodNode#getTypeDescriptor() which keeps bridge/synthetics instead of overridden
      
      org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.collectAllInterfaceMethodsByName(ClassNode, String, List<MethodNode>) // non-static and available only to subclasses
      
      org.apache.groovy.ast.tools.ClassNodeUtils.addDeclaredMethodsFromInterfaces(ClassNode, Map<String, MethodNode>) // non-synthetic already
      
      org.apache.groovy.ast.tools.ClassNodeUtils.addDeclaredMethodsFromAllInterfaces(ClassNode, Map<String, MethodNode>) // includes synthetics, not all interfaces
      

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: