JOSM / areaselector

JOSM Area Selection Plugin
https://github.com/JOSM/JOSM-areaselector/wiki
18 stars 3 forks source link

Areaselector does not work with OpenJDK 11 #43

Closed r00tat closed 2 years ago

r00tat commented 3 years ago

It seems like there is an issue with OpenJDK 11 and possibly also earlier versions:

 [java] 2021-07-04 00:01:06.607 SEVERE: Handled by bug report queue: java.lang.IllegalAccessError: class boofcv.io.image.ConvertBufferedImage (in unnamed module @0x55d95bcf) cannot access class sun.awt.image.ByteInterleavedRaster (in module java.desktop) because module java.desktop does not export sun.awt.image to unnamed module @0x55d95bcf
        [java] java.lang.IllegalAccessError: class boofcv.io.image.ConvertBufferedImage (in unnamed module @0x55d95bcf) cannot access class sun.awt.image.ByteInterleavedRaster (in module java.desktop) because module java.desktop does not export sun.awt.image to unnamed module @0x55d95bcf2021-07-04 00:01:06,544 [AWT-EventQueue-0] INFO : mouse clicked java.awt.event.MouseEvent[MOUSE_CLICKED,(660,397),absolute(702,483),button=1,modifiers=Button1,clickCount=1] on org.openstreetmap.josm.gui.MapView[,0,0,1016x783,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=java.awt.Dimension[width=10,height=0],preferredSize=]
        [java]  at boofcv.io.image.ConvertBufferedImage.convertFrom(ConvertBufferedImage.java:319)
        [java]  at org.openstreetmap.josm.plugins.areaselector.ImageAnalyzer.detectCannyArea(ImageAnalyzer.java:691)
        [java] 2021-07-04 00:01:06.618 INFO: Update plugins - <html>An unexpected exception occurred that may have come from the 'areaselector' plugin.<br>According to the information within the plugin, the author is Paul Woelfel, Thomas Konrad.<br>Try updating to the newest version of this plugin before reporting a bug.</html>   at org.openstreetmap.josm.plugins.areaselector.ImageAnalyzer.getArea(ImageAnalyzer.java:152)
        [java]  at org.openstreetmap.josm.plugins.areaselector.AreaSelectorAction.createArea(AreaSelectorAction.java:219)
        [java]  at org.openstreetmap.josm.plugins.areaselector.AreaSelectorAction$1.run(AreaSelectorAction.java:172)
        [java]  at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
        [java]  at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
        [java]  at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        [java]  at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        [java]  at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        [java]  at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        [java]  at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
        [java]  at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        [java]  at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        [java]  at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        [java]  at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        [java]  at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        [java]  at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
r00tat commented 3 years ago

There is a new boofcv version, which seems to fix the bug. Problem here: Visualization is not included any more.

<dependency>
  <groupId>org.boofcv</groupId>
  <artifactId>boofcv-core</artifactId>
  <version>0.37</version>
</dependency>
NLthijs48 commented 3 years ago

There is a workaround for this issue, adding --add-exports=java.desktop/sun.awt.image=ALL-UNNAMED to the java command that starts JOSM, just like the josm.jnlp web start file also does with a couple of other packages. I'm currently using this workaround and running JSOM with Java 16 with Areaselector succesfully.

This is definitely not user-friendly though, so indeed updating boofcv is the proper solution.

le-jun commented 2 years ago

Currently running openJDK 17 and I confirm the issue. Could someone elaborate on the mentioned workarounds so that I can make it work?

tsmock commented 2 years ago

There is a new boofcv version, which seems to fix the bug. Problem here: Visualization is not included any more.

@r00tat Just a heads up: visualization -> swing.

EDIT: https://github.com/lessthanoptimal/BoofCV/blob/v0.39/change.txt#L835 for the hint. It appears that they later dropped the visualization prefix.