Home > Back-end >  Java Code compiles using Maven but not using VS Code
Java Code compiles using Maven but not using VS Code

Time:10-28

I am supporting a Java 1.8 project (I know, I can see the eyes rolling)

The code base compiles using Maven with no error. Using VS Code there is an error. In order to resolved the error an import is required to access an inner class of a parent class in the current type hierarchy.

The version of Java is enforced by using the Maven Enforcer plugin. And VS Code is correctly configured also.

Java 1.8 configured for project

I think this has started to happened in the last 2 weeks, so I suspect an update to VS Code or an extension is likely to be the cause of the problem.

CodePudding user response:

It was a bug in a VS Extension. (Which extension or the exact nature of the bug I am unsure. A colleague directed me to this fix.)

To get around this I added the following to the settings.json:

"java.compile.nullAnalysis.nonnull": [],
"java.compile.nullAnalysis.nullable": [],
  • Related