Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly record Optionals containing custom classes #8745

Merged
merged 1 commit into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ ResultHandle createValue(MethodContext creator, MethodCreator method, ResultHand
if (val.isPresent()) {
DeferredParameter res = loadObjectInstance(val.get(), existing, Object.class);
return new DeferredArrayStoreParameter() {

@Override
void doPrepare(MethodContext context) {
res.prepare(context);
super.doPrepare(context);
}

@Override
ResultHandle createValue(MethodContext context, MethodCreator method, ResultHandle array) {
return method.invokeStaticMethod(ofMethod(Optional.class, "of", Optional.class, Object.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ public void testObjects() throws Exception {
TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
recorder.object(emptyOptional);
}, emptyOptional);
Optional<TestJavaBean> optionalWithCustomClass = Optional.of(new TestJavaBean());
runTest(generator -> {
TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
recorder.object(optionalWithCustomClass);
}, optionalWithCustomClass);
URL url = new URL("https://quarkus.io");
runTest(generator -> {
TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
Expand Down