Skip to content

Regression in 3.13.0.CR1: Lambda expression from custom serializable interface used as @QuarkusTest method parameter fails with ClassNotFoundException #42006

Closed
@famod

Description

@famod

Describe the bug

Up until 3.12.3 you can create a lambda expression from something like:

    public interface SerializableCustom extends Serializable {
        String get();
    }

and pass it over to a @QuarkusTest method as a parameter, e.g.:

@QuarkusTest
public class LambdaParamTest {

    @ParameterizedTest
    @ArgumentsSource(LambdaProvider.class)
    void test(final SerializableCustom lambda) {
        // ...
    }

    private static class LambdaProvider implements ArgumentsProvider {

        @Override
        public Stream<? extends Arguments> provideArguments(final ExtensionContext context) {
            return Stream.of(Arguments.of((SerializableCustom) () -> "foobar"));
        }
    }

but with 3.13.0.CR1 you'll get:

java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.acme.LambdaParamTest$LambdaProvider$$Lambda/0x00007fa1844f3158
	at io.quarkus.test.junit.internal.NewSerializingDeepClone.clone(NewSerializingDeepClone.java:132)
	[...]

Expected behavior

Cloning works for lambdas created from custom serializable interfaces.

Actual behavior

Exception is thrown.

How to Reproduce?

q_test-lambda.zip

  • ./mvnw clean test fails
  • ./mvnw clean test -Dquarkus.platform.version=3.12.3 passes

Note that the reproducer also includes a working lambda example for both versions (using a subclass of java.util.function.Supplier<T>).

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.13.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

I suppose this is related to #40906, /cc @holly-cummins

Workaround: Use anonymous class instead.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions