Skip to content

Commit

Permalink
Merge pull request #8745 from jmartisk/master-issue-8744
Browse files Browse the repository at this point in the history
Correctly record Optionals containing custom classes
  • Loading branch information
stuartwdouglas authored Apr 23, 2020
2 parents f5843d4 + d49ff54 commit 332b43d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit 332b43d

Please sign in to comment.