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

New --add-opens VM option is not taken into account in WebStart app

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+152)
      Java HotSpot(TM) Server VM (build 9-ea+152, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      The new option '--add-opens' is not handled in com.sun.deploy.config.Config, leading to run-time failure when reflective applications (using XStream, Hibernate, ...) are run

      REGRESSION. Last worked in version 9

      ADDITIONAL REGRESSION INFORMATION:
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+152)
      Java HotSpot(TM) Server VM (build 9-ea+152, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the given source file and put in a JAR file
      2. Sign JAR file
      3. Deploy as a webstart app with the given (unsigned) JNLP file
      4. Run application

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      WebStart app should display "OK"
      ACTUAL -
      App crashes with an exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @1391280
      at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:207)
      at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
      at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
      at OpenModuleTest.main(OpenModuleTest.java:11)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:543)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.executeApplication(Launcher.java:1738)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.executeMainClass(Launcher.java:1674)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1522)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.run(Launcher.java:158)
      at java.base/java.lang.Thread.run(Thread.java:844)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      OpenModuleTest.java
      =================

      package com.nexgenfs.core;

      import java.lang.reflect.Field;
      import java.util.Comparator;
      import java.util.TreeMap;

      public class OpenModuleTest {
          public static void main(String[] args) {
              for (Field field : TreeMap.class.getDeclaredFields()) {
                  if (field.getType() == Comparator.class) {
                      field.setAccessible(true);
                      break;
                  }

              }

              System.out.println("OK");
          }
      }

      test.jnlp
      =======

      <?xml version="1.0" encoding="utf-8"?>
       <jnlp spec="6.0+" codebase="http://www.example.com/webstart" href="test.jnlp">
         <security>
             <all-permissions/>
         </security>
         <resources>
           <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="64m" max-heap-size="384m" java-vm-args="-ea --add-modules=java.se.ee --add-opens=java.base/java.util=ALL-UNNAMED"/>
           <jar href="test.jar" main="true"/>
         </resources>
         <application-desc main-class="OpenModuleTest"/>
       </jnlp>

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pardesha Pardeep Sharma
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: