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

ResourceBundle should allow --add-opens be used to get encapsulated resources

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10, JDK 11

      A DESCRIPTION OF THE PROBLEM :

      Consider the guide:
      https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-12F945EB-71D6-46AF-8C3D-D354FD0B1781

      which does clearly state that --add-opens should allow JDK-8 applications to work under JDK-9.

      The proposed solution does NOT allow to run JDK-8 code loading some internal resources (for an example to provide extract resources necessary to provide missing locales for Swing components) under more modern versions.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run below code with:

      java --add-opens java.desktop/com.sun.swing.internal.plaf.basic.resources=ALL-UNNAMED X


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Resource should load if:

      --adds-open java.desktop/com.sun.swing.internal.plaf.basic.resources=ALL-UNAMED

      is specified in command line.
      ACTUAL -
      java.lang.IllegalAccessException: unnamed module can't load com.sun.swing.internal.plaf.basic.resources.basic in module java.desktop
              at java.base/java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:3184)
              at java.base/java.util.ResourceBundle.loadBundle(ResourceBundle.java:1994)
              at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1776)
              at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1728)
              at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1728)
              at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1662)

      ---------- BEGIN SOURCE ----------
      import java.util.*;
      public class X
      {
      public static void main(String [] a)throws Throwable
      {
      ResourceBundle b = ResourceBundle.getBundle("com.sun.swing.internal.plaf.basic.resources.basic",Locale.US);
      };
      };
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Downgrade entire system to JDK 8 ?

      By the way, please make captcha at https://bugreport.java.com/bugreport/start_form.do not to shak that fast. 0.25 second to see missing first character is a challenge.

      FREQUENCY : always


            mchung Mandy Chung (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: