question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'Unnecessary' of undefined

See original GitHub issue

I’m sending this message on the LSP:

[Trace - 9:25:42 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/georgefraser/Documents/java-language-server/src/test/test-project/workspace/src/org/javacs/warn/Unused.java",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 23,
                    "character": 4
                },
                "end": {
                    "line": 23,
                    "character": 33
                }
            },
            "severity": 4,
            "code": "unused",
            "message": "`UnusedClass` is not used",
            "tags": [
                1
            ]
        },
        {
            "range": {
                "start": {
                    "line": 12,
                    "character": 8
                },
                "end": {
                    "line": 12,
                    "character": 32
                }
            },
            "severity": 2,
            "code": "unused",
            "message": "`unusedLocalInLambda` is not used",
            "tags": [
                1
            ]
        },
        {
            "range": {
                "start": {
                    "line": 15,
                    "character": 4
                },
                "end": {
                    "line": 17,
                    "character": 5
                }
            },
            "severity": 4,
            "code": "unused",
            "message": "`unusedMethod` is not used",
            "tags": [
                1
            ]
        },
        {
            "range": {
                "start": {
                    "line": 6,
                    "character": 8
                },
                "end": {
                    "line": 6,
                    "character": 28
                }
            },
            "severity": 2,
            "code": "unused",
            "message": "`unusedLocal` is not used",
            "tags": [
                1
            ]
        },
        {
            "range": {
                "start": {
                    "line": 9,
                    "character": 4
                },
                "end": {
                    "line": 9,
                    "character": 30
                }
            },
            "severity": 2,
            "code": "unused",
            "message": "`unusedPrivate` is not used",
            "tags": [
                1
            ]
        },
        {
            "range": {
                "start": {
                    "line": 21,
                    "character": 4
                },
                "end": {
                    "line": 21,
                    "character": 29
                }
            },
            "severity": 4,
            "code": "unused",
            "message": "`<init>` is not used",
            "tags": [
                1
            ]
        }
    ]
}

But I’m not seeing any green squigglies or faded backgrounds, and I’m seeing this error in the VSCode debug console:

Notification handler 'textDocument/publishDiagnostics' failed with message: Cannot read property 'Unnecessary' of undefined

I’m running version 1.31.1 of VSCode. This is what my package.json looks like:

{
    "name": "vscode-javac",
    "displayName": "Java Language Support",
    "description": "Java support using the Java Compiler API",
    "icon": "icon.png",
    "version": "0.2.14",
    "publisher": "georgewfraser",
    "repository": {
        "type": "git",
        "url": "https://github.com/georgewfraser/java-language-server"
    },
    "license": "MIT",
    "engines": {
        "vscode": "^1.31.1"
    },
    "categories": [
        "Programming Languages",
        "Linters"
    ],
    "keywords": [
        "java"
    ],
    "activationEvents": [
        "onLanguage:java"
    ],
    "main": "./out/lib/extension",
    "contributes": {
        /* removed */
    },
    "scripts": {
        "vscode:prepublish": "npm run compile",
        "compile": "tsc -p ./",
        "watch": "tsc -watch -p ./",
        "postinstall": "node ./node_modules/vscode/bin/install",
        "test": "npm run compile && node ./node_modules/vscode/bin/test"
    },
    "dependencies": {
        "vscode-languageclient": "^5.3.0-next.1"
    },
    "devDependencies": {
        "typescript": "^3.3.3333",
        "vscode": "^1.1.21",
        "@types/node": "^10.3.3",
        "@types/mocha": "^2.2.42"
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Mar 13, 2019

Fixed by publishing new next versions.

0reactions
dbaeumercommented, Mar 13, 2019

Ignore my last comment. It is a broken types dependency. Sorry for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-unnecessary-waiting: TypeError: Cannot read property 'null ...
TypeError : Cannot read property 'null' of undefined Occurred while linting /Users/ggp/dev/tw-git/saas-ui/cypress/integration/systems/settings.
Read more >
T264960 Uncaught TypeError: Cannot read property 'slice' of ...
If that's the case, it could be that there is a genuine issue here, e.g. that the element is bad and the script...
Read more >
Online Error - TypeError: Cannot read property 'SERVER' of ...
Hi everyone, I am running into this error when I try to run my study on Pavlovia through Sona - TypeError: Cannot read...
Read more >
7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
One classic example of the unnecessarily extended life of variables is the usage of for ... TypeError: Cannot read property '0' of undefined....
Read more >
TypeError: Cannot read property 'DotTip' of undefined
WordPress 5.4 – TypeError: Cannot read property 'DotTip' of undefined ... I used the WP cleaner plugin to remove unnecessary files after the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found