mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Made .d.ts files retain java primitive types ('int' retained as is without transforming to 'number') + necessary changes to support that
This commit is contained in:
1 parent
5c53b7e768
commit
63f6c7c045
3 files changed
+17
-2
No files matched your search
+10
-1
@@ -215,12 +215,21 @@ public final class DtsJavaBridge {
|
||||
}
|
||||
|
||||
private static boolean matchesPrimitive(String jsTypeName, Class<?> javaParam) {
|
||||
switch (jsTypeName) {
|
||||
switch (jsTypeName.toLowerCase()) {
|
||||
case "string":
|
||||
case "char":
|
||||
return javaParam == String.class || javaParam == char.class || javaParam == Character.class;
|
||||
case "boolean":
|
||||
case "bool":
|
||||
return javaParam == boolean.class || javaParam == Boolean.class;
|
||||
case "number":
|
||||
case "byte":
|
||||
case "short":
|
||||
case "int":
|
||||
case "integer":
|
||||
case "long":
|
||||
case "float":
|
||||
case "double":
|
||||
return isNumberType(javaParam);
|
||||
case "void":
|
||||
return javaParam == void.class || javaParam == Void.class;
|
||||
|
||||
+2
-1
@@ -53,7 +53,8 @@ public class JSTypeRegistry {
|
||||
|
||||
// Primitive types
|
||||
private static final Set<String> PRIMITIVES = new HashSet<>(Arrays.asList(
|
||||
"number", "string", "boolean", "void", "any", "null", "undefined", "never", "object"
|
||||
"number", "string", "boolean", "void", "any", "null", "undefined", "never", "object",
|
||||
"byte", "short", "int", "integer", "long", "float", "double", "char", "bool"
|
||||
));
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
@@ -397,6 +397,11 @@ public class TypeResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Primitives
|
||||
if (TypeResolver.isPrimitiveType(baseName)) {
|
||||
return TypeInfo.fromPrimitive(baseName);
|
||||
}
|
||||
|
||||
// Handle "Java." prefix - convert to actual Java type
|
||||
if (baseName.startsWith("Java.")) {
|
||||
baseName = baseName.substring(5);
|
||||
|
||||
Reference in new issue
Block a user