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

Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution



    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:


       Specifically for Java Virtual Machine Specification 9, section 5.4.3 Resolution:

         "Specify in the JVMS that 5.4.3 Resolution rules (below) require that
         dynamically adding a read edge or an export does not change any
         previously failed resolved references, so you can’t try, fix, retry
         and expect different behavior.

         Resolution can be attempted on a symbolic reference that has already
         been resolved. An attempt to resolve a symbolic reference that has
         already successfully been resolved always succeeds trivially and
         always results in the same entity produced by the initial resolution
         of that reference.
         If an attempt by the Java Virtual Machine to resolve a symbolic
         reference fails because an error is thrown that is an instance of
         |LinkageError| (or a subclass), then subsequent attempts to resolve
         the reference always fail with the same error that was thrown as a
         result of the initial resolution attempt."

      Attached is an example where passing a type to a method of another type and then trying to access that parameter type within the method leads to a IAE if the two types' defining modules do not have a read edge from accessor to accessee. See the call in MethodAccessReadTwice.java's call to c1::method1. Next the method c1::methodAddReadEdge is called to add a read edge between the two defining modules. c1::method1 is then invoked again, and the access succeeds without yielding the previously resolved IAE, violating JVMS 5.4.3.

      To reproduce, tar file attached.

      % javac p2/c2.java
      % javac p1/c1.java
      % javac ModuleLibrary.java
      % javac MethodAccessReadTwice.java
      % java MethodAccessReadTwice

      This bug is being marked as confidential since at this time JVMS 9 has not been finalized.


          Issue Links



              hseigel Harold Seigel
              lfoltan Lois Foltan
              0 Vote for this issue
              4 Start watching this issue