Skip to content
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

Remove LambdaForm$Hidden annotation from emitted code #118

Merged

Conversation

Yarikx
Copy link
Contributor

@Yarikx Yarikx commented Nov 30, 2016

This annotation annotates some lambda methods.
It is not preserved in runtime, so it compiles fine, but create some issues for proguard.

This annotation does not exist in JDK6/7 so can be completely removed.

Related issues:
evant/gradle-retrolambda#55
AntennaPod/AntennaPod#1117
yongjhih/RxBolts#3

@simophin
Copy link

simophin commented Dec 6, 2016

We encountered java.lang.ClassNotFoundException: java.lang.invoke.LambdaForm$Hidden on Android 4.1 when Method.isAnnotationPresent is called on a lambda method. Looks like the virtual machine is trying to load this annotation class and fails.

@Yarikx
Copy link
Contributor Author

Yarikx commented Dec 6, 2016

@simophin With or without this fix?

@simophin
Copy link

simophin commented Dec 6, 2016

@Yarikx I believe your PR will fix this issue. Haven't tried tho, waiting to be merged. In the mean time we just replace the lambdas with anonymous classes.

@Yarikx
Copy link
Contributor Author

Yarikx commented Dec 6, 2016

@simophin Looking at another PRs are not merged yet, I don't think it will be merged soon.

@LachlanMcKee
Copy link

@Yarikx, @simophin I have also run into this issue on Android 4.1 and 4.2. Your PR worked wonderfully!

For anyone else who runs into this issue, as this has yet to be merged, I suggest building your own JAR using this branch. I compiled the JAR using the docker container without any issues (follow the instructions here).

If you are using the Retrolambda Gradle plugin, follow the instructions found here to use the local JAR instead.

@luontola luontola merged commit 14da099 into luontola:master Jan 10, 2017
@luontola
Copy link
Owner

Thanks.

I changed the code to only search for the LambdaForm$Hidden annotation inside the generated lambda classes instead of all classes. I'm assuming that the annotation doesn't appear anywhere else.

@luontola
Copy link
Owner

This has been included in Retrolambda 2.4.0. Sorry about taking so long to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants