[ 
https://issues.apache.org/jira/browse/GROOVY-9081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-9081:
-------------------------------
    Description: 
This cloned issue is to cover the rest part of case ② as mentioned in 
GROOVY-8339.
h4. 1) Sub-class derives the public members from {{package-private}} class, but 
invoke the members on the sub class instances, e.g.
[https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy#L532]
 *This case is almost fixed except for using category:*
 
[https://github.com/apache/groovy/blob/master/src/spec/test/TraitsSpecificationTest.groovy#L835]

h4. 2) Sub-class derives the {{protected}} members from public class, but 
invoke the members on the sub class instances, e.g.
[https://github.com/apache/groovy/blob/master/subprojects/groovy-swing/src/test/groovy/groovy/beans/BindableSwingTest.groovy#L31-L40]
 We are considering to generate stub/bridge methods automatically.
 *2.1) Clone array via {{clone}} method of {{java.lang.Object}} ( Note: the 
method is {{protected}} ), e.g.*
 
[https://github.com/apache/groovy/blob/master/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy#L163-L180]
 we have to find a solution to fix, as {{clone}} method of array can not be 
found via {{arrayClazz.getMethods()}}
 *2.2) Accessing the overrided {{protected}} method of sub-class(Truely illegal 
access, we should fix our code), e.g.*
https://github.com/apache/groovy/blob/master/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy#L124
{{AppClassLoader}} derives {{ClassLoader}}, but {{Class<?> loadClass(String cn, 
boolean resolve)}} of {{AppClassLoader}} is still {{protected}}, we should not 
access it if we do not want warnings.

h4. 3) Favor the method with more accurate parameter type even if it is not 
visible, e.g. {{EnumMap::equals(EnumMap<?,?>)}}
[https://github.com/apache/groovy/blob/master/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy#L271]
 When comparing two {{ClassNode}} instances, {{ClassNode.transformInstances}} 
will be compared, their type is {{EnumMap}}

  was:
This cloned issue is to cover the rest part of case ② as mentioned in 
GROOVY-8339.
h4. 1) Sub-class derives the public members from {{package-private}} class, but 
invoke the members on the sub class instances, e.g.

[https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy#L532]
 *This case is almost fixed except for using category:*
 
[https://github.com/apache/groovy/blob/master/src/spec/test/TraitsSpecificationTest.groovy#L835]
h4. 2) Sub-class derives the {{protected}} members from public class, but 
invoke the members on the sub class instances, e.g.

[https://github.com/apache/groovy/blob/master/subprojects/groovy-swing/src/test/groovy/groovy/beans/BindableSwingTest.groovy#L31-L40]
 We are considering to generate stub/bridge methods automatically.
 *2.1) Clone array via {{clone}} method of {{java.lang.Object}} ( Note: the 
method is {{protected}} ), e.g.*
 
[https://github.com/apache/groovy/blob/master/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy#L163-L180]
 we have to find a solution to fix, as {{clone}} method of array can not be 
found via {{arrayClazz.getMethods()}}
h4. 3) Favor the method with more accurate parameter type even if it is not 
visible, e.g. {{EnumMap::equals(EnumMap<?,?>)}}

[https://github.com/apache/groovy/blob/master/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy#L271]
 When comparing two {{ClassNode}} instances, {{ClassNode.transformInstances}} 
will be compared, their type is {{EnumMap}}


> CLONE - Fix warning "An illegal reflective access operation has occurred"
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-9081
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9081
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>    Affects Versions: 2.4.11, 2.4.15
>         Environment: >gradle --version
> Gradle 4.2
> Build time:   2017-09-20 14:48:23 UTC
> Revision:     5ba503cc17748671c83ce35d7da1cffd6e24dfbd
> Groovy:       2.4.11
> Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
> JVM:          9 (Oracle Corporation 9+181)
> OS:           Windows 10 10.0 amd64
>            Reporter: Benjamin Roedell
>            Priority: Major
>              Labels: security
>
> This cloned issue is to cover the rest part of case ② as mentioned in 
> GROOVY-8339.
> h4. 1) Sub-class derives the public members from {{package-private}} class, 
> but invoke the members on the sub class instances, e.g.
> [https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy#L532]
>  *This case is almost fixed except for using category:*
>  
> [https://github.com/apache/groovy/blob/master/src/spec/test/TraitsSpecificationTest.groovy#L835]
> h4. 2) Sub-class derives the {{protected}} members from public class, but 
> invoke the members on the sub class instances, e.g.
> [https://github.com/apache/groovy/blob/master/subprojects/groovy-swing/src/test/groovy/groovy/beans/BindableSwingTest.groovy#L31-L40]
>  We are considering to generate stub/bridge methods automatically.
>  *2.1) Clone array via {{clone}} method of {{java.lang.Object}} ( Note: the 
> method is {{protected}} ), e.g.*
>  
> [https://github.com/apache/groovy/blob/master/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy#L163-L180]
>  we have to find a solution to fix, as {{clone}} method of array can not be 
> found via {{arrayClazz.getMethods()}}
>  *2.2) Accessing the overrided {{protected}} method of sub-class(Truely 
> illegal access, we should fix our code), e.g.*
> https://github.com/apache/groovy/blob/master/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy#L124
> {{AppClassLoader}} derives {{ClassLoader}}, but {{Class<?> loadClass(String 
> cn, boolean resolve)}} of {{AppClassLoader}} is still {{protected}}, we 
> should not access it if we do not want warnings.
> h4. 3) Favor the method with more accurate parameter type even if it is not 
> visible, e.g. {{EnumMap::equals(EnumMap<?,?>)}}
> [https://github.com/apache/groovy/blob/master/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy#L271]
>  When comparing two {{ClassNode}} instances, {{ClassNode.transformInstances}} 
> will be compared, their type is {{EnumMap}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to