[ 
https://issues.apache.org/jira/browse/GROOVY-10123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17357414#comment-17357414
 ] 

Eric Milles edited comment on GROOVY-10123 at 6/4/21, 3:59 PM:
---------------------------------------------------------------

Remove {{StaticTypeCheckingVisitor#collectAllInterfacesByName}} from public 
API: 
https://github.com/apache/groovy/commit/cfd5ef09e43d3f29fb3c2d5468858c15d0cf165c#diff-bcefd1df8dae28cf3088708841e5e3a14d026d79a9d6b39fc1165e6b16f5dd1e

This same commit also resolves the bug in {{GeneralUtils}} and the redundancy 
with {{StaticTypeCheckingSupport}}.

So now you have these options, each providing a little more than the last:
{code:java}
org.codehaus.groovy.ast.ClassNode#getInterfaces() // interfaces as seen in 
"implements"

org.codehaus.groovy.ast.ClassNode#getAllInterfaces() // includes this, excludes 
super types

org.codehaus.groovy.ast.tools.GeneralUtils#getInterfacesAndSuperInterfaces(ClassNode)
 // includes parameter (if interface) and interfaces from super types

org.codehaus.groovy.transform.trait.Traits#collectAllInterfacesReverseOrder(ClassNode,
 LinkedHashSet<ClassNode>) // parameterizes results; accepts {{LinkedHashSet}} 
instead of {{Set}} -- maybe a bridge method fix is in order?
{code}


was (Author: emilles):
Remove {{StaticTypeCheckingVisitor#collectAllInterfacesByName}} from public 
API: 
https://github.com/apache/groovy/commit/cfd5ef09e43d3f29fb3c2d5468858c15d0cf165c#diff-bcefd1df8dae28cf3088708841e5e3a14d026d79a9d6b39fc1165e6b16f5dd1e

This same commit also resolves the bug in {{GeneralUtils}} and the redundancy 
with {{StaticTypeCheckingSupport}}.

So now you have these options, each providing a little more than the last:
{code:java}
org.codehaus.groovy.ast.ClassNode#getInterfaces() // interfaces as seen in 
"implements"

org.codehaus.groovy.ast.ClassNode#getAllInterfaces() // includes this, excludes 
super types

org.codehaus.groovy.ast.tools.GeneralUtils#getInterfacesAndSuperInterfaces(ClassNode)
 // includes this and super types

org.codehaus.groovy.transform.trait.Traits#collectAllInterfacesReverseOrder(ClassNode,
 LinkedHashSet<ClassNode>) // parameterizes results; accepts {{LinkedHashSet}} 
instead of {{Set}} -- maybe a bridge method fix is in order?
{code}

> Consolidate methods for collecting interfaces
> ---------------------------------------------
>
>                 Key: GROOVY-10123
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10123
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>              Labels: breaking
>
> There are a number of options presented for collecting interfaces or methods, 
> each with some subtle difference.
> {code:java}
> // 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
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to