-
Notifications
You must be signed in to change notification settings - Fork 423
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
Static analyzes always show warning in every case of @Nullable field access. #3255
Static analyzes always show warning in every case of @Nullable field access. #3255
Comments
looks like an upstream JDT bug. Can you check if the same problem exists in Eclipse IDE and maybe report a bug in https://github.com/eclipse-jdt/eclipse.jdt.core? |
I have tried "NetBeans IDE 18" it's behavior is same as VSCode. |
Intellij IDEA performs more accurate null-analysis. Eclipse JDT should work better. The fact Netbeans provide the same broken behavior is irrelevant. |
I have created issue at eclipse.jdt.core |
I'm sure you are right. Thought I'm a developer, I use IDEs as end user, and dont fully understand how they do their job. |
We have figured out this problem with jdt.core team eclipse-jdt/eclipse.jdt.core#1311 Indeed this is a bug in jdt.core and they are going to fix it. But this alone is not enough to make it work as expected in VS Code. By default jdt.core will still show warning, you need to set an "Enable syntactic analysis" option as described in their documentation: @fbricon Is there a way to configure this in VSCode Java extension now? If no, can you implement it? |
In your project, create a
then, in your project's "java.settings.url": ".vscode/jdt.core.prefs" You can learn more about exposing Eclipse JDT settings in vscode in https://github.com/redhat-developer/vscode-java/wiki/Settings-Global-Preferences |
@rgrunber @hopehadfield I agree, we should turn that preference on by default in JDT.LS |
[provide a description of the issue]
Environment
Steps To Reproduce
See screenshot.
Current Result
Always show warning "Potential null pointer access"
Expected Result
Some null check code exists that is considered as null check done, so warning is not shown. I understand that t is hard to analyze complex null check scenarios, but I'll be happy if simple code like "if (obj!=null) {obj.foo()}" will not show warning.
Additional Informations
Java language server log contains no errors or warnings:
!ENTRY org.eclipse.jdt.ls.core 1 0 2023-08-25 17:17:34.804
!MESSAGE 4 problems reported for /NullCheck.java
The text was updated successfully, but these errors were encountered: