Repository navigation
Qute: require the index parameter for list get/take/takeLast - #56460
Conversation
mkouba
left a comment
There was a problem hiding this comment.
Good catch!
Could you pls verify if the same behavior applies in a regular Quarkus app, where CollectionTemplateExtensions is used instead? See also io.quarkus.qute.deployment.extensions.CollectionTemplateExtensionsTest.
This comment has been minimized.
This comment has been minimized.
|
@MaxFreedomPollard Could you pls squash the commits? |
The switch in ValueResolvers.listResolveAsync() has no exit for the case
where get(), take() or takeLast() is used without exactly one parameter,
so execution falls through to the "first" case. As a result {list.get},
{list.take} and {list.takeLast} silently render the first element of the
list, and throw a bare NoSuchElementException when the list is empty.
Each of the three cases now returns a not-found result when the index
parameter is missing. That matches the array and map resolvers, which
already report an error, and it matches
ListResolver.getSupportedProperties(), which only advertises
get/take/takeLast as virtual methods taking an index.
Cover the fix in ListResolverTest, and pin the matching behaviour of a
Quarkus application in CollectionTemplateExtensionsTest, where the
generated value resolvers for CollectionTemplateExtensions already
require the index parameter.
14ee767 to
843f21e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@MaxFreedomPollard The JVM Tests - JDK 25 Semeru failure might be related - it seems that |
|
You are right that devtools/config-doc-maven-plugin depends on qute-core. That module's tests already ran green on Semeru with exactly this code: in attempt 2 of run 34483536314 (job 103306858514, same head sha 843f21e) the log shows In attempt 3 (job 103868355327) the fork died before it loaded a test class. Surefire printed The module's only test class, GenerateConfigDocMojoTest, calls |
|
@MaxFreedomPollard I triggered a re-run for JVM Tests - JDK 25 Semeru. We'll see. Thanks! |
|
Semeru tests are quite unstable. If all other JVM tests are passing, I would say go for it. |
Status for workflow
|
| Status | Name | Step | Failures | Logs | Raw logs | Build scan |
|---|---|---|---|---|---|---|
| ❌ | Oracle Test Pilot 19c-atps - JDK 21 | Build |
Logs | Raw logs | 🚧 | |
| ❌ | PQC Tests | Set up JDK 21 |
Logs | Raw logs | 🚧 |
You can consult the Develocity build scans.
Flaky tests - Develocity
⚙️ JVM Tests - JDK 25 Semeru
📦 extensions/info/deployment
❌ io.quarkus.info.deployment.NoGitProjectInfoTest.test - History
1 expectation failed. JSON path git doesn't match. Expected: is null Actual: <{branch=7dc2bc05803b53c0deb19b925629f185efd32e89, commit={id=7dc2bc05803b53c0deb19b925629f185efd32e89, time=2026-09-10T13:34:55Z}}>-java.lang.AssertionError
Details
java.lang.AssertionError:
1 expectation failed.
JSON path git doesn't match.
Expected: is null
Actual: <{branch=7dc2bc05803b53c0deb19b925629f185efd32e89, commit={id=7dc2bc05803b53c0deb19b925629f185efd32e89, time=2026-09-10T13:34:55Z}}>
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:344)
at io.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure.validate(ResponseSpecificationImpl.groovy:516)
{list.get},{list.take}and{list.takeLast}render the first element of the list instead of failing. The switch inValueResolvers.listResolveAsync()guards each of those three cases withif (context.getParams().size() == 1)and has nothing after theif, so when the index parameter is missing execution falls through tocase ListResolver.FIRSTand returnslist.get(0). On an empty list the same fall-through throws a bareNoSuchElementExceptionout of the render call.Each case now returns a not-found result when there is no index parameter, so you get the usual
Property "get" not found on the base objecterror instead. Arrays and maps already report an error here, andListResolver.getSupportedProperties()only advertisesfirst,lastand the index, sogetwas never meant to resolve as a property.The new test in
ListResolverTestfails on main and passes with the change;./mvnw install -f independent-projects/qute/is green.