Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8349867

4.10.1.9: Simplify protected check

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • specification
    • vm

      4.10.1.9 contains a lot of discussion and code to accomplish something relatively simple: decide whether a referenced method would resolve to a protected method declared in a superclass, and if so, and ensure the type on the stack is assignable to the current class type.

      A few potential simplifications to consider:

      - Define a single rule for the relevancy test, and use negation ('\+ foo()') to trivially succeed when all the preconditions aren't met

      - Get rid of the 'classesInOtherPkgWithProtectedMember' result list, which never gets used—it's just a search to see if there is at least one match

      - Rename the check to something more descriptive, and simplify the inputs—e.g., it looks like 'Target' might be a better input than an entire StackFrame

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: