unitsofmeasurement / uom-systems

Units of Measurement Systems
http://www.uom.systems
Other
36 stars 17 forks source link

Units with higher powers in denominator cannot be formatted with UCUM formatter with JDK 10 or higher #181

Closed selios closed 3 years ago

selios commented 3 years ago

Using the 2.0.2 version, output for unit "m/s2" is "m/s" when using JDK 10 or higher Using JDK 8 output is correct IE : "m/s2"

keilw commented 3 years ago

Could you try the same with 2.1-SNAPSHOT?

keilw commented 3 years ago

There is no build for Java 10 or 11, see https://github.com/unitsofmeasurement/uom-lib/issues/62, but every Travis-CI build from Java 9 to 16-ea passes for the 2.1-SNAPSHOT, so please check that it should be resolved with 2.1.

selios commented 3 years ago

Just try with the 2.1 snapshot and same probleme.

It's strange because in the UCUMFormat class in debugger on line 295 if (u.getValue() < -1){ with u is -2, the line 296 is ignored as if the test failed.

keilw commented 3 years ago

I'm afraid there is no way to reproduce that. Tests run: 181, Failures: 0, Errors: 0, Skipped: 2 For the UCUM tests and the skipped ones do not include UnitFormatTest.testMs2() which tests all 3 variants for "m/s2" and each of them pass. I ran it locally with Java SE 10 (Adopt OpenJDK) because building the artifact won't work for a compiler or Maven plugin issue, but running is no problem and the issue does not show.

selios commented 3 years ago

I'm afraid there is no way to reproduce that. Tests run: 181, Failures: 0, Errors: 0, Skipped: 2 For the UCUM tests and the skipped ones do not include UnitFormatTest.testMs2() which tests all 3 variants for "m/s2" and each of them pass. I ran it locally with Java SE 10 (Adopt OpenJDK) because building the artifact won't work for a compiler or Maven plugin issue, but running is no problem and the issue does not show.

Same result for me : [WARNING] Tests run: 181, Failures: 0, Errors: 0, Skipped: 2 Maybe a dependency problem !

selios commented 3 years ago

Just rebuilding now and it's working !

keilw commented 3 years ago

Did you pull the most recent SNAPSHOT? I still don't know how exactly you could reproduce it, is it a standalone console app, web/enterprise container like Spring Boot or something else? Because the issue should have shown running JUnit all the time, line 295 (thanks for mentioning) was not included in a PR earlier in the JDK9/Jigsaw version of UCUMFormat which needs a special way to load ResourceBundles in a modular app. Maybe it only manifested if you include a module-inf and everything else even up to Java 16 uses the fallback, but that seems to me like a bug in the Java multi-release-jar because I thought that would ALWAYS be used if the JRE is >=9.

selios commented 3 years ago

Run some test and print is good from commit 9223a651948190e77b1e10e560d93a51a39076f5