[ BUILD # : 201310012201 ]
[ JDK VERSION : 1.7.0_40 ]
When using Lombok in a project, most refactoring operations are broken
(generate invalid code). I can enumerate some as: Copy a class file, create a
constructor, create a setter etc. I will attach a project with this issue. I
consider it a P1 because it creates code that is note compilable, but I am not
sure if it is a NB or Lombok fault.
Created attachment 140891 [details]
1. Open the Bean class
2. Try to add a constructor using Alt + Insert.
Result: The constructor will be generated but the final bracket will be lost.
I have tested it at 7.3.1, and it does not work either with the latest edge Lombok build (which supports Java 8). If I use NB 7.3.1 with latest Lombok stable build, it works as expected. So I suspect something that NB expects are not correctly informed by Lombok or Java 8 APT.
I will decrease the priority to P2, because we need to understand if it is a NB, JavaC or Lombok issue. Jirka asked me to add JDK8 keyword too, so I did it too.
I hope to hear from you soon. Thanks in advance :)
Created attachment 140898 [details]
I am attaching the log file from 7.3.1. I have a similar log message for 7.4, but due to issue 236831 the 7.4 log are far verbose, so I choose to attache the 7.3.1 one. Looks like the source is invalid somehow.
I was wondering if _maybe_ it has something related to issue #232284. Looks like there is something "wrong" with the source file in some point of the processing.
Lombok has just released version 1.2.12 which will make this issue even more visible now. It happen in NetBeans 7.3.1 too.
I have escalated this issue to Lomboko guys too . Since now they have a new stable version, they will probably heard a lot about it soon. Have anyone from NB team analysed it already? Please, let me know when you have any results.
Please see evaluation in issue #237156; the root cause is the same. The source tree contains synthetic items generated by Lombok, anchored in the source, but not marked as synthetic in any way. The patch/diff code that computes necessary changes to the source text gets confused by such information.
The issue will be hardly fixed on NetBeans side, except if a concept adopted by both NetBeans code and Lombok is defined. I expect Lombok people to provide appropriate support on NetBeans' side (if needed, after the generated content is somehow distinguishable from physical content) - Lombok project declares to support NB.
From the point of view of base Java development features covered by (and missing! in) NetBeans, the focus to support specifically Lombok should be marginal, IMHO.
Patches are warmly welcomed.
If Lombok guys mark the generated code with SYNTHETIC or GENERATEDCONSTR, will it be ignored by Navigator, Find Usages and other tools?
*** Bug 240977 has been marked as a duplicate of this bug. ***
*** Bug 242920 has been marked as a duplicate of this bug. ***
*** Bug 242240 has been marked as a duplicate of this bug. ***
*** Bug 242422 has been marked as a duplicate of this bug. ***
*** Bug 236830 has been marked as a duplicate of this bug. ***