diff --git a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/js_parser/JSTypeInfo.java b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/js_parser/JSTypeInfo.java index 0926ceafe..a13c54ddb 100644 --- a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/js_parser/JSTypeInfo.java +++ b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/js_parser/JSTypeInfo.java @@ -204,31 +204,6 @@ public class JSTypeInfo { } } - /** - * Resolves a type parameter to its bound TypeInfo. - * For example, if this type has "T extends EntityPlayerMP", resolveTypeParam("T") returns the TypeInfo for EntityPlayerMP. - * If no type parameter is found with that name, returns null. - */ - public TypeInfo resolveTypeParamToTypeInfo(String typeName) { - TypeParamInfo param = getTypeParam(typeName); - if (param != null) { - return param.getBoundTypeInfo(); - } - return null; - } - - /** - * Resolves a type parameter to its bound type name (for backward compatibility). - * @deprecated Use resolveTypeParamToTypeInfo instead - */ - @Deprecated - public String resolveTypeParam(String typeName) { - TypeParamInfo param = getTypeParam(typeName); - if (param != null && param.getBoundTypeInfo() != null) { - return param.getBoundTypeInfo().getSimpleName(); - } - return typeName; - } /** * Get a method by name, including inherited methods. diff --git a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/type/TypeSubstitutor.java b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/type/TypeSubstitutor.java index 514174743..3ee5f6263 100644 --- a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/type/TypeSubstitutor.java +++ b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/type/TypeSubstitutor.java @@ -138,60 +138,4 @@ public class TypeSubstitutor { return type; } - /** - * Substitute type variables in a type string using the given bindings. - * Used when we have a raw type string (like "T" or "List") that needs substitution. - * - * @param typeString The raw type string - * @param bindings The map from type variable names to concrete types - * @param resolver The type resolver to use for parsing - * @return The substituted TypeInfo - */ - public static TypeInfo substituteString(String typeString, Map bindings, TypeResolver resolver) { - if (typeString == null || typeString.isEmpty()) { - return null; - } - - // First check if the whole string is a type variable - String trimmed = TypeStringNormalizer.stripImportTypeSyntax(typeString); - trimmed = TypeStringNormalizer.pickPreferredUnionBranch(trimmed); - trimmed = TypeStringNormalizer.stripNullableSuffix(trimmed); - - TypeStringNormalizer.ArraySplit arraySplit = TypeStringNormalizer.splitArraySuffixes(trimmed); - String baseName = arraySplit.base; - int arrayDims = arraySplit.dimensions; - - // Strip generic args to check the base name - String bareBaseName = GenericTypeParser.stripGenerics(baseName); - - // If bare base name is a type variable, substitute - TypeInfo directSubstitution = bindings.get(bareBaseName); - if (directSubstitution != null) { - // It's a type variable, return the substitution - TypeInfo result = directSubstitution; - for (int i = 0; i < arrayDims; i++) { - result = TypeInfo.arrayOf(result); - } - return result; - } - - // Parse and resolve the type, then substitute within it - TypeInfo resolved = resolver.resolveJSType(typeString); - return substitute(resolved, bindings); - } - - /** - * Get the return type for a method on a parameterized receiver, with type variable substitution. - * - * @param rawReturnType The method's raw return type (may contain type variables) - * @param rawReturnTypeString The method's raw return type as a string (for unresolved types) - * @param receiverType The parameterized receiver type - * @param resolver The type resolver - * @return The substituted return type - */ - public static TypeInfo getSubstitutedReturnType(TypeInfo rawReturnType, String rawReturnTypeString, - TypeInfo receiverType, TypeResolver resolver) { - GenericContext ctx = GenericContext.forReceiver(receiverType); - return ctx.substituteType(rawReturnType, rawReturnTypeString, resolver); - } }