-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Split lombok.jar into smaller JARs #1611
Comments
And oh, just forgot to tell, the delombok tool would also probably land in another jar. |
What is the current status of this issue? |
Just to be clear, Gradle 5.0 will keep working, it'll just ignore that jar on your compile classpath going forward. But still, putting a processor on your app's classpath makes no sense, it just unnecessarily increases the size of your application. Most other processors properly separate into api and processor jar. |
No, lombok shall not separate into smaller jars. There's a convenience in being a single jar that we don't just want to throw away for mostly silly reasons. Let's go through them:
This is opinionated aggressive behaviour from gradle. I disagree with the opinion gradle is espousing here; you should file a bug vs. gradle to warn them they really shouldn't do that in 5.0. Putting jars-containing-annotation-processors on the classpath when compiling is just not an issue. Sure, putting them on the cp at runtime is definitely highly suspect, but lombok does not need to be on the classpath at runtime. The solution is to simply... not do that (the 'provided' status of a dependency is how you specify that lombok should be on the cp when compiling, but not when deploying/shading/running/shipping/etc). It feels a bit odd to ask us to bend over backwards to accomodate gradle's crazy opinions. I'm tempted to not do it; this is gradle's problem, not ours. NB: If gradle wants to aggressively ignore/error/warn with scenarios where lombok.jar is on the runtime classpath, more power to em. I share the opinion that this just cannot be right. On the compiler path though - nope. No reason for that.
NB: You can get a jar that is just lombok's annotations and nothing else via |
NB: I filed a bug over at the gradle project: gradle/gradle#5056 |
I am aware that lombok is a compiler plugin, so it should not be placed as part of the runtime classpath of applications. This means that there are not very much reasons to split it into several JARs. However we have a few:
Gradle 5.0 will likely get trouble on that. Currently on gradle 4.6, running a
gradle build
produces the following warning:Running it with
gradle --warning-mode=all build
will produce:However since we have a sole lombok.jar file which contains both the annotations and the annotation processor, there is no simple way to separate those things. A straightforward solution would be to add an hypothetical lombok-annotations.jar to the compile classpath and an hypothetical lombok-processor.jar to the processor path.
Other projects uses lombok as a dependency, I am aware at least of bytebuddy, but there could be a few more. Depending in lombok is troublesome because this grabs the annotations, the processor, the launcher, the hacks for javac, the hacks for eclipsec and possibly much more things I'm not aware when just a subset of those matters for them.
Due to all that module-craziness that Java 9 added with all those illegal reflective access warnings, managing the dependencies correctly without breaking lombok into smaller parts becames something very hard to do. Breaking lombok into smaller parts simplify that task.
What I suggest could be at least those:
For those who prefer the old way for some reason, a fat everything-inside lombok.jar would continue to be provided. If somebody would need to add something from lombok into the runtime classpath/modulepath for whichever reason, it would also become very clear of what are being added there.
The text was updated successfully, but these errors were encountered: