Treated "Object" as universally compatible in JS (methods requiring int accepts Object)

This commit is contained in:
bigguy345 committed 2026-03-05 13:53:01 +02:00
1 parent 5899ea7932
commit 131f0e2d74
1 file changed
+5 -3
@@ -43,9 +43,11 @@ public final class TypeChecker {
if ("any".equals(expected.getFullName()) || "any".equals(actual.getFullName())) {
return true;
}
// In JavaScript mode, treat java.lang.Object as "any"
if (isJavaScriptMode() && "Object".equals(expected.getSimpleName())) {
return true;
if (isJavaScriptMode()) {
// Treat java.lang.Object as "any", universally compatible
if ("Object".equals(expected.getSimpleName()) || "Object".equals(actual.getSimpleName()) )
return true;
}
// Handle null literal - null is compatible with any reference type (non-primitive)