You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type argument inference crash: lambda passed as Supplier<? extends List<? extends T>> to a ? extends target #2159
WildcardSupplier.java:11: error: [type.argument.inference.crashed] Type argument inference crashed for WildcardSupplier.defer
List<? extends Number> x = defer(() -> new ArrayList<Integer>());
^
error: An exception occurred: False bound for: Constraint: inference type: capture#864 of ? extends T <: Number Result: FALSE
With -AconvertTypeArgInferenceCrashToWarning=false, the exception is thrown from:
FalseBoundException: False bound for: Constraint: inference type: capture#557 of ? extends T <: Number Result: FALSE
at ...typeinference8.constraint.ConstraintSet.reduceOneStep(ConstraintSet.java:458)
at ...typeinference8.bound.BoundSet.incorporateToFixedPoint(BoundSet.java:365)
at ...typeinference8.InvocationTypeInference.createB3(InvocationTypeInference.java:444)
at ...typeinference8.InvocationTypeInference.infer(InvocationTypeInference.java:170)
at ...typeinference8.DefaultTypeArgumentInference.inferTypeArgs(DefaultTypeArgumentInference.java:108)
No crash with a method reference, a Supplier variable, or null as the argument; with Supplier<List<? extends T>> or Supplier<? extends List<T>> as the parameter type; or with List<Number>, List<?>, or List<? super Integer> as the target. Also reproduces with the Interning and Tainting Checkers.
Found in micrometer: StatsdMeterRegistry.java:276/285 (retry(Mono.defer(() -> { … return Mono.empty(); })) with a Mono<? extends …> parameter). Possibly related: #2032 (fixed; same capture of ? extends T <: … shape), but this still crashes on master.
Two smaller programs fail on the same kind of constraint (capture of ? extends T <: …) with no lambda. They crash at different places in InvocationTypeInference.createB3, so they may not share a root cause with the original.
NoLambda.java:9: error: [type.argument.inference.crashed] Type argument inference crashed for NoLambda.make
Box<? extends Box<? extends String>> b = make();
^
error: An exception occurred: False bound for: Constraint: inference type: capture#485 of ? extends T <: String Result: FALSE
FalseBoundException: False bound for: Constraint: inference type: capture#154 of ? extends T <: String Result: FALSE
at ...typeinference8.constraint.ConstraintSet.reduceOneStep(ConstraintSet.java:458)
at ...typeinference8.constraint.ConstraintSet.reduce(ConstraintSet.java:391)
at ...typeinference8.bound.CaptureBound.incorporate(CaptureBound.java:156)
at ...typeinference8.bound.CaptureBound.createAndIncorporateCaptureConstraint(CaptureBound.java:111)
at ...typeinference8.InvocationTypeInference.createB3(InvocationTypeInference.java:381)
Single wildcard inside java.util.function.Function:
FunctionReturn.java:11: error: [type.argument.inference.crashed] Type argument inference crashed for FunctionReturn.make
error: An exception occurred: False bound for: Constraint: inference type: capture#4 of ? extends T <: String Result: FALSE
FalseBoundException: False bound for: Constraint: inference type: capture#360 of ? extends T <: String Result: FALSE
at ...typeinference8.constraint.ConstraintSet.reduceOneStep(ConstraintSet.java:458)
at ...typeinference8.constraint.ConstraintSet.reduce(ConstraintSet.java:391)
at ...typeinference8.InvocationTypeInference.createB3(InvocationTypeInference.java:443)
The second one also crashes with java.util.function.Supplier. It does not crash with a user-defined functional interface interface Fn<A, B> { B apply(A a); }, or with a single Box<Box<? extends T>>.
Spring-framework sites with this failure:
Mono.defer(() -> …) passed to switchIfEmpty(Mono<? extends T>) or concatWith(Publisher<? extends T>): TransactionAspectSupport.java:981, LiteWebJarsResourceResolver.java:74/90, VersionResourceResolver.java:165 and AbstractCharSequenceDecoder.java:107.
onErrorResume(predicate, exceptionWrappingFunction(response)), where the method returns Function<Throwable, Mono<? extends T>>: DefaultWebClient.java:672. This is the FunctionReturn shape.
Activity
aosen-xiong commentedon Sep 26, 2026
Two smaller programs fail on the same kind of constraint (
capture of ? extends T <: …) with no lambda. They crash at different places inInvocationTypeInference.createB3, so they may not share a root cause with the original.Double wildcard in a return type:
Single wildcard inside
java.util.function.Function:The second one also crashes with
java.util.function.Supplier. It does not crash with a user-defined functional interfaceinterface Fn<A, B> { B apply(A a); }, or with a singleBox<Box<? extends T>>.Spring-framework sites with this failure:
Mono.defer(() -> …)passed toswitchIfEmpty(Mono<? extends T>)orconcatWith(Publisher<? extends T>):TransactionAspectSupport.java:981,LiteWebJarsResourceResolver.java:74/90,VersionResourceResolver.java:165andAbstractCharSequenceDecoder.java:107.onErrorResume(predicate, exceptionWrappingFunction(response)), where the method returnsFunction<Throwable, Mono<? extends T>>:DefaultWebClient.java:672. This is theFunctionReturnshape.then(Mono.defer(() -> x.then(Mono.defer(() -> Mono.empty())))):AbstractReactiveTransactionManager.java:506.aosen-xiong commentedon Sep 28, 2026
On master
aea76ae, this still causes type-argument inference crashes in micrometer (2 sites) and spring-framework (7 sites).