-
-
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
[BUG] val keyword delombok result breaks with Java 7 compatibility #3025
Comments
This issue is now more than 3 months old, and I've been holding off on upgrading the Will this be resolved? |
I think setting the source version never worked like this for delombok. It does not use the normal compilation, it starts its own compiler task and only pass a subset of compiler flags. Unfortunately there is no way to set the compiler version at the moment. A normal compilation and lombok tests work as expected. |
I don't really see what we can meaningfully look at. Perhaps the version of the java runtime that delombok is running on top of, but that's merely a pretty good guess, not a surefire thing - perhaps a decent default, but it needs a setting even then. It also doesn't feel like a formatting option ( Perhaps delombok should gain a |
We already have parameters for some compiler arguments, how do we decide which one will be added as @awhitford Class<?> contextClass = Class.forName("com.sun.tools.javac.util.Context");
Field contextField = delombokClass.getDeclaredField("context");
contextField.setAccessible(true);
Object context = contextField.get(this.delombokInstance);
Class<?> optionsClass = Class.forName("com.sun.tools.javac.util.Options");
Method optionsInstance = optionsClass.getDeclaredMethod("instance", contextClass);
Object options = optionsInstance.invoke(null, context);
Method optionsPut = optionsClass.getDeclaredMethod("put", String.class, String.class);
optionsPut.invoke(options, "-source", "1.6"); |
This code after delombok builds fine with 1.18.20, but breaks with 1.18.22:
I have source & target set to 1.7 for the compiler plugin, but my Javac is 17. The delombok code looks like:
The error is:
Previously the output would be:
Based on the change log, I thought that the
val
conversion tofinal var
was limited to when the compiler source option is 10 or higher.Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: