Java 21 [#96932](https://github.com/elastic/elasticsearch/pull/96932) (`-Druntime.java=21`) breaks `java.util.List` lookups in Painless scripts.

```
invalid foreach loop: method [java.util.List, iterator/0] not found
member method [java.util.List, add/1] not found
member method [java.util.List, asCollection/0] not found
member method [java.util.List, asList/0] not found
member method [java.util.List, isEmpty/0] not found
member method [java.util.List, size/0] not found
member method [java.util.List, stream/0] not found
```

`:modules:lang-painless:test` (57 failures): https://gradle-enterprise.elastic.co/s/dkpi5pcitruwy
`:modules:lang-painless:yamlRestTest` (6 failures) https://gradle-enterprise.elastic.co/s/rsf3522r44ilc

```
java -version
openjdk version "21-ea" 2023-09-19
OpenJDK Runtime Environment (build 21-ea+27-2343)
OpenJDK 64-Bit Server VM (build 21-ea+27-2343, mixed mode, sharing)
```

Refs: https://github.com/elastic/elasticsearch/issues/96997
modules/lang-painless/src/main/java/org/elasticsearch/painless/lookup/PainlessLookup.java
Map<String, Class<?>> canonicalClassNamesToClasses,
        Map<Class<?>, PainlessClass> classesToPainlessClasses,
        Map<Class<?>, Set<Class<?>>> classesToDirectSubClasses,
        Map<String, PainlessMethod> painlessMethodKeysToImportedPainlessMethods,
        Map<String, PainlessClassBinding> painlessMethodKeysToPainlessClassBindings,
        Map<String, PainlessInstanceBinding> painlessMethodKeysToPainlessInstanceBindings
    ) {
        this.javaClassNamesToClasses = Map.copyOf(javaClassNamesToClasses);
        this.canonicalClassNamesToClasses = Map.copyOf(canonicalClassNamesToClasses);
        this.classesToPainlessClasses = Map.copyOf(classesToPainlessClasses);
        this.classesToDirectSubClasses = Map.copyOf(classesToDirectSubClasses);
        this.painlessMethodKeysToImportedPainlessMethods = Map.copyOf(painlessMethodKeysToImportedPainlessMethods);
        this.painlessMethodKeysToPainlessClassBindings = Map.copyOf(painlessMethodKeysToPainlessClassBindings);
        this.painlessMethodKeysToPainlessInstanceBindings = Map.copyOf(painlessMethodKeysToPainlessInstanceBindings);
    }
    public Class<?> javaClassNameToClass(String javaClassName) {
        return javaClassNamesToClasses.get(javaClassName);
    }
    public boolean isValidCanonicalClassName(String canonicalClassName) {
        Objects.requireNonNull(canonicalClassName);
        return DEF_CLASS_NAME.equals(canonicalClassName) || canonicalClassNamesToClasses.containsKey(canonicalClassName);
    }
    public Class<?> canonicalTypeNameToType(String canonicalTypeName) {
        Objects.requireNonNull(canonicalTypeName);
        return PainlessLookupUtility.canonicalTypeNameToType(canonicalTypeName, canonicalClassNamesToClasses);
    }
    public Set<Class<?>> getClasses() {
        return classesToPainlessClasses.keySet();
    }
    public Set<Class<?>> getDirectSubClasses(Class<?> superClass) {