Closed hkuadithya closed 4 years ago
are you using a Maven or Gradle project? or simple Java files in a folder?
@fbricon It's just a simple standalone Java file with a main method. Not using Gradle/Maven.
did you simply open the java file or its parent folder?
File > Open Folder
(empty folder)
Created a new Java file from the Explorer in the left panel. New File > Functional.java
.
Debug > Run Without debugging
-- Works fine. However, when I add var
, errors are raised.
Examples for errors:
var array = new int[]{1, 2, 3, 4};
var hello = "hello world";
This works fine:
int[] array = new int[]{1, 2 ,3, 4};
String hello = "hello world";
Please turn on verbose logging and attach the logs from the output view, after restarting vscode
It works for me on Mac. @snjeza can you double check on windows?
@fbricon Sure, I'm currently at work. Will provide more details (verbose logging) when I get back home in about 6-7 hours (PST timezone).
Since it works on Mac, I suspect it's specific to the OS. (Win 10 Professional, 64 bit).
@snjeza can you double check on windows?
I can't reproduce the issue on Windows and Linux. @hkuadithya Could you attach your Functional.java?
@snjeza @fbricon
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Functional {
public static void main(String[] args) {
var a = "hello";
var b = new int[]{1, 2, 3, 4, 5};
testMap();
testFilter();
testReduce();
}
private static void testMap() {
List<String> list = Arrays.asList("abc", "def", "ghi");
List<String> result = list.stream().map((element) -> element.toUpperCase()).collect(Collectors.toList());
System.out.println(result);
}
private static void testFilter() {
int[] elements = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int[] x = Arrays.stream(elements).filter((element) -> ((element & 1) == 0)).toArray();
System.out.println(Arrays.toString(elements));
System.out.println(Arrays.toString(x));
}
private static void testReduce() {
int[] elements = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int product = Arrays.stream(elements).reduce(0, (left, right) -> left + right);
System.out.println(product);
}
}
{
message: "[Trace - 9:09:06 AM] Sending request 'workspace/executeCommand - (3)'.",
level: 'info',
timestamp: '2020-02-20 09:09:06.383'
}
{
message: 'Params: {\n "command": "vscode.java.updateDebugSettings",\n ' +
'"arguments": [\n ' +
'"{\\"showHex\\":false,\\"showStaticVariables\\":false,\\"showQualifiedNames\\":false,\\"showLogicalStructure\\":true,\\"showToString\\":true,\\"maxStringLength\\":0,\\"numericPrecision\\":0,\\"hotCodeReplace\\":\\"manual\\",\\"enableRunDebugCodeLens\\":true,\\"forceBuildBeforeLaunch\\":true,\\"console\\":\\"integratedTerminal\\",\\"logLevel\\":\\"WARNING\\",\\"javaHome\\":\\"C:\\\\\\\\Program ' +
'Files\\\\\\\\Java\\\\\\\\jdk-13.0.2\\"}"\n ]\n}\n\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.384'
}
{
message: '[Trace - 9:09:06 AM] Received response ' +
"'workspace/executeCommand - (3)' in " +
'30ms.',
level: 'info',
timestamp: '2020-02-20 09:09:06.413'
}
{
message: 'Result: ' +
'"{\\"maxStringLength\\":0,\\"numericPrecision\\":0,\\"showStaticVariables\\":false,\\"showQualifiedNames\\":false,\\"showHex\\":false,\\"showLogicalStructure\\":true,\\"showToString\\":true,\\"logLevel\\":\\"WARNING\\",\\"javaHome\\":\\"C:\\\\\\\\Program ' +
'Files\\\\\\\\Java\\\\\\\\jdk-13.0.2\\",\\"hotCodeReplace\\":\\"manual\\"}"\n' +
'\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.413'
}
{
message: "[Trace - 9:09:06 AM] Sending request 'java/buildWorkspace - (4)'.",
level: 'info',
timestamp: '2020-02-20 09:09:06.415'
}
{
message: "[Trace - 9:09:06 AM] Received notification 'window/logMessage'.",
level: 'info',
timestamp: '2020-02-20 09:09:06.428'
}
{
message: 'Params: {\n "type": 1,\n "message": "Feb 20, 2020, 9:09:06 AM ' +
'Error occured while building workspace. Details: \\r\\n message: ' +
'var cannot be resolved to a type; code: 16777218; resource: ' +
'C:/Users/hkuad/Desktop/CP/Practice/Functional.java; line: 7\\r\\n ' +
'message: var cannot be resolved to a type; code: 16777218; ' +
'resource: C:/Users/hkuad/Desktop/CP/Practice/Functional.java; ' +
'line: 8"\n}\n\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.428'
}
{
message: '[Error - 9:09:06 AM] Feb 20, 2020, 9:09:06 AM Error occured while ' +
'building workspace. Details: \r' +
'\n message: var cannot be resolved to a type; code: 16777218; resource: ' +
'C:/Users/hkuad/Desktop/CP/Practice/Functional.java; line: 7\r' +
'\n message: var cannot be resolved to a type; code: 16777218; resource: ' +
'C:/Users/hkuad/Desktop/CP/Practice/Functional.java; line: 8',
level: 'info',
timestamp: '2020-02-20 09:09:06.429'
}
{
message: '[Trace - 9:09:06 AM] Received response ' +
"'java/buildWorkspace - (4)' in 15ms.",
level: 'info',
timestamp: '2020-02-20 09:09:06.430'
}
{
message: 'Result: 2\n\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.430'
}
{
message: "[Trace - 9:09:06 AM] Received notification 'language/progressReport'.",
level: 'info',
timestamp: '2020-02-20 09:09:06.527'
}
{
message: 'Params: {\n "id": ' +
'"b0db6b5d-9f4e-464b-8c63-a68522abbf59",\n "task": ' +
'"Building",\n "status": "0% ",\n "totalWork": 1000,\n ' +
' "workDone": 0,\n "complete": false\n}\n\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.528'
}
{
message: "[Trace - 9:09:06 AM] Received notification 'language/progressReport'.",
level: 'info',
timestamp: '2020-02-20 09:09:06.531'
}
{
message: 'Params: {\n "id": ' +
'"b0db6b5d-9f4e-464b-8c63-a68522abbf59",\n "task": ' +
'"Building",\n "status": "0% ",\n "totalWork": 1000,\n ' +
' "workDone": 0,\n "complete": true\n}\n\n',
level: 'info',
timestamp: '2020-02-20 09:09:06.532'
}
Can you paste the full log, starting when vscode-java starts?
@fbricon @snjeza
There were lots of traces. I picked the one displayed first. Trace with verbose logging. I parsed it in a JSON parser to make it readable.
{
message: 'Starting Java server with: C: \\Program Files\\Java\\jdk-13.0.2\\bin\\java ' + '--add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED ' + '--add-opens java.base/java.lang=ALL-UNNAMED ' + '-Declipse.application=org.eclipse.jdt.ls.core.id1 ' + '-Dosgi.bundles.defaultStartLevel=4 ' + '-Declipse.product=org.eclipse.jdt.ls.core.product ' + '-Dfile.encoding=utf8 -DwatchParentProcess=false -Xmx1G -XX: +UseG1GC ' + '-XX: +UseStringDeduplication -jar ' + 'c: \\Users\\hkuad\\.vscode\\extensions\\redhat.java-0.57.0\\server\\plugins\\org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar ' + '-configuration ' + 'c: \\Users\\hkuad\\.vscode\\extensions\\redhat.java-0.57.0\\server\\config_win ' + '-data ' + 'c: \\Users\\hkuad\\AppData\\Roaming\\Code\\User\\workspaceStorage\\c96b088e4efde1a7a0114c8383b5b363\\redhat.java\\jdt_ws',
level: 'info',
timestamp: '2020-02-20 09: 19: 13.090'
}{
message: "[Trace - 9:19:13 AM] Sending request 'initialize - (0)'.",
level: 'info',
timestamp: '2020-02-20 09: 19: 13.134'
}{
message: 'Params: {
\n "processId": 12168,
\n "clientInfo": {
\n "name": ' + '"vscode",
\n "version": "1.42.1"\n
},
\n "rootPath": ' + '"c:\\\\Users\\\\hkuad\\\\Desktop\\\\CP\\\\Practice",
\n "rootUri": ' + '"file:///c%3A/Users/hkuad/Desktop/CP/Practice",
\n "capabilities": {
\n ' + ' "workspace": {
\n "applyEdit": true,
\n ' + '"workspaceEdit": {
\n "documentChanges": true,
\n ' + ' "resourceOperations": [
\n "create",
\n ' + '"rename",
\n "delete"\n
],
\n ' + '"failureHandling": "textOnlyTransactional"\n
},
\n ' + '"didChangeConfiguration": {
\n "dynamicRegistration": true\n ' + '
},
\n "didChangeWatchedFiles": {
\n ' + '"dynamicRegistration": true\n
},
\n "symbol": {
\n ' + ' "dynamicRegistration": true,
\n "symbolKind": {
\n ' + ' "valueSet": [
\n 1,
\n ' + ' 2,
\n 3,
\n 4,
\n ' + ' 5,
\n 6,
\n 7,
\n ' + ' 8,
\n 9,
\n 10,
\n ' + ' 11,
\n 12,
\n ' + ' 13,
\n 14,
\n 15,
\n ' + ' 16,
\n 17,
\n 18,
\n ' + ' 19,
\n 20,
\n ' + ' 21,
\n 22,
\n 23,
\n ' + ' 24,
\n 25,
\n 26\n ' + '
]\n
}\n
},
\n ' + '"executeCommand": {
\n "dynamicRegistration": true\n ' + '
},
\n "configuration": true,
\n "workspaceFolders": ' + 'true\n
},
\n "textDocument": {
\n ' + '"publishDiagnostics": {
\n "relatedInformation": true,
\n ' + ' "tagSupport": {
\n "valueSet": [
\n ' + ' 1,
\n 2\n
]\n ' + '
}\n
},
\n "synchronization": {
\n ' + '"dynamicRegistration": true,
\n "willSave": true,
\n ' + ' "willSaveWaitUntil": true,
\n "didSave": true\n ' + '
},
\n "completion": {
\n "dynamicRegistration": ' + 'true,
\n "contextSupport": true,
\n ' + '"completionItem": {
\n "snippetSupport": true,
\n ' + ' "commitCharactersSupport": true,
\n ' + '"documentationFormat": [
\n "markdown",
\n ' + ' "plaintext"\n
],
\n ' + '"deprecatedSupport": true,
\n "preselectSupport": true,
\n ' + ' "tagSupport": {
\n "valueSet": [
\n ' + ' 1\n
]\n
}\n' + '
},
\n "completionItemKind": {
\n ' + ' "valueSet": [
\n 1,
\n 2,
\n ' + ' 3,
\n 4,
\n ' + '5,
\n 6,
\n 7,
\n ' + ' 8,
\n 9,
\n 10,
\n ' + ' 11,
\n 12,
\n 13,
\n ' + ' 14,
\n 15,
\n ' + ' 16,
\n 17,
\n 18,
\n ' + ' 19,
\n 20,
\n 21,
\n ' + ' 22,
\n 23,
\n ' + ' 24,
\n 25\n
]\n
}\n ' + '
},
\n "hover": {
\n "dynamicRegistration": ' + 'true,
\n "contentFormat": [
\n "markdown",
\n ' + ' "plaintext"\n
]\n
},
\n ' + '"signatureHelp": {
\n "dynamicRegistration": true,
\n ' + ' "signatureInformation": {
\n "documentationFormat": ' + '[
\n "markdown",
\n "plaintext"\n ' + '
],
\n "parameterInformation": {
\n ' + ' "labelOffsetSupport": true\n
}\n ' + '
},
\n "contextSupport": true\n
},
\n ' + ' "definition": {
\n "dynamicRegistration": true,
\n ' + ' "linkSupport": true\n
},
\n "references": {
\n ' + ' "dynamicRegistration": true\n
},
\n ' + '"documentHighlight": {
\n "dynamicRegistration": true\n ' + '
},
\n "documentSymbol": {
\n ' + '"dynamicRegistration": true,
\n "symbolKind": {
\n ' + ' "valueSet": [
\n 1,
\n 2,
\n ' + ' 3,
\n 4,
\n ' + ' 5,
\n 6,
\n 7,
\n ' + ' 8,
\n 9,
\n 10,
\n ' + ' 11,
\n 12,
\n 13,
\n' + ' 14,
\n 15,
\n ' + ' 16,
\n 17,
\n 18,
\n ' + ' 19,
\n 20,
\n 21,
\n ' + ' 22,
\n 23,
\n ' + ' 24,
\n 25,
\n 26\n ' + '
]\n
},
\n ' + '"hierarchicalDocumentSymbolSupport": true\n
},
\n ' + '"codeAction": {
\n "dynamicRegistration": true,
\n ' + ' "isPreferredSupport": true,
\n "codeActionLiteralSupport": ' + '{
\n "codeActionKind": {
\n ' + '"valueSet": [
\n "",
\n ' + '"quickfix",
\n "refactor",
\n ' + ' "refactor.extract",
\n "refactor.inline",
\n ' + ' "refactor.rewrite",
\n ' + '"source",
\n "source.organizeImports"\n ' + '
]\n
}\n
}\n
},
\n ' + ' "codeLens": {
\n "dynamicRegistration": true\n ' + '
},
\n "formatting": {
\n "dynamicRegistration": ' + 'true\n
},
\n "rangeFormatting": {
\n ' + '"dynamicRegistration": true\n
},
\n "onTypeFormatting": ' + '{
\n "dynamicRegistration": true\n
},
\n ' + '"rename": {
\n "dynamicRegistration": true,
\n ' + '"prepareSupport": true\n
},
\n "documentLink": {
\n ' + ' "dynamicRegistration": true,
\n "tooltipSupport": ' + 'true\n
},
\n "typeDefinition": {
\n ' + '"dynamicRegistration": true,
\n "linkSupport": true\n ' + '
},
\n "implementation": {
\n ' + '"dynamicRegistration": true,
\n "linkSupport": true\n ' + '
},
\n "colorProvider": {
\n "dynamicRegistration": ' + 'true\n
},
\n "foldingRange": {
\n ' + '"dynamicRegistration": true,
\n "rangeLimit": 5000,
\n ' + ' "lineFoldingOnly": true\n
},
\n "declaration": {
\n ' + ' "dynamicRegistration": true,
\n "linkSupport": ' + 'true\n
},
\n "selectionRange": {
\n ' + '"dynamicRegistration": true\n
},
\n "callHierarchy": {
\n ' + ' "dynamicRegistration": true\n
}\n
},
\n ' + ' "window": {
\n "workDoneProgress": true\n
}\n
},
\n ' + '"initializationOptions": {
\n "bundles": [
\n ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\visualstudioexptteam.vscodeintellicode-1.2.5\\\\dist\\\\com.microsoft.jdtls.intellicode.core-0.3.14.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-debug-0.25.0\\\\server\\\\com.microsoft.java.debug.plugin-0.25.0.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-dependency-0.9.0\\\\server\\\\com.microsoft.jdtls.ext.core-0.9.0.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\com.microsoft.java.test.plugin-0.22.1.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.eclipse.jdt.junit4.runtime_1.1.1000.v20190510-0840.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.eclipse.jdt.junit5.runtime_1.0.500.v20190510-0840.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.jupiter.api_5.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.jupiter.engine_5.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.jupiter.migrationsupport_5.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.jupiter.params_5.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.vintage.engine_5.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.opentest4j_1.1.1.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.platform.commons_1.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.platform.engine_1.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.platform.launcher_1.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.platform.runner_1.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.junit.platform.suite.api_1.4.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-java-test-0.22.1\\\\server\\\\org.apiguardian_1.0.0.v20190212-2109.jar",
\n' + ' ' + '"C:\\\\Users\\\\hkuad\\\\.vscode\\\\extensions\\\\vscjava.vscode-maven-0.21.0\\\\jdtls.ext\\\\com.microsoft.java.maven.plugin\\\\target\\\\com.microsoft.java.maven.plugin-0.21.0.jar"\n' + '
],
\n "workspaceFolders": [
\n ' + '"file:///c%3A/Users/hkuad/Desktop/CP/Practice"\n
],
\n ' + '"settings": {
\n "java": {
\n "home": "C:\\\\Program ' + 'Files\\\\Java\\\\jdk-13.0.2",
\n "jdt": {
\n ' + '"ls": {
\n "vmargs": "-Xmx1G -XX:+UseG1GC ' + '-XX:+UseStringDeduplication"\n
}\n
},
\n ' + ' "errors": {
\n "incompleteClasspath": {
\n ' + ' "severity": "ignore"\n
}\n ' + '
},
\n "configuration": {
\n ' + '"checkProjectSettingsExclusions": true,
\n ' + '"updateBuildConfiguration": "interactive",
\n "maven": {
\n ' + ' "userSettings": null\n
},
\n ' + ' "runtimes": [
]\n
},
\n "trace": {
\n ' + ' "server": "verbose"\n
},
\n ' + '"import": {
\n "maven": {
\n ' + '"enabled": true\n
},
\n "gradle": {
\n ' + ' "enabled": true,
\n "wrapper": {
\n ' + ' "enabled": true\n
},
\n ' + ' "offline": {
\n "enabled": ' + 'false\n
},
\n "version": null,
\n ' + ' "arguments": null,
\n ' + '"jvmArguments": null,
\n "home": null\n ' + '
},
\n "exclusions": [
\n ' + '"**/node_modules/**",
\n "**/.metadata/**",
\n ' + ' "**/archetype-resources/**",
\n ' + '"**/META-INF/maven/**"\n
]\n
},
\n ' + ' "maven": {
\n "downloadSources": false,
\n ' + ' "updateSnapshots": false\n
},
\n ' + '"referencesCodeLens": {
\n "enabled": false\n ' + '
},
\n "signatureHelp": {
\n "enabled": ' + 'false\n
},
\n "implementationsCodeLens": {
\n ' + ' "enabled": false\n
},
\n ' + '"format": {
\n "enabled": true,
\n ' + '"settings": {
\n "url": null,
\n ' + '"profile": null\n
},
\n "comments": {
\n ' + ' "enabled": true\n
},
\n ' + ' "onType": {
\n "enabled": true\n ' + '
}\n
},
\n "saveActions": {
\n ' + ' "organizeImports": false\n
},
\n "project": {
\n' + ' "referencedLibraries": [
\n ' + '"lib/**/*.jar"\n
]\n
},
\n ' + '"contentProvider": {
\n "preferred": null\n ' + '
},
\n "autobuild": {
\n "enabled": true\n ' + '
},
\n "maxConcurrentBuilds": 1,
\n ' + '"completion": {
\n "maxResults": 50,
\n ' + '"enabled": true,
\n "overwrite": true,
\n ' + ' "guessMethodArguments": false,
\n ' + '"favoriteStaticMembers": [
\n "org.junit.Assert.*",
\n ' + ' "org.junit.Assume.*",
\n ' + '"org.junit.jupiter.api.Assertions.*",
\n ' + '"org.junit.jupiter.api.Assumptions.*",
\n ' + '"org.junit.jupiter.api.DynamicContainer.*",
\n ' + '"org.junit.jupiter.api.DynamicTest.*",
\n ' + '"org.mockito.Mockito.*",
\n ' + '"org.mockito.ArgumentMatchers.*",
\n ' + '"org.mockito.Answers.*"\n
],
\n ' + '"filteredTypes": [
\n "java.awt.*",
\n ' + ' "com.sun.*"\n
],
\n ' + '"importOrder": [
\n "java",
\n ' + '"javax",
\n "com",
\n "org"\n ' + '
]\n
},
\n "foldingRange": {
\n ' + ' "enabled": true\n
},
\n ' + '"progressReports": {
\n "enabled": true\n ' + '
},
\n "codeGeneration": {
\n ' + '"hashCodeEquals": {
\n "useJava7Objects": false,
\n ' + ' "useInstanceof": false\n
},
\n ' + ' "useBlocks": false,
\n "generateComments": ' + 'false,
\n "toString": {
\n ' + '"template": "${object.className} [${member.name()}=${member.value}, ' + '${otherMembers}]",
\n "codeStyle": ' + '"STRING_CONCATENATION",
\n "skipNullValues": false,
\n ' + ' "listArrayContents": true,
\n ' + '"limitElements": 0\n
}\n
},
\n ' + ' "selectionRange": {
\n "enabled": true\n ' + '
},
\n "showBuildStatusOnStart": {
\n ' + '"enabled": false\n
},
\n "debug": {
\n ' + ' "logLevel": "warn",
\n "settings": {
\n ' + ' "showHex": false,
\n ' + '"showStaticVariables": false,
\n ' + '"showQualifiedNames": false,
\n ' + '"showLogicalStructure": true,
\n "showToString": ' + 'true,
\n "maxStringLength": 0,
\n ' + ' "numericPrecision": 0,
\n "hotCodeReplace": ' + '"manual",
\n "enableRunDebugCodeLens": true,
\n ' + ' "forceBuildBeforeLaunch": true,
\n ' + '"console": "integratedTerminal"\n
}\n
},
\n ' + ' "dependency": {
\n "showMembers": false,
\n ' + ' "syncWithFolderExplorer": true,
\n ' + '"autoRefresh": true,
\n "refreshDelay": 2000,
\n ' + ' "packagePresentation": "flat"\n
},
\n ' + '"help": {
\n "firstView": "auto"\n
},
\n ' + ' "test": {
\n "report": {
\n ' + ' "showAfterExecution": "onFailure",
\n "position": ' + '"sideView"\n
},
\n "editor": {
\n ' + ' "enableShortcuts": true\n
},
\n ' + ' "log": {
\n "level": "info"\n ' + '
},
\n "message": {
\n ' + '"hintForDeprecatedConfig": true,
\n ' + '"hintForSetingDefaultConfig": true\n
},
\n ' + ' "defaultConfig": "",
\n "config": {
}\n
}\n' + '
}\n
},
\n "extendedClientCapabilities": {
\n ' + ' "progressReportProvider": true,
\n "classFileContentsSupport": ' + 'true,
\n "overrideMethodsPromptSupport": true,
\n ' + '"hashCodeEqualsPromptSupport": true,
\n ' + '"advancedOrganizeImportsSupport": true,
\n ' + '"generateToStringPromptSupport": true,
\n ' + '"advancedGenerateAccessorsSupport": true,
\n ' + '"generateConstructorsPromptSupport": true,
\n ' + '"generateDelegateMethodsPromptSupport": true,
\n ' + '"advancedExtractRefactoringSupport": true,
\n ' + '"moveRefactoringSupport": true,
\n "clientHoverProvider": true\n ' + '
},
\n "triggerFiles": [
\n ' + '"file:///c%3A/Users/hkuad/Desktop/CP/Practice/Functional.java"\n
]\n ' + '
},
\n "trace": "verbose",
\n "workspaceFolders": [
\n {
\n ' + ' "uri": "file:///c%3A/Users/hkuad/Desktop/CP/Practice",
\n ' + '"name": "Practice"\n
}\n
]\n
}\n\n',
level: 'info',
timestamp: '2020-02-20 09: 19: 13.135'
}
Can you attach the content of c:\Users\hkuad\AppData\Roaming\Code\User\workspaceStorage\c96b088e4efde1a7a0114c8383b5b363\redhat.java\jdt_ws.metadata.plugins\org.eclipse.jdt.launching (a couple xml files)
@hkuadithya You can also try to call Java: Clean the Java language server workspace
@fbricon @snjeza Yes, "Java: Clean the Java language server workspace" worked. I suppose it's some language server caching issue. I also recently updated my JDK from JDK9 to JDK13. Not sure if that caused this problem.
Let me know if you guys need anything else for the RCA of this issue. Please feel free to close this issue. Just keeping it open on my end if you guys decide to RCA this.
@snjeza the default JDK should have been updated to JDK 13, so something's still not right here. Please investigate.
To make sure I'm not jumping the guns, @hkuadithya how did you change the JDK version exactly? via java.home?
@fbricon Maybe this will help you reproduce the issue:-
Before updating JDK: I created a new folder and added new file Functional.java
I was able to build and run without any issues. Since it was JDK9, my code didn't have any var
data type
I uninstalled old Java, updated my JDK to 13, updated the path in environment variables and restarted the system
Opened VSCode, and added var
to code to test type inference. Build and compilation failed. javac
worked though
I thought that vscode wasn't picking the right Java version or maybe JDK13 wasn't supported yet since it was released recently.
I checked "Configure Java runtime"and saw that JDK13 path was already present under option 4 (source: other).
I added the same path for option 1 under user settings json hoping that it would force the language server to pick the features from latest JDK. Restarted vscode and tested. That didn't work either.
TLDR; vscode had automatically detected the jdk path under "other". I also added the path to option 1 "Java.home" hoping that language server would refresh. That's why I think it's an issue with the language server caching. Although, ideally the cache must be invalidated when the Java version is changed.
I can't reproduce the issue. See https://www.screencast.com/t/Wivjt8ccVES
@fbricon @snjeza Looks like this is an isolated case/issue which occurs under some weird set of circumstances. I couldn't find any other issues resembling this under Open Issues. You folks could focus more time and resources on this if similar issues are opened in future.
I will close this issue for now. Thank you for investigating this. Please reopen if this warrants further investigation.
Issue Type: Bug
VSCode Java extension seems to raise error while using
var
data type (type inference for local variables was introduced way back with Java 10). Running the project also seems to fail while usingvar
datatype.There's absolutely no problem with my Java environment. Compiling and running the same Java file using
javac
andjava
succeeds in command line. This works fine with IntelliJ IDEA as well. Please check the screenshots of the error and Configure java runtime.Is there some setting or configuration I need to change?
Java environment details:
Error
Configure java runtime - JDK 13
Extension version: 0.8.1 VS Code version: Code 1.42.1 (c47d83b293181d9be64f27ff093689e8e7aed054, 2020-02-11T14:45:59.656Z) OS version: Windows_NT x64 10.0.18362
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2904)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.91GB (8.79GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|