Skip to content
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

@Nonnull annotations does not work #2956

Closed
owl-from-hogvarts opened this issue Feb 20, 2023 · 10 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2486
Closed

@Nonnull annotations does not work #2956

owl-from-hogvarts opened this issue Feb 20, 2023 · 10 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2486
Assignees
Labels

Comments

@owl-from-hogvarts
Copy link

owl-from-hogvarts commented Feb 20, 2023

Annotations related to null safety (@Nullable, @NonNull, @NonNullByDefault) do not work. They simply has no effect.

[provide a description of the issue]

Environment
  • Operating System: Arch Linux
  • JDK version: openjdk 17.0.6 2023-01-17
  • Visual Studio Code version: 1.74.3
  • Java extension version: v1.15.0
Steps To Reproduce
  1. download javax.annotations
  2. set java.compile.mode to automatic
  3. use @Nonnull
  4. see no errors on explicit and obvious assignments

[Please attach a sample project reproducing the error]
Please attach logs

Current Result

In the code snippet below, annotations should clearly produce errors. But they don't.
Same thing with org.eclipse.jdt.annotation.NonNull

import javax.annotation.Nonnull;


public class Main {

  public static void main(String[] args) {
    Test.foo(null);
    
  }
}

class Test {
  {
    foo(null);
  }

  static void foo(@Nonnull Test a) { }
  static void adfka() {}
}
Expected Result

The above code should produce errors when null is passes as parameter.

Additional Informations

Packages were downloaded manully from maven central repository:
https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305/3.0.2
https://mvnrepository.com/artifact/org.eclipse.jdt/org.eclipse.jdt.annotation/2.2.700

