-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Remove Invoke Dynamic Call #631
base: GROOVY_2_4_X
Are you sure you want to change the base?
Android: Remove Invoke Dynamic Call #631
Conversation
Uses jarjar to remove org.codehaus.groovy.vmplugin.v7.IndyInterface which has a invoke dynamic call. This call causes android compilation to fail when targeting sdk level 26 or above but the minSdk is less than 26. Fixes: GROOVY-8366
@@ -247,6 +247,7 @@ allprojects { | |||
if (isRootProject) { | |||
zipfileset(src: rootProject.configurations.runtime.files.find { it.name.startsWith('openbeans') }, excludes: 'META-INF/*') | |||
} | |||
zap pattern: 'org.codehaus.groovy.vmplugin.v7.IndyInterface' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally the Groovy version, that does not use indy, means indy is not used for Groovy itself, but the user can still use it. You pullrequest will mean that this is no longer possible. You have to at least also add the Java7 class, or else there will be class loading trouble. And the instantiation of that class would have to change. A bigger problem are the classes from org.codehaus.groovy.classgen.asm.indy, which do reference this class as well. Without further steps the groovy runtime and the compiler would get into trouble on a Java7 JVM or higher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about having two android jars one without classes that use invoke dynamic and one with them still?
It looks like Android will be supporting it on ap's 26+. The issue is that Google added a check for classes using the invoke-polymorphic. Little more info here. https://issuetracker.google.com/issues/37567710
I am able to use proguard to remove the classes that cause the failure, but it increases build times greatly.
Hi, Is there anything new to the matter ? Is there anything we can do to help ? |
This is actually a big problem. For Groovy on the JVM there is no other way, than to more and more depend on invokedynamic. I think the suggestion of an Android version of Groovy is the best. But I wonder if that is really more than - I am not into Android development, so be patient with my ignorance - using for example D8 to ensure a certain API level compatibility. |
Thanks for the input.
So yeah I guess D8 won't help, you're probably right on the best option suggestion. |
It could be as easy as using retrolambda to transform the Groovy library. Then, as long as you use pre Groovy 3 it should work - maybe even for classes generated with Groovy 3. For later versions you may have to transform the classes outputted by Groovy. But I strongly assume you are not trying to run scripts anyway. |
Uses jarjar to remove org.codehaus.groovy.vmplugin.v7.IndyInterface
which has a invoke dynamic call. This call causes android compilation
to fail when targeting sdk level 26 or above but the minSdk is less
than 26.
Fixes: GROOVY-8366