coli-saar/alto

Reflection issues with Java 9

akoehn opened this issue · 7 comments

Original report by Alexander Koller (Bitbucket: akoller, GitHub: alexanderkoller).


Currently, Alto does not work with Java 9 because of the following reflection-related problems:

  • org.simplericity.macify triggers an error "Illegal reflective access by org.simplericity.macify.eawt.DefaultApplication (file:/private/tmp/alto/target/alto-2.2-SNAPSHOT-jar-with-dependencies.jar) to method com.apple.eawt.Application.getApplication()". There does not seem to be a more recent version of macify that fixes this.
  • Alto Lab doesn't find static methods in Program#getAllAnnotatedStaticMethods, probably because no classes are found in Program#getAllClassesIn_irtg_Classpath (but this needs to be double-checked).

Ideas for fixing these issues:

  • Replace macify with something that does the same thing, but works with Java 9.
  • Replace Alto Lab's class-finding mechanism with a class-finding mechanism like in InputCodec and OutputCodec, where the classes that can be used from Alto Lab tasks must be explicitly declared in a file.

Original changes by Alexander Koller (Bitbucket: akoller, GitHub: alexanderkoller).


changed content from "Currently, Alto does not work with Java 9 because of the following reflection-related problems:

  • org.simplericity.macify triggers an error "Illegal reflective access by org.simplericity.macify.eawt.DefaultApplication (file:/private/tmp/alto/target/al" to "Currently, Alto does not work with Java 9 because of the following reflection-related problems:

  • org.simplericity.macify triggers an error "Illegal reflective access by org.simplericity.macify.eawt.DefaultApplication (file:/private/tmp/alto/target/al"

macify can be removed (just tested it), don't know how import it is to have on macs.

@alexanderkoller, could you give me an example of the other error? As far as I can see, everything works as expected. The plugins to read irtgs etc. seem to be recognized just fine.

I have pushed a branch in which macify is removed.

Hm. I just tried an older version (changeset 1920, from March 2018) on OpenJDK 12 on MacOS, and I don't get the "reflective access" message any more. The algebras and codecs all seem to be there. I do get a weird bug with the Window menu (see screenshot below). To reproduce, do File -> Open, then cancel. This adds a Window menu. Does this also happen on other OSes?

Screen Shot 2019-04-03 at 18 41 32

The macify is important to move the menu bar to the top of the screen (where it belongs on MacOS) and change the hotkeys to Cmd-O and such. I will have a look at your branch.

I have tested the un-macify version, and it seems to display fine on MacOS using both Java 8 and Java 12. As far as I'm concerned, we can switch to the code version in un-macify.

The "Window" bug I mentioned above occurs only on Java 12. I will move it into a separate issue.

Ok, in that case, I will merge that commit to master. The Alto GUI does not work without it on JRE11 on Debian (haven't tested other non-Mac OSes).

As far as I can tell, the GUI works perfectly on MacOS right now with Java 12 (except for the more specific bug in #42). Can I close this issue?