From 7d6af70ae1ddef3df6b494fa7d09bb058abfe453 Mon Sep 17 00:00:00 2001 From: Dave Holoway Date: Sun, 7 Jun 2020 15:12:43 +0100 Subject: [PATCH] allow null to be cast to any non-primitve --- langserver/java/body-parser3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/langserver/java/body-parser3.js b/langserver/java/body-parser3.js index b9b6f06..ce3e782 100644 --- a/langserver/java/body-parser3.js +++ b/langserver/java/body-parser3.js @@ -1072,6 +1072,10 @@ function isTypeCastable(source_type, cast_type) { // everything is castable to Object return true; } + if (source_type instanceof NullType) { + // null is castable to any non-primitive + return !(cast_type instanceof PrimitiveType); + } if (source_type instanceof CEIType && cast_type instanceof CEIType) { if (source_type.typeKind === 'interface') { // interfaces are castable to any non-final class type (derived types might implement the interface)