lombok-intellij-plugin
lombok-intellij-plugin copied to clipboard
Using val, IDEA breaks and ‘declares final’ any variables
Short description
When using val
, IDEA breaks and starts to declare any new variable introduced via postfix-es as ‘final’, no matter whether it comes from lombok or are standard Java variable declarations. Neither val
should have choice to ‘Declare [it] final’, because it already does it.
Expected behavior
Either IDEA or plugin must respect the project / IDE settings regarding code generation, as well as user's choice to disable final (when user ticks/unticks the ‘Declare final’ in popup). Neither usage of val
should break standard IDEA postfix for variables (which respects settings above).
Version information
- IDEA Version: IDEA 2020.3.2
- JDK Version: AdoptOpenJDK 1.8.0_282
- OS Type & Version: Windows 10 20H2
- Lombok Plugin Version: 203.7148.57
- Lombok Dependency Version: 1.18.18
Steps to reproduce
- Have any non-void contents
- Introduce a new variable using
.var
postfix, notice that IDEA respects settings - Undo and introduce a new variable using
.val
postfix, IDEA declares it final by default. - Undo and introduce a new variable using
.varl
postfix, result is same as in step 2. - Undo and introduce a new variable using
.var
postfix again, result is same as in step 2. - Restart IDEA and try step 1 again, IDEA respects settings until you use lombok-related postfix.
Sample project
- [x] Sample project provided
- [x] I am able to reproduce this error on the sample project by following the steps described above
Additional information
Additional extensions installed: Rider UI Theme Pack, com.intellij.plugins.vscodekeymap, com.wakatime.intellij.plugin, google-java-format, indent-rainbow.indent-rainbow, com.codota.csp.intellij, com.dubreuia, org.sonarlint.idea, com.demonwav.minecraft-dev
Stacktrace
Not applicable.
+1
Same problem. "someExpression.val (tab)" -> "final val [cursor] = someExpression" The "final" should not be there.
Until version 2024.1.1, the same problem still exists.... :(