Just trying to run some simple script in a maven build. Not sure what triggered VMPlugin loading but code doesnt handle j9 it seems.
My version is the last alpha of v3. Can try to reproduce it tomorrow if it helps. Le lun. 10 sept. 2018 23:17, Paul King <[email protected]> a écrit : > Can you elaborate a bit more on the steps to get the error you are seeing? > We've mainly been using gradle on JDK11. > > On Tue, Sep 11, 2018 at 6:05 AM Romain Manni-Bucau <[email protected]> > wrote: > >> Hi guys, >> >> I'm using gplus maven plugin and I get issues running on java 9: >> >> Seems it leads to [1] which does not work on java > 8. A simple >> workaround can be to use privateLookupIn on java 9 (it is not available on >> java 8): >> >> static { >> Constructor<MethodHandles.Lookup> lookup = null; >> Method privateLookup = null; >> try { // java 9 >> privateLookup = MethodHandles.class.getMethod("privateLookupIn", >> Class.class, MethodHandles.Lookup.class); >> } catch (final NoSuchMethodException e) { // java 8 >> try { >> lookup = >> MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Integer.TYPE); >> if (!lookup.isAccessible()) { >> lookup.setAccessible(true); >> } >> } catch (final NoSuchMethodException ex) { >> throw new IllegalStateException("Incompatible JVM", e); >> } >> } >> PRIVATE_LOOKUP = privateLookup; >> LOOKUP = lookup; >> } >> >> public static MethodHandles.Lookup of(final Class<?> declaringClass) { >> try { >> if (PRIVATE_LOOKUP != null) { >> return MethodHandles.Lookup.class >> .cast(PRIVATE_LOOKUP.invoke(null, declaringClass, >> MethodHandles.lookup())); >> } >> return LOOKUP.newInstance(declaringClass, >> MethodHandles.Lookup.PRIVATE).in(declaringClass); >> } catch (final IllegalAccessException | InstantiationException e) { >> throw new IllegalArgumentException(e); >> } catch (final InvocationTargetException e) { >> throw toRuntimeException(e); >> } >> } >> >> >> >> Any plan to release a j9/10/11 groovy version? >> >> [1] >> https://github.com/apache/groovy/blob/ac0e1d232f0612518a87ce2aa5e443e0975cb3f4/src/main/java/org/codehaus/groovy/vmplugin/v7/Java7.java#L40 >> >> Romain Manni-Bucau >> @rmannibucau <https://twitter.com/rmannibucau> | Blog >> <https://rmannibucau.metawerx.net/> | Old Blog >> <http://rmannibucau.wordpress.com> | Github >> <https://github.com/rmannibucau> | LinkedIn >> <https://www.linkedin.com/in/rmannibucau> | Book >> <https://www.packtpub.com/application-development/java-ee-8-high-performance> >> >
