From 2277fdb5242000f9276ccf6586ee1e4af3ce0e87 Mon Sep 17 00:00:00 2001 From: Kay J Date: Sat, 21 Oct 2023 14:35:48 +0200 Subject: [PATCH] Avoid StackOverflowError in TypeUtils#resolveGenerics Fall back to the result of `ensureBaseType` when the generic variable is declared in the same class as it is used. --- .../src/com/google/web/bindery/autobean/vm/impl/TypeUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user/src/com/google/web/bindery/autobean/vm/impl/TypeUtils.java b/user/src/com/google/web/bindery/autobean/vm/impl/TypeUtils.java index b6964b2731e..c52face025f 100644 --- a/user/src/com/google/web/bindery/autobean/vm/impl/TypeUtils.java +++ b/user/src/com/google/web/bindery/autobean/vm/impl/TypeUtils.java @@ -207,6 +207,9 @@ public Type[] getActualTypeArguments() { Object genericDeclaration = variable.getGenericDeclaration(); if (genericDeclaration instanceof Class) { Class declaration = (Class) genericDeclaration; + if (declaration.equals(containingType)) { + return ensureBaseType(type); + } // could probably optimize, but would involve duplicating a bunch of // getParameterization's code Type[] types = getParameterization(declaration, containingType);