oracle/graal · error · UnsupportedOperationException
not implemented
Error message
not implemented
What it means
NodeList implements Collection<T> for API compatibility but deliberately leaves containsAll unimplemented because there is no efficient use for it on node input lists. Calling it throws UnsupportedOperationException('not implemented'), signalling an unsupported operation rather than a runtime fault. Other Collection methods like contains(Object) and addAll are implemented and should be used instead.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/NodeList.java:395
@Override
public int indexOf(Object node) {
for (int i = 0; i < size; i++) {
if (nodes[i] == node) {
return i;
}
}
return -1;
}
@Override
public boolean contains(Object o) {
return indexOf(o) != -1;
}
@Override
public boolean containsAll(Collection<?> c) {
throw new UnsupportedOperationException("not implemented");
}
@Override
public boolean addAll(Collection<? extends T> c) {
for (T e : c) {
add(e);
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append('[');
for (int i = 0; i < size; i++) {
if (i != 0) {
sb.append(", ");
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Replace containsAll with an explicit loop over the other collection using contains(Object) or indexOf(o).
- Copy the NodeList into an ArrayList before passing it to generic Collection APIs.
- For set-like semantics, build a HashSet<Node> from the list and use standard set operations.
Example fix
// before
boolean hasAll = node.inputs().containsAll(required); // UnsupportedOperationException
// after
boolean hasAll = true;
for (Node r : required) {
if (!node.inputs().contains(r)) { hasAll = false; break; }
} Defensive patterns
Strategy: validation
Validate before calling
static <T> boolean containsAll(NodeList<T> list, Collection<?> c) {
for (Object o : c) {
if (!list.contains(o)) return false;
}
return true;
} Type guard
static boolean isFullyImplementedCollection(Collection<?> c) {
try {
c.containsAll(java.util.List.of()); // cheap probe: empty containsAll still throws if unimplemented
return true;
} catch (UnsupportedOperationException e) {
return false;
}
} Prevention
- Do not hand NodeList into generic Collection utilities; copy to ArrayList first.
- Wrap node lists in your own adapter that implements the operations you actually use.
When it happens
Trigger: Calling nodeList.containsAll(other) directly, or passing a NodeList into generic Collection machinery (e.g. Collection.retainAll, removeAll, or library code like Guava's Iterables/sets utilities) that invokes containsAll internally.
Common situations: Treating node.inputList() / usages as a plain Collection in helper code. Utilities such as Collections.checkedCollection, Set operations, or test assertions (assertEquals on collections) that probe with containsAll. Copying node lists into generic algorithms.
Related errors
- isEmpty() is not supported for performance reasons
- size() is not supported for performance reasons
- Graph was permanetly frozen.
- unknown verbosity:
- NodeBitMap was modified between the calls to hasNext() and n
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/54de8d94fa3b02a5.
Report an issue: GitHub.