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

CLONE - Fix warning "An illegal reflective access operation has occurred"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.11, 2.4.15
    • 3.0.0-beta-1
    • groovy-jdk
    • None

    Description

      This cloned issue is to cover the rest part of GROOVY-8339.

      1) Sub-class derives the public members from package-private class, but invoke the members on the sub class instances, e.g.

      1.0) Non-category
      https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy#L532
      1.1) Category
      https://github.com/apache/groovy/blob/master/src/spec/test/TraitsSpecificationTest.groovy#L835

      3) Access public members of private class, e.g.

      https://github.com/apache/groovy/blob/master/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapter.groovy#L235
      java.util.Collections.UnmodifiableMap::toString
      We should try to find the overrided member of its base class and access(virtual invocation will happen eventually)

      4) Access public members of package-private class, e.g.

      https://github.com/apache/groovy/blob/master/src/spec/test/gdk/WorkingWithIOSpecTest.groovy#L355
      java.lang.ProcessImpl::waitFor
      We should try to find the overrided member of its base class and access(virtual invocation will happen eventually)

      5) 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

      7) Access non-visible constructor when as type, e.g.

      https://github.com/apache/groovy/blob/master/src/test/groovy/lang/MapOfClosureTest.groovy#L57
      The constructor of TimerTask is protected

       

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              benrobot Benjamin Roedell
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m