Closed ejgumbel closed 6 years ago
There could be a mix between APIs. JSR363Demo is certainly not correct if you have modules that extend javax.measure.Prefix
(a JSR 385 type)
Changing the imports from javax.measure.MetricPrefix. as it is in the original demos, to use tec.units.indriya.unit.MetricPrefix. does handle the problem.
Because in some of the demos as mentioned there was a mix of API versions. I adjusted the dependency versions in https://github.com/unitsofmeasurement/uom-demos/tree/1.0. That should match the mentioned change and this branch contains demos for JSR 363 while master gradually changes towards 385 only. As of now there are still a few "java8" modules, but at least with the 2.0 versions of SI and the Systems modules, we are likely to phase out uom-se as basis for them.
Greetings, Executing demos in the systems.common package that contain metric prefixes, e.g. KILO, produce AbstractMethodErrors, but other prefixes, e.g. IndianPrefix.LAKH do not.
Executing CommonPrefixDemo produces the following result at the terminal: 10 m*100000.0 Exception in thread "main" java.lang.AbstractMethodError: tec.units.indriya.unit.TransformedUnit.prefix(Ljavax/measure/Prefix;)Ljavax/measure/Unit; at javax.measure.MetricPrefix.KILO(MetricPrefix.java:213) at tech.uom.demo.systems.common.CommonPrefixDemo.main(CommonPrefixDemo.java:22)
Executing JSR363Demo produces: Exception in thread "main" java.lang.AbstractMethodError: tec.units.indriya.unit.BaseUnit.prefix(Ljavax/measure/Prefix;)Ljavax/measure/Unit; at javax.measure.MetricPrefix.KILO(MetricPrefix.java:213) at tech.uom.demo.systems.common.JSR363Demo.main(JSR363Demo.java:40)
Executing ThePerfectStorm produces: Exception in thread "main" Saffir–Simpson hurricane wind scale [category=TROPICAL_DEPRESSION, minimum=null, maximum=38 mph] Saffir–Simpson hurricane wind scale [category=TROPICAL_STORM, minimum=39 mph, maximum=73 mph] Saffir–Simpson hurricane wind scale [category=ONE, minimum=74 mph, maximum=95 mph] java.lang.AbstractMethodError: tec.units.indriya.unit.BaseUnit.prefix(Ljavax/measure/Prefix;)Ljavax/measure/Unit; Saffir–Simpson hurricane wind scale [category=TWO, minimum=96 mph, maximum=110 mph] at javax.measure.MetricPrefix.KILO(MetricPrefix.java:213) Saffir–Simpson hurricane wind scale [category=THREE, minimum=111 mph, maximum=129 mph] at tech.uom.demo.systems.common.ThePerfectStorm.main(ThePerfectStorm.java:130) Saffir–Simpson hurricane wind scale [category=FOUR, minimum=130 mph, maximum=156 mph] Saffir–Simpson hurricane wind scale [category=FIVE, minimum=157 mph, maximum=null] 61.15502307598153 km/h (TROPICAL_DEPRESSION)