Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 21, 2023
2 parents 4a2f849 + 9dcc41f commit 9e86154
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ private static MethodHandle init() {
}

public static Lookup privateLookupIn(Class<?> lookup, Lookup orig) {
return Unchecked.supplier(() -> (Lookup) FACTORY.invokeExact(lookup, orig)).get();
try {
return (Lookup) FACTORY.invokeExact(lookup, orig);
} catch (ReflectiveOperationException e) {
return orig;
} catch (Throwable t) {
throw Sneaky.throwAnyway(t);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tools.jackson.module.blackbird;

import java.lang.reflect.Proxy;

import tools.jackson.databind.ObjectMapper;

public class TestAccessFallback extends BlackbirdTestBase
Expand Down Expand Up @@ -69,4 +71,19 @@ public void testDeserializeAccess() throws Exception
MyBean bean2 = abMapper.readValue(BEAN_JSON, MyBean.class);
assertEquals("a", bean2.getE());
}

public void testProxyAccessIssue181() throws Exception {
ObjectMapper om = newObjectMapper();
String val = om.writeValueAsString(Proxy.newProxyInstance(TestAccessFallback.class.getClassLoader(), new Class<?>[] { Beany.class }, (p, m, a) -> {
if (m.getName().equals("getA")) {
return 42;
}
return null;
}));
assertEquals("{\"a\":42}", val);
}

public interface Beany {
int getA();
}
}
1 change: 1 addition & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Steven Schlansker (stevenschlansker@github)
(2.12.0)
* Fixed #141: Blackbird fails to deserialize varargs array
(2.13.0)
... and many, many more (esp. to Afterburner/Blackbird projects)

Marc Magon (GedMarc@github)

Expand Down
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Active maintainers:

2.16.0 (not yet released)

#181: BlackBird proxy object error in Java 17
(fix by Steven S)

#209: Add guice7 (jakarta.inject) module
(contributed by Joe B)

Expand Down

0 comments on commit 9e86154

Please sign in to comment.