Units with higher powers in denominator cannot be formatted with UCUM formatter with JDK 10 or higher
selios opened this issue · 8 comments
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"
Could you try the same with 2.1-SNAPSHOT?
There is no build for Java 10 or 11, see unitsofmeasurement/uom-lib#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.
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.
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.
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 includeUnitFormatTest.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 !
Just rebuilding now and it's working !
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.