JDK-8237538 : native2ascii tool removed since jdk9 prevents building projects for earlier JREs
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: generic
  • CPU: generic
  • Submitted: 2020-01-03
  • Updated: 2020-06-22
  • Resolved: 2020-06-22
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
The rationale for removing native2ascii was: properties now do support UTF-8 and nobody used it anyway. 

First part is correct, second is not. 

Problems:
1. Use JDK9 + to compile project for JRE8 and earlier. The javac allows to create backwards compatible code and can create class files compatible with older JRE. The missing native2ascii tool however DOES NOT ALLOW to perform necessary conversion for properties files, thous such project cannot be build.

2.The description of new loading process in JDK java.util.Properties is in REVERSE. The escapes used earlier ARE UTF-8 compatible, but UTF-8 upper characters are not within ISO set so if ISO processing fail one can go to UTF-8 but not vice versa. The implementation is however correct and old programs are running fine in new JRE.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Load unconverted UTF-8 properties in pre-9 JRE.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
native2ascii should be restored for downwards compatibility. May be not maintained, it just should be there and work as it did work.
ACTUAL -
I is impossible to build downwards compatible projects with JDK9+. Simply skipping conversion results in faults.

---------- BEGIN SOURCE ----------
None.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Keep two JDK in system, providing old versions can be still downloaded. This however does not allow to use JDK9 functionality which is not present in previous versions but is not related to language enhancements.

FREQUENCY : always



Comments
I am assuming the submitter referring to j.u.PropertyResourceBundle, not j.u.Properties. Then can the submitter please elaborate the "REVERSE" more? I believe the class description of the loading of properties is correct, which was altered with JEP 226 (https://openjdk.java.net/jeps/226), i.e., the class loads the properties resource bundle in UTF-8 first, then falls back to ISO-8859-1 if charset conversion fails.
22-06-2020

[~naoto] can you respond to problem #2 w.r.t. JEP 226 and native2ascii tool.
22-06-2020

An alternative is to build native2ascii from OpenJDK 8 source [1] as your own utility. [1] http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/235d2e871a2e/src/share/classes/sun/tools/native2ascii
22-06-2020

Further information from the submitter: User has jdk9 User uses javac target jdk6 User runs compilation scripts (sh, bat, etc) using only tool chain supplied with JDK No possibility to generate properties file. Build fails.
26-04-2020

No response was received from the submitter. As there is not enough information in this report to make headway it is being closed. If this issue is seen, please open a new report with all necessary information. This report ID can be referenced.
07-02-2020