False positives problems (when using Lombok)
See original GitHub issueWhen using this plugin with a lombok-project the plugin determines many problems (e. g. for missing getters and setters) that disappear when the corresponding file is opened.
Environment
- Operating System: macOS
- JDK version: 1.8.0_102
- Visual Studio Code version: 1.20.1
- Java extension version: 0.20.0
Steps To Reproduce
- Configure lombok support for this plugin, as described here
- Open a project that uses lombok annotations like @Getter or @Data
Sample Project
Unfortunately, I cannot submit the affected project. The important bits are:
<!-- pom.xml -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
// License.java
@Data
public class License {
private String serial;
}
Java Language Server log
!SESSION 2018-03-06 07:59:11.945 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_102
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Command-line arguments: -data /Users/oliverherrmann/Library/Application Support/Code/User/workspaceStorage/d8ec444f7205bbe5fb9c8b70109bb494/redhat.java/jdt_ws
!ENTRY org.eclipse.jdt.ls.core 1 0 2018-03-06 07:59:14.658
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started
!ENTRY org.eclipse.jdt.ls.core 1 0 2018-03-06 07:59:14.992
!MESSAGE Main thread is waiting
{ ... }
!ENTRY org.eclipse.jdt.ls.core 4 0 2018-03-06 08:00:20.767
!MESSAGE Error occured while building workspace. Details:
message: The method getSerial() is undefined for the type License;code: 67108964
message: The method getExportChannels() is undefined for the type Project;code: 67108964
message: The method getEditions() is undefined for the type Project;code: 67108964
Current Result
A Problem “The method getSerial() is undefined for the type License“ is listed in the problems view. When opening the corresponding file by clicking on the entry the problem disappears after a few seconds.
This behavior is reproducable when restarting vs code.
Expected Result
No problem “The method getSerial() is undefined for the type License“ is listed in the problems view.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:10 (3 by maintainers)
Top Results From Across the Web
False Positive with Java and Lombok - Sonar Community
We have identified some false positives when we are using Lombok. We had a look around and found this in StackOverflow which advices...
Read more >sonarqube + lombok = false positives - Stack Overflow
I've seen that some fixes related to support of "lombok. Data" annotation have been pushed, but still having these annoying false positives.
Read more >SonarJava S1118 creates false positives when using Lombok
Hi all! When you write no constructor, but use one or more of Lombok's constructor annotations, the compiler will not add an implicit...
Read more >Bundled Lombok plugin gives false positive typing complains : IDEA ...
The entire code reproducing the problem can be seen below: Code example with a test case. import lombok.Builder; import lombok.
Read more >Sonar-scanner + Lombok + Gradle = False-Positives codesmells
We use Gradle to build our Java code and sonar-scanner to analyse it, but sonar-scanner generates false-positive codesmells regarding Lombok ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This bug is still happening, please see: Problems list still show errors of undefined for getters or setters. The issue opener resolved it doing this: https://github.com/GabrielBB/vscode-lombok/issues/13#issuecomment-440981551 , but that workaround doesn’t work for others
Here’s how I managed to solve the problem: