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

Compilation error of @SneakyThrows for generic exceptions in JDK 10 #1693

Closed
kgeorgiy opened this Issue May 15, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@kgeorgiy

kgeorgiy commented May 15, 2018

The following code causes SneakyThrowsRemover to fail with

Error during the transformation of 'RunnableE'; post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException`

@FunctionalInterface
public interface RunnableE<E extends Exception> {
    void run() throws E;

    @lombok.SneakyThrows static <E extends Exception> void sneaky(final RunnableE<E> runnable) {
        runnable.run();
    }
}

This behavior reproduces on both Oracle and Open JDK 10.0.1.

The root cause of this IllegalArgumentException is org.objectweb.asm.ClassReader:

java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.(ClassReader.java:160)
at org.objectweb.asm.ClassReader.(ClassReader.java:143)
at lombok.bytecode.AsmUtil.fixJSRInlining(AsmUtil.java:37)
at lombok.bytecode.SneakyThrowsRemover.applyTransformations(SneakyThrowsRemover.java:47)
at lombok.core.PostCompiler.applyTransformations(PostCompiler.java:43)
at lombok.core.PostCompiler$1.close(PostCompiler.java:74)
...

The provider of ClassReader is lombok.patcher that bundles version 6.0 of org.ow2.asm. Version 6.1 of org.ow2.asm fixed this error.

Proposed fix: Upgrade ASM to version 6.1 in lombok.patcher, and, in turn, upgrade dependency of Lombok itself to the new version of lombok.patcher.

@victorwss

This comment has been minimized.

Contributor

victorwss commented May 15, 2018

Better update to 6.1.1.

6.1.1 was a fix to address some bug on 6.1 in Java 10. See this.

@iherasymenko

This comment has been minimized.

iherasymenko commented May 19, 2018

Better wait for 6.2. They gonna address the Java 11 support as well.

https://gitlab.ow2.org/asm/asm/issues/317830

@rspilker

This comment has been minimized.

Collaborator

rspilker commented May 28, 2018

Working on it right now.

@rspilker rspilker closed this May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment