This change enables the script editor to display and validate generic type arguments
for method parameters that are erased to Object in Java's built-in collection interfaces.
MOTIVATION
----------
Java's Map, Collection, List, Deque, and concurrent variants use Object-typed parameters
(e.g., Map.get(Object), Collection.contains(Object)) for backward-compatibility reasons.
When the receiver is parameterized (e.g., HashMap<String, Integer>), the editor should
show get(String) instead of get(Object) to provide better hints and stricter validation.
IMPLEMENTATION
--------------
New GenericParameterAdapter utility (contract-level rules, NOT per-concrete-class):
- Covers 8 JDK collection contracts exhaustively (Map, ConcurrentMap, Collection, List,
Set, Deque, BlockingQueue, BlockingDeque)
- 35+ rules total mapping erased Object params to appropriate type arguments (K, V, or E)
- Integrated into MethodInfo.fromReflection() so all code paths (autocomplete, hover,
validation) use the same adapted parameter types
- Hover signature rendering now routes through MethodInfo for parameterized receivers,
ensuring consistency with autocomplete
Related-to: Generic type argument substitution framework (TypeSubstitutor, GenericContext)
which already applied V correctly; this extends that same mechanism to K/E for the
JDK's intentionally-erased-for-compatibility method parameters.
When the menu shrinks in windowed/cramped layouts, several paths still assumed MAX_VISIBLE_ITEMS (10) for maxScroll/hover/scrollbar calculations, making the last entries unreachable. Use the actual visible capacity (visibleItemsCount) consistently and normalize scissor Y conversion for scaled GUI coords
- add full parser/type-resolver support for Java method and constructor references
- infer SAM callback types for named JS script methods with conflict reporting
- surface argument-level SAM/type mismatch errors in method validation
Problem:
- function(act){...} expressions not reaching ExpressionParser
- resolveExpressionType only checked containsOperators() or startsWith("(")
- Function expressions went through simple resolver and returned null type
Solution:
- Added looksLikeFunctionOrLambda helper (lines 4766-4773) to detect:
* JS functions: function(...)
* Arrow functions: =>
* Java lambdas: ->
- Updated gate condition at line 4144 to route these into ExpressionParser
- Function expressions now reach ExpressionTypeResolver.resolveJSFunctionType
Impact:
- SAM typing now works in pass-2 when expected type is known
- Fixes schedule("TpGainAction", function(act){...}) argument typing
- Enables proper overload resolution for function/lambda parameters
ScriptDocument now tracks locals inside lambdas/function expressions and resolves identifiers by consulting the innermost callable scope before falling back to method/global scope.
Adds expression resolver nodes/type resolver and wires position-aware resolution for lambda bodies, plus basic lambda operator marking and return type validation against expected functional interface SAM.
List<IPlayer> list;
list.get(0) NOW returns IPlayer, instead of T or Object.
Nested generics are also handled and functional:
Map<String, List<IPlayer>>
Implemented TokenHoverInfo/Autocomplete rendering and handling for generics as well.