#11924 closed enhancement (fixed)
Add compatibility with Java 9
Reported by: | Don-vip | Owned by: | team |
---|---|---|---|
Priority: | major | Milestone: | 17.08 |
Component: | Core | Version: | |
Keywords: | java9 jigsaw javabug | Cc: |
Description (last modified by )
Java 9 is well advanced in its development, early builds are now available. Jigsaw project is now merged into main tree.
I have added basic Java 9 support in r8777:8778, r8793, r8795, r8796:8797 but making JOSM work with Jigsaw is another challenge.
This ticket aims to list all problems encountered.
xmltask does not work ==> cannot build OSX package==> fork created- Proguard does not work ==> cannot build optimized jar
Groovy does not work ==> cannot run some tests + cannot build taginfo files==> fixed==> fixedResourceBundle.getBundle("sun.awt.resources.awt")
results in an internal error ==> bug reported to OracleFindbugs does not recognize new version string ==> bug and PR created==> fixedJEP 272 removes==> fixedcom.apple.eawt
package ==> need to updatePlatformHookOsx
javabug:6850612 deprecates==> fixedClass.newInstance
==> replace it byClass.getConstructor().newInstance()
javabug:8154801 deprecates==> fixedjava.util.Observer / java.util.Observable
==> replace it byjavax.swing.ChangeListener
Ant does not work anymore ==> Bug created + workaround done in r10259==> Fixed in Ant 1.9.8 / 1.10.0javabug:8152912 deprecates==> fixedXMLReaderFactory
Groovy bug: https://issues.apache.org/jira/browse/GROOVY-7879==> fixedjavabug:8143077 deprecates==> fixedInputEvent.*_MASK
constants in favor ofInputEvent.*_DOWN_MASK
The workaround to disable "Internal proprietary API" warning does not work anymore==> no way to disable it, but hidden in Jenkins builds
Unit tests:
jacoco has problems with nashorn:==> See #13150 for fixMethod jdk.dynalink.linker.LinkerServices.$jacocoInit()[Z must be InterfaceMethodref constant
logEqualsVerifier bugs: https://github.com/jqno/equalsverifier/issues/152 + https://github.com/jqno/equalsverifier/issues/169==> fixedProjections off by the last digit.==> fixed (see #11889, #13387)
Plugins:
Geotools does not work ==> https://osgeo-org.atlassian.net/browse/GEOT-5289==> forked
See #15560 for Java 10 compatibility.
Attachments (0)
Change History (159)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Description: | modified (diff) |
---|
comment:3 by , 9 years ago
Description: | modified (diff) |
---|
comment:4 by , 9 years ago
Description: | modified (diff) |
---|
comment:5 by , 9 years ago
Description: | modified (diff) |
---|
comment:8 by , 9 years ago
Description: | modified (diff) |
---|
comment:10 by , 9 years ago
All plugins load fine with Java 9 except ImportImagePlugin
, which relies on geotools
:
23:45:31.948 [main] FATAL org.openstreetmap.josm.plugins.ImportImagePlugin.ImportImagePlugin - Error while loading plugin java.lang.IllegalArgumentException: org.opengis.referencing.datum.DatumFactory is not an ImageIO SPI class at javax.imageio.spi.ServiceRegistry.checkClassAllowed(ServiceRegistry.java:733) ~[?:?] at javax.imageio.spi.ServiceRegistry.<init>(ServiceRegistry.java:138) ~[?:?] at org.geotools.factory.FactoryRegistry.<init>(FactoryRegistry.java:155) ~[geotools.jar:?] at org.geotools.factory.FactoryRegistry.<init>(FactoryRegistry.java:146) ~[geotools.jar:?] at org.geotools.factory.FactoryCreator.<init>(FactoryCreator.java:82) ~[geotools.jar:?] at org.geotools.referencing.ReferencingFactoryFinder.getServiceRegistry(ReferencingFactoryFinder.java:115) ~[geotools.jar:?] at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:180) ~[geotools.jar:?] at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:455) ~[geotools.jar:?] at org.geotools.referencing.DefaultAuthorityFactory.getSupportedCodes(DefaultAuthorityFactory.java:125) ~[geotools.jar:?] at org.geotools.referencing.CRS.getSupportedCodes(CRS.java:396) ~[geotools.jar:?] at org.openstreetmap.josm.plugins.ImportImagePlugin.PluginOperations.loadCRSData(PluginOperations.java:366) ~[ImportImagePlugin.jar:?] at org.openstreetmap.josm.plugins.ImportImagePlugin.ImportImagePlugin.<init>(ImportImagePlugin.java:88) [ImportImagePlugin.jar:?]
I have no idea what's the problem yet. Maybe linked to JEP 262.
comment:11 by , 9 years ago
Found it, it's a change of behaviour from javabug:8068749:
Java SE has been changed so that
javax.imageio.spi.ServiceRegistry
no longer allows service providers of other than Image I/O service types to be loaded. This is a behavioral change. Existing application binaries that attempt to useServiceRegistry
for non-Image-I/O services will causeIllegalArgumentException
to be thrown at runtime. Such applications should be migrated to usejava.util.ServiceLoader
instead ofjavax.imageio.spi.ServiceRegistry
.
comment:12 by , 9 years ago
Bug reported to GeoTools: https://osgeo-org.atlassian.net/browse/GEOT-5289
comment:15 by , 9 years ago
- Groovy does not work ==> cannot run some tests + cannot build taginfo files
As far as I could see, this problem is fixed in Groovy v2.4.6.
comment:16 by , 9 years ago
ResourceBundle.getBundle("sun.awt.resources.awt")
results in an internal error ==> bug reported to Oracle
Also this problem seems to be fixed since 2015-11-10 (see https://bugs.openjdk.java.net/browse/JDK-8136804)
comment:17 by , 9 years ago
Yes, The Oracle bug is fixed in latest JDK9/Jigsaw builds. However Groovy 2.4.6 is not released yet.
comment:19 by , 9 years ago
Description: | modified (diff) |
---|
comment:26 by , 9 years ago
Description: | modified (diff) |
---|---|
Summary: | Add compatibility with Java 9 / Jigsaw → Add compatibility with Java 9 |
comment:38 by , 9 years ago
Description: | modified (diff) |
---|
comment:40 by , 9 years ago
Description: | modified (diff) |
---|
comment:41 by , 9 years ago
Description: | modified (diff) |
---|
comment:42 by , 9 years ago
Description: | modified (diff) |
---|
comment:44 by , 9 years ago
Description: | modified (diff) |
---|
comment:47 by , 9 years ago
Description: | modified (diff) |
---|
comment:48 by , 9 years ago
Description: | modified (diff) |
---|
comment:54 by , 9 years ago
Description: | modified (diff) |
---|
comment:64 by , 9 years ago
Core works relatively fine with Java 9. I have started to look at plugins, as expected they don't even compile. First error lies in Apache Commons code: https://issues.apache.org/jira/browse/COLLECTIONS-593
comment:65 by , 9 years ago
Description: | modified (diff) |
---|
comment:66 by , 9 years ago
Description: | modified (diff) |
---|
comment:67 by , 9 years ago
Description: | modified (diff) |
---|
I found some more problems in the unit tests.
comment:68 by , 9 years ago
Description: | modified (diff) |
---|
comment:72 by , 9 years ago
Description: | modified (diff) |
---|
comment:75 by , 8 years ago
Description: | modified (diff) |
---|
comment:76 by , 8 years ago
Description: | modified (diff) |
---|
comment:80 by , 8 years ago
Description: | modified (diff) |
---|
comment:84 by , 8 years ago
Description: | modified (diff) |
---|
comment:85 by , 8 years ago
Priority: | normal → major |
---|
comment:87 by , 8 years ago
Milestone: | → 17.07 |
---|
comment:88 by , 8 years ago
Description: | modified (diff) |
---|
comment:103 by , 8 years ago
Replying to Don-vip:
In 12234/josm:
Are you sure this is not required any more? I added a ListenableWeakReference
some days ago. It runs a Runnable
as after the Object was destroyed. This can replace finalize() mechanism. But you need to take care to hold the reference to that reference.
Btw: I don't like the lifecycle of that class. It's just bad to have to keep a reference to ensure that it works. What do you think about removing it and instead extending JPopupMenu
to be a ScrollablePopupMenu
.
comment:104 by , 8 years ago
I couldn't trigger a call to the method. I assume the objects of this class are only finalized when we close JOSM, so the finalize method was not useful.
I agree this class could disappear.
comment:111 by , 8 years ago
Description: | modified (diff) |
---|
comment:112 by , 8 years ago
Description: | modified (diff) |
---|
comment:113 by , 8 years ago
Description: | modified (diff) |
---|
comment:115 by , 8 years ago
Description: | modified (diff) |
---|
comment:116 by , 8 years ago
Nicolai Parlog started a nice project: http://java9.wtf/ We could share our issues there.
comment:121 by , 8 years ago
ASM 6.0 beta has finally been released. This was the root cause of our remaining failed unit tests. Now Maven team will be able to update their plugins depending on it (shade for example) and equalsverifier will use these new plugins.
follow-up: 127 comment:124 by , 8 years ago
Replying to Don-vip:
In 12517/josm:
You can use the ListenerList
class for managing lists of listeners. It provides:
- Optional weak listeners
- The ability to warn or throw an exception for duplicate listeners
- An easy fire method
comment:125 by , 8 years ago
Description: | modified (diff) |
---|
comment:127 by , 8 years ago
Replying to michael2402:
You can use the
ListenerList
class for managing lists of listeners.
Yep, thanks! :)
comment:135 by , 8 years ago
Description: | modified (diff) |
---|
comment:136 by , 8 years ago
Milestone: | 17.07 → 17.08 |
---|
ASM team has trouble to publish to Maven central as they changed their infrastructure, it's unlikely to see Maven plugins and equalsverifier updates before next month.
Java 9 will be released in September.
follow-up: 139 comment:137 by , 8 years ago
comment:139 by , 8 years ago
Replying to Don-vip:
Interesting performance improvements in Java 9, see
StyledMapRendererPerformanceTest/testCitySmall
duration:
This test wasn't drawing anything at the time. Still interesting, to see how long it takes to do nothing, and how much better Java 9 is at this.
In "real world" setups, I couldn't see any significant improvement so far.
comment:140 by , 8 years ago
OK thanks :) Indeed it was very strange!
Concerning ASM, they finally managed to push their update to Maven Central, hopefully Maven plugins should be updated faster.
comment:142 by , 7 years ago
Description: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
And this is now fixed, the Java 9 build is finally stable \o/
comment:157 by , 7 years ago
Description: | modified (diff) |
---|
In 8816/josm: