johnzon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [johnzon] branch master updated: [JOHNZON-338] ensure records don't have to be public to be deserialized
Date Thu, 25 Mar 2021 09:18:45 GMT
This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new 194f02b  [JOHNZON-338] ensure records don't have to be public to be deserialized
194f02b is described below

commit 194f02bf87ad497ef90318e146f5d2615c1c625b
Author: Romain Manni-Bucau <rmannibucau@gmail.com>
AuthorDate: Thu Mar 25 10:18:40 2021 +0100

    [JOHNZON-338] ensure records don't have to be public to be deserialized
---
 .../src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java       | 2 +-
 .../main/java/org/apache/johnzon/mapper/access/BaseAccessMode.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java
index 363f9b6..cc03e7b 100644
--- a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java
+++ b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java
@@ -307,7 +307,7 @@ public class JsonbAccessMode implements AccessMode, Closeable {
                         Stream.of(clazz.getDeclaredMethods()),
                         clazz.getSuperclass() == null || clazz.getSuperclass() == Object.class
|| clazz.getSuperclass() == clazz ?
                                 Stream.empty() :
-                                findPotentialFactoryMethods(clazz)));
+                                findPotentialFactoryMethods(clazz.getSuperclass())));
     }
 
     private Factory methodFactory(final Class<?> clazz, final Method finalFactory,
diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/BaseAccessMode.java
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/BaseAccessMode.java
index 7bd011e..071af16 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/BaseAccessMode.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/BaseAccessMode.java
@@ -268,8 +268,8 @@ public abstract class BaseAccessMode implements AccessMode {
         };
     }
 
-    private Constructor<?> findRecordConstructor(Class<?> clazz) {
-        return Stream.of(clazz.getConstructors())
+    private Constructor<?> findRecordConstructor(final Class<?> clazz) {
+        return Stream.of(clazz.getDeclaredConstructors())
                 .max(comparing(Constructor::getParameterCount))
                 .map(c -> {
                     if (!c.isAccessible()) {

Mime
View raw message