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

@SneakyThrows requires lombok.jar at runtime #708

Closed
lombokissues opened this issue Jul 14, 2015 · 5 comments
Closed

@SneakyThrows requires lombok.jar at runtime #708

lombokissues opened this issue Jul 14, 2015 · 5 comments

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 673)

@lombokissues
Copy link
Author

👤 a.gliznetsov   🕗 Apr 24, 2014 at 14:20 UTC

Lombok 1.12.16
Java 1.8.0

Compile and run this class:

import lombok.SneakyThrows;

public class Starter {
public static void main(String[] args) {
new Starter().test();
}

@ SneakyThrows
private void test() {
    throw new Exception("checked");
}

}

Result:

Exception in thread "main" java.lang.NoClassDefFoundError: lombok/Lombok
at Starter.test(Starter.java:8)
at Starter.main(Starter.java:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: lombok.Lombok
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more

@lombokissues
Copy link
Author

👤 a.gliznetsov   🕗 May 02, 2014 at 06:53 UTC

The problem is only reproducible if you run the code from IntelliJ.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 May 20, 2014 at 23:22 UTC

The cause is that an exception occurred during transformation, leaving the call the Lombok.sneayThrows in the code. This should be fixed already in the edge release: https://projectlombok.org/download-edge.html

@lombokissues
Copy link
Author

👤 r.spilker   🕗 May 20, 2014 at 23:22 UTC

Duplicate of issue #690

@lombokissues
Copy link
Author

End of migration

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

No branches or pull requests

1 participant