Removed 3 deprecated methods (all were superseded by GenericContext)

This commit is contained in:
bigguy345 committed 2026-03-10 15:30:22 +02:00
1 parent 9368c889d7
commit dbc276daa7
2 files changed
-81

No files matched your search

@@ -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.
@@ -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<T>") 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<String, TypeInfo> 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);
}
}