settings.json
{
  "java.project.referencedLibraries": [
    "lib/**/*.jar",
    "jsr305-3.0.2.jar"
  ],
  "java.compile.nullAnalysis.nonnull": [
    "javax.annotation.Nonnull",
    "org.eclipse.jdt.annotation.NonNull",
    "org.springframework.lang.NonNull"
  ],
  // "java.compile.nullAnalysis.mode": "disabled",
  "java.compile.nullAnalysis.mode": "automatic",
}
client.log
{
  message: '[Error - 7:18:52 PM] Connection to server got closed. Server will not be restarted.',
  level: 'info',
  timestamp: '2023-02-20 19:18:52.127'
}
{
  message: "Use the JDK from '' as the initial default project JDK.",
  level: 'info',
  timestamp: '2023-02-20 19:20:18.786'
}
{
  message: 'Starting Java server with: /home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/jre/17.0.6-linux-x86_64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:/home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/lombok/lombok-1.18.24.jar -jar /home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/server/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration /home/owl-notebook/.config/Code/User/globalStorage/redhat.java/1.15.0/config_ss_linux -data /home/owl-notebook/.config/Code/User/workspaceStorage/c595708f5acec438b3351fef8272c4f0/redhat.java/ss_ws',
  level: 'info',
  timestamp: '2023-02-20 19:20:18.800'
}
{
  message: 'Starting Java server with: /home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/jre/17.0.6-linux-x86_64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:/home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/lombok/lombok-1.18.24.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/owl-notebook/.config/Code/User/workspaceStorage/c595708f5acec438b3351fef8272c4f0/redhat.java -jar /home/owl-notebook/.vscode/extensions/redhat.java-1.15.0-linux-x64/server/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration /home/owl-notebook/.config/Code/User/globalStorage/redhat.java/1.15.0/config_linux -data /home/owl-notebook/.config/Code/User/workspaceStorage/c595708f5acec438b3351fef8272c4f0/redhat.java/jdt_ws',
  level: 'info',
  timestamp: '2023-02-20 19:20:18.901'
}
{
  message: '[Error - 7:20:23 PM] Connection to server got closed. Server will not be restarted.',
  level: 'info',
  timestamp: '2023-02-20 19:20:23.389'
}
.log
!SESSION 2023-02-20 19:18:47.436 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.6
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /home/username/.config/Code/User/workspaceStorage/workspaceid/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:48.913
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:49.200
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:49.233
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:49.235
!MESSAGE Initializing Java Language Server 1.20.0.202302201439

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.087
!MESSAGE Setting java.home /usr/lib/jvm/java-17-openjdk as default global VM

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.097
!MESSAGE Default VM Install changed from  1676909930074-/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/jre/17.0.6-linux-x86_64 to 1676909930087-/usr/lib/jvm/java-17-openjdk

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.107
!MESSAGE JVM Runtimes changed, saving new configuration

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.121
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.121
!MESSAGE Non-Static Commands: [java.edit.organizeImports, java.project.refreshDiagnostics, java.project.import, java.navigate.openTypeHierarchy, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.resolveStackTraceLocation, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.edit.handlePasteEvent, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.stringFormatting, java.project.getSettings, java.project.updateSourceAttachment, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.addToSourcePath, java.completion.onDidSelect]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.122
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.122
!MESSAGE Non-Static Commands: [java.project.refreshLib, java.project.list, java.project.generateJar, java.project.getMainClasses, java.getPackageData, java.resolvePath]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.122
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.122
!MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveInlineVariables, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.128
!MESSAGE Starting org.eclipse.m2e.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.129
!MESSAGE Started org.eclipse.m2e.core 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.151
!MESSAGE ProjectRegistryRefreshJob finished 22ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.151
!MESSAGE Starting org.eclipse.buildship.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.180
!MESSAGE Started org.eclipse.buildship.core 29ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.185
!MESSAGE RepositoryRegistryUpdateJob finished 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.198
!MESSAGE Creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.204
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:50.302
!MESSAGE Finished creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.095
!MESSAGE Try to create an invisible project for the workspace /home/username/programming/tests/nullable

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.096
!MESSAGE Creating the Java project nullable_a5907aef

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.107
!MESSAGE Finished creating the Java project nullable_a5907aef

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.113
!MESSAGE Successfully created a workspace invisible project nullable_a5907aef

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.131
!MESSAGE Workspace initialized in 947ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.173
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.175
!MESSAGE >> workspace/didChangeConfiguration

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.185
!MESSAGE >> java/buildWorkspace (incremental)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.189
!MESSAGE >> New configuration: {java={home=/usr/lib/jvm/java-17-openjdk, jdt={ls={java={home=null}, vmargs=-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable, lombokSupport={enabled=true}, protobufSupport={enabled=true}, androidSupport={enabled=false}}}, errors={incompleteClasspath={severity=warning}}, configuration={checkProjectSettingsExclusions=false, updateBuildConfiguration=interactive, maven={userSettings=null, globalSettings=null, notCoveredPluginExecutionSeverity=warning, defaultMojoExecutionAction=ignore}, workspaceCacheLimit=90.0, runtimes=[]}, trace={server=off}, import={maven={enabled=true, offline={enabled=false}, disableTestClasspathFlag=false}, gradle={enabled=true, wrapper={enabled=true}, version=null, home=null, java={home=null}, offline={enabled=false}, arguments=null, jvmArguments=null, user={home=null}, annotationProcessing={enabled=true}}, exclusions=[**/node_modules/**, **/.metadata/**, **/archetype-resources/**, **/META-INF/maven/**], generatesMetadataFilesAtProjectRoot=false}, maven={downloadSources=false, updateSnapshots=false}, eclipse={downloadSources=false}, referencesCodeLens={enabled=false}, signatureHelp={enabled=true, description={enabled=false}}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}, insertSpaces=true, tabSize=2.0}, saveActions={organizeImports=false}, project={referencedLibraries=[lib/**/*.jar, jsr305-3.0.2.jar], importOnFirstTimeStartup=automatic, importHint=true, resourceFilters=[node_modules, \.git], encoding=ignore, exportJar={targetPath=${workspaceFolder}/${workspaceFolderBasename}.jar}}, contentProvider={preferred=null}, autobuild={enabled=true}, maxConcurrentBuilds=1.0, recommendations={dependency={analytics={show=true}}}, completion={maxResults=0.0, enabled=true, guessMethodArguments=true, favoriteStaticMembers=[org.junit.Assert.*, org.junit.Assume.*, org.junit.jupiter.api.Assertions.*, org.junit.jupiter.api.Assumptions.*, org.junit.jupiter.api.DynamicContainer.*, org.junit.jupiter.api.DynamicTest.*, org.mockito.Mockito.*, org.mockito.ArgumentMatchers.*, org.mockito.Answers.*], filteredTypes=[java.awt.*, com.sun.*, sun.*, jdk.*, org.graalvm.*, io.micrometer.shaded.*], importOrder=[#, java, javax, org, com, ], postfix={enabled=true}, matchCase=off}, foldingRange={enabled=true}, progressReports={enabled=true}, codeGeneration={hashCodeEquals={useJava7Objects=false, useInstanceof=false}, useBlocks=false, generateComments=false, toString={template=${object.className} [${member.name()}=${member.value}, ${otherMembers}], codeStyle=STRING_CONCATENATION, skipNullValues=false, listArrayContents=true, limitElements=0.0}, insertionLocation=afterCursor}, selectionRange={enabled=true}, showBuildStatusOnStart={enabled=notification}, server={launchMode=Hybrid}, sources={organizeImports={starThreshold=99.0, staticStarThreshold=99.0}}, imports={gradle={wrapper={checksums=[]}}}, templates={fileHeader=[], typeComment=[]}, references={includeAccessors=true, includeDecompiledSources=true}, typeHierarchy={lazyLoad=false}, settings={url=null}, symbols={includeSourceMethodDeclarations=false}, quickfix={showAt=line}, inlayHints={parameterNames={enabled=literals, exclusions=[]}}, codeAction={sortMembers={avoidVolatileChanges=true}}, compile={nullAnalysis={nonnull=[javax.annotation.Nonnull, org.eclipse.jdt.annotation.NonNull, org.springframework.lang.NonNull], nullable=[javax.annotation.Nullable, org.eclipse.jdt.annotation.Nullable, org.springframework.lang.Nullable], mode=automatic}}, cleanup={actionsOnSave=[]}, sharedIndexes={enabled=auto, location=}, refactoring={extract={interface={replace=true}}}, debug={logLevel=warn, settings={showHex=false, showStaticVariables=false, showQualifiedNames=false, showLogicalStructure=true, showToString=true, maxStringLength=0.0, numericPrecision=0.0, hotCodeReplace=manual, enableRunDebugCodeLens=true, forceBuildBeforeLaunch=true, onBuildFailureProceed=false, console=integratedTerminal, exceptionBreakpoint={skipClasses=[]}, stepping={skipClasses=[], skipSynthetics=false, skipStaticInitializers=false, skipConstructors=false}, jdwp={limitOfVariablesPerJdwpRequest=100.0, requestTimeout=3000.0, async=auto}, vmArgs=}}, silentNotification=false, dependency={showMembers=false, syncWithFolderExplorer=true, autoRefresh=true, refreshDelay=2000.0, packagePresentation=flat}}}

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.190
!MESSAGE >> document/didOpen

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.462
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.466
!MESSAGE Reconciled 1. Took 0 ms

!ENTRY org.eclipse.jdt.ls.core 4 0 2023-02-20 19:18:51.499
!MESSAGE Error occured while building workspace. Details: 
 message: The import javax.annotation.Nonnull cannot be resolved; code: 268435846; resource: /home/username/programming/tests/nullable/src/Main.java; line: 3
 message: Nonnull cannot be resolved to a type; code: 16777218; resource: /home/username/programming/tests/nullable/src/Main.java; line: 19

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.559
!MESSAGE begin problem for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.559
!MESSAGE 2 problems reported for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.563
!MESSAGE Validated 1. Took 64 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.587
!MESSAGE >> Updating classpath for project nullable_a5907aef

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.589
!MESSAGE >> Adding /home/username/programming/tests/nullable/jsr305-3.0.2.jar to the classpath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.655
!MESSAGE >> build jobs finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.658
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.659
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.660
!MESSAGE >> watchers registered

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.702
!MESSAGE >> workspace/executeCommand java.project.getAll

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.704
!MESSAGE >> workspace/executeCommand java.project.getAll

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.705
!MESSAGE >> workspace/executeCommand java.project.getAll

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.709
!MESSAGE >> workspace/executeCommand java.project.listSourcePaths

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.711
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.739
!MESSAGE >> workspace/executeCommand java.project.getSettings

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:51.742
!MESSAGE >> workspace/executeCommand java.project.getClasspaths

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:52.223
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY java-debug 1 0 2023-02-20 19:18:52.246
!MESSAGE Starting com.microsoft.java.debug.plugin

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:52.710
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:52.888
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:53.529
!MESSAGE >> textDocument/semanticTokens/full

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:53.631
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:18:57.896
!MESSAGE >> document/didClose

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:02.005
!MESSAGE >> workspace/executeCommand java.project.list

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:02.014
!MESSAGE >> workspace/executeCommand java.resolvePath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:03.667
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:03.676
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:05.352
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:08.162
!MESSAGE >> workspace/executeCommand java.resolvePath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.523
!MESSAGE >> document/didOpen

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.537
!MESSAGE Reconciled 1. Took 0 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.545
!MESSAGE >> workspace/executeCommand java.resolvePath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.549
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.549
!MESSAGE >> document/documentSymbol

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.550
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.567
!MESSAGE >> textDocument/semanticTokens/full

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.571
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.734
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.786
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.977
!MESSAGE begin problem for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.977
!MESSAGE 0 problems reported for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:09.978
!MESSAGE Validated 1. Took 40 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:10.239
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:10.269
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:10.288
!MESSAGE >> java/findLinks

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:10.951
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:12.499
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:15.696
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:20.808
!MESSAGE >> workspace/executeCommand java.project.getSettings

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:55.039
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:55.070
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:55.216
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:55.324
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:56.163
!MESSAGE >> document/definition

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:56.366
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:56.380
!MESSAGE >> java/findLinks

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:56.749
!MESSAGE >> document/definition

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:19:56.892
!MESSAGE >> document/definition

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:04.687
!MESSAGE >> shutdown

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:05.689
!MESSAGE >> exit

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:05.690
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:05.699
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:
!SESSION 2023-02-20 19:20:19.185 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.6
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /home/username/.config/Code/User/workspaceStorage/c595708f5acec438b3351fef8272c4f0/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:20.353
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:20.480
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:20.502
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:20.504
!MESSAGE Initializing Java Language Server 1.20.0.202302201439

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.082
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.082
!MESSAGE Non-Static Commands: [java.edit.organizeImports, java.project.refreshDiagnostics, java.project.import, java.navigate.openTypeHierarchy, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.resolveStackTraceLocation, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.edit.handlePasteEvent, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.stringFormatting, java.project.getSettings, java.project.updateSourceAttachment, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.addToSourcePath, java.completion.onDidSelect]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.082
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.082
!MESSAGE Non-Static Commands: [java.project.refreshLib, java.project.list, java.project.generateJar, java.project.getMainClasses, java.getPackageData, java.resolvePath]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.083
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.083
!MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveInlineVariables, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.088
!MESSAGE Starting org.eclipse.m2e.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.089
!MESSAGE Started org.eclipse.m2e.core 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.238
!MESSAGE ProjectRegistryRefreshJob finished 147ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.238
!MESSAGE Starting org.eclipse.buildship.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.284
!MESSAGE Started org.eclipse.buildship.core 45ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.294
!MESSAGE RepositoryRegistryUpdateJob finished 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:21.368
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.107
!MESSAGE Workspace initialized in 814ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.124
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.126
!MESSAGE >> workspace/didChangeConfiguration

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.137
!MESSAGE >> java/buildWorkspace (incremental)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.147
!MESSAGE >> New configuration: {java={home=/usr/lib/jvm/java-17-openjdk, jdt={ls={java={home=null}, vmargs=-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable, lombokSupport={enabled=true}, protobufSupport={enabled=true}, androidSupport={enabled=false}}}, errors={incompleteClasspath={severity=warning}}, configuration={checkProjectSettingsExclusions=false, updateBuildConfiguration=interactive, maven={userSettings=null, globalSettings=null, notCoveredPluginExecutionSeverity=warning, defaultMojoExecutionAction=ignore}, workspaceCacheLimit=90.0, runtimes=[]}, trace={server=off}, import={maven={enabled=true, offline={enabled=false}, disableTestClasspathFlag=false}, gradle={enabled=true, wrapper={enabled=true}, version=null, home=null, java={home=null}, offline={enabled=false}, arguments=null, jvmArguments=null, user={home=null}, annotationProcessing={enabled=true}}, exclusions=[**/node_modules/**, **/.metadata/**, **/archetype-resources/**, **/META-INF/maven/**], generatesMetadataFilesAtProjectRoot=false}, maven={downloadSources=false, updateSnapshots=false}, eclipse={downloadSources=false}, referencesCodeLens={enabled=false}, signatureHelp={enabled=true, description={enabled=false}}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}, insertSpaces=true, tabSize=2.0}, saveActions={organizeImports=false}, project={referencedLibraries=[lib/**/*.jar, jsr305-3.0.2.jar], importOnFirstTimeStartup=automatic, importHint=true, resourceFilters=[node_modules, \.git], encoding=ignore, exportJar={targetPath=${workspaceFolder}/${workspaceFolderBasename}.jar}}, contentProvider={preferred=null}, autobuild={enabled=true}, maxConcurrentBuilds=1.0, recommendations={dependency={analytics={show=true}}}, completion={maxResults=0.0, enabled=true, guessMethodArguments=true, favoriteStaticMembers=[org.junit.Assert.*, org.junit.Assume.*, org.junit.jupiter.api.Assertions.*, org.junit.jupiter.api.Assumptions.*, org.junit.jupiter.api.DynamicContainer.*, org.junit.jupiter.api.DynamicTest.*, org.mockito.Mockito.*, org.mockito.ArgumentMatchers.*, org.mockito.Answers.*], filteredTypes=[java.awt.*, com.sun.*, sun.*, jdk.*, org.graalvm.*, io.micrometer.shaded.*], importOrder=[#, java, javax, org, com, ], postfix={enabled=true}, matchCase=off}, foldingRange={enabled=true}, progressReports={enabled=true}, codeGeneration={hashCodeEquals={useJava7Objects=false, useInstanceof=false}, useBlocks=false, generateComments=false, toString={template=${object.className} [${member.name()}=${member.value}, ${otherMembers}], codeStyle=STRING_CONCATENATION, skipNullValues=false, listArrayContents=true, limitElements=0.0}, insertionLocation=afterCursor}, selectionRange={enabled=true}, showBuildStatusOnStart={enabled=notification}, server={launchMode=Hybrid}, sources={organizeImports={starThreshold=99.0, staticStarThreshold=99.0}}, imports={gradle={wrapper={checksums=[]}}}, templates={fileHeader=[], typeComment=[]}, references={includeAccessors=true, includeDecompiledSources=true}, typeHierarchy={lazyLoad=false}, settings={url=null}, symbols={includeSourceMethodDeclarations=false}, quickfix={showAt=line}, inlayHints={parameterNames={enabled=literals, exclusions=[]}}, codeAction={sortMembers={avoidVolatileChanges=true}}, compile={nullAnalysis={nonnull=[javax.annotation.Nonnull, org.eclipse.jdt.annotation.NonNull, org.springframework.lang.NonNull], nullable=[javax.annotation.Nullable, org.eclipse.jdt.annotation.Nullable, org.springframework.lang.Nullable], mode=automatic}}, cleanup={actionsOnSave=[]}, sharedIndexes={enabled=auto, location=}, refactoring={extract={interface={replace=true}}}, debug={logLevel=warn, settings={showHex=false, showStaticVariables=false, showQualifiedNames=false, showLogicalStructure=true, showToString=true, maxStringLength=0.0, numericPrecision=0.0, hotCodeReplace=manual, enableRunDebugCodeLens=true, forceBuildBeforeLaunch=true, onBuildFailureProceed=false, console=integratedTerminal, exceptionBreakpoint={skipClasses=[]}, stepping={skipClasses=[], skipSynthetics=false, skipStaticInitializers=false, skipConstructors=false}, jdwp={limitOfVariablesPerJdwpRequest=100.0, requestTimeout=3000.0, async=auto}, vmArgs=}}, silentNotification=false, dependency={showMembers=false, syncWithFolderExplorer=true, autoRefresh=true, refreshDelay=2000.0, packagePresentation=flat}}}

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.155
!MESSAGE >> document/didOpen

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.555
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.672
!MESSAGE Reconciled 1. Took 1 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.688
!MESSAGE >> Updating classpath for project nullable_a5907aef

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.691
!MESSAGE >> Adding /home/username/programming/tests/nullable/jsr305-3.0.2.jar to the classpath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.886
!MESSAGE begin problem for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.886
!MESSAGE 0 problems reported for /Main.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.889
!MESSAGE Validated 1. Took 143 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.929
!MESSAGE >> build jobs finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.932
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.934
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.935
!MESSAGE >> watchers registered

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.973
!MESSAGE >> workspace/executeCommand java.project.getAll

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.974
!MESSAGE >> workspace/executeCommand java.project.getAll

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.974
!MESSAGE >> workspace/executeCommand java.project.listSourcePaths

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.975
!MESSAGE >> workspace/executeCommand java.project.list

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.975
!MESSAGE >> workspace/executeCommand java.resolvePath

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:22.977
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.016
!MESSAGE >> workspace/executeCommand java.project.getClasspaths

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.017
!MESSAGE >> workspace/executeCommand java.project.getSettings

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.019
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.030
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.034
!MESSAGE >> workspace/executeCommand java.getPackageData

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.235
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY java-debug 1 0 2023-02-20 19:20:23.240
!MESSAGE Starting com.microsoft.java.debug.plugin

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.562
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:23.889
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:24.193
!MESSAGE >> textDocument/semanticTokens/full

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:24.623
!MESSAGE >> document/definition

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:24.886
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:24.945
!MESSAGE >> java/findLinks

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:25.711
!MESSAGE >> workspace/executeCommand java.project.getSettings

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:37.486
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:37.490
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:37.661
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:20:37.715
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:15.157
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:15.174
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:15.335
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:15.391
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:24.117
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:24.123
!MESSAGE >> textDocument/inlayHint

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:24.296
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-02-20 19:25:24.350
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod
@snjeza
Copy link
Contributor

snjeza commented Feb 20, 2023

set java.compile.mode to automatic

@owl-from-hogvarts I can't reproduce the issue.
You should set

"java.compile.nullAnalysis.mode": "automatic"

and check your workspace settings - <your_project>/.vscode/settings.json

@owl-from-hogvarts
Copy link
Author

Hello! Thank you for reply. As you can see in Additional information section null analysis is set to automatic already. settigns.json present there is from .vscode folder of project

@owl-from-hogvarts
Copy link
Author

@snjeza Also, should compiler itself (i.e. when javac is called form command line) report errors related to annotation and null analysis?

@snjeza
Copy link
Contributor

snjeza commented Feb 20, 2023

Also, should compiler itself (i.e. when javac is called form command line) report errors related to annotation and null analysis?

No, it shouldn't.

@snjeza
Copy link
Contributor

snjeza commented Feb 20, 2023

I can't reproduce the issue.

I can reproduce the issue when using an Eclipse or invisible project.

@snjeza snjeza self-assigned this Feb 20, 2023
@owl-from-hogvarts
Copy link
Author

owl-from-hogvarts commented Feb 21, 2023

In eclipse org.eclipse.jdt.annotation works as expected but javax.annotation does not work (settings are applied via project -> properties -> Null analysis. javax.annotation.Nonnull is added as secondary nonnull annotation)

P.S. Tested on both openjdk-8 and openjdk-11

@owl-from-hogvarts
Copy link
Author

In dev console in vscode I can see:
ERR Connection got disposed.: Error: Connection got disposed.
    at Object.dispose (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1051095)
    at Object.dispose (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:898091)
    at b.handleConnectionClosed (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:898279)
    at b.handleConnectionClosed (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:971911)
    at t (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:896393)
    at invoke (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1052721)
    at s.fire (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1053482)
    at Q (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1040234)
    at invoke (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1052721)
    at s.fire (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1053482)
    at _.fireClose (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1064927)
    at Socket.<anonymous> (/home/username/.vscode/extensions/redhat.java-1.15.0-linux-x64/dist/extension.js:2:1065712)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)

May be this is related to the problem.

Notice, that even after this error extension works fine, i.e. It can resolve references to variable, classes and so on, do refactoring. So except null analysis all works as expected

@owl-from-hogvarts
Copy link
Author

I also see the message like above even when null analysis is explicitly disabled

@owl-from-hogvarts
Copy link
Author

Thank you for fix, @snjeza! How can I test it? Is switching to pre-release version of the extensions is enough? or should I manually rebuild extension from sources, including org.eclipse.jdt.ls package?

@owl-from-hogvarts
Copy link
Author

Thank you again! I have build extension from sources. No more errors in dev console. Also I figured out that I should have created project, so extension could init config files properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants