This is an automated email from the ASF dual-hosted git repository.

jlmonteiro 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 a030a3ec Revert "feat(#419): filter out static methods from records"
a030a3ec is described below

commit a030a3ec8f4efa46223888a85ef3cc1085ec09c1
Author: Jean-Louis Monteiro <[email protected]>
AuthorDate: Wed Jul 2 22:13:00 2025 +0200

    Revert "feat(#419): filter out static methods from records"
    
    This reverts commit 1cff66fe75c5d0fac9d949cf8ecea8a47e610bda.
---
 .../org/apache/johnzon/jsonb/JsonbRecordTest.java  | 39 ----------------------
 .../johnzon/mapper/access/MethodAccessMode.java    |  2 --
 2 files changed, 41 deletions(-)

diff --git 
a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbRecordTest.java 
b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbRecordTest.java
index 86847023..16397c8a 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbRecordTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbRecordTest.java
@@ -24,8 +24,6 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import jakarta.json.bind.annotation.JsonbProperty;
-
-import java.time.LocalDate;
 import java.util.Objects;
 
 import static org.junit.Assert.assertEquals;
@@ -86,41 +84,4 @@ public class JsonbRecordTest {
             return Objects.hash(age, name);
         }
     }
-
-    @Test
-    public void roundTripWithActualJavaRecord() {
-        final var ref = new Person("john", LocalDate.of(1904, 12, 25));
-        final String expectedJson = 
"{\"age\":121,\"birthday\":\"1904-12-25\",\"name\":\"john\"}";
-        assertEquals(expectedJson, jsonb.toJson(ref));
-        assertEquals(ref, jsonb.fromJson(expectedJson, Person.class));
-    }
-
-    public record Person (String name, LocalDate birthday) {
-        public int age() {
-            return LocalDate.now().getYear() - birthday.getYear();
-        }
-
-        public static Builder builder() {
-            return new Builder();
-        }
-
-        public static class Builder {
-            private String name;
-            private LocalDate birthday;
-
-            public Builder name(String name) {
-                this.name = name;
-                return this;
-            }
-
-            public Builder birthday(LocalDate birthday) {
-                this.birthday = birthday;
-                return this;
-            }
-
-            public Person build() {
-                return new Person(name, birthday);
-            }
-        }
-    }
 }
diff --git 
a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/MethodAccessMode.java
 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/MethodAccessMode.java
index 64bdcf31..79e07acc 100644
--- 
a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/MethodAccessMode.java
+++ 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/access/MethodAccessMode.java
@@ -26,7 +26,6 @@ import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.HashMap;
@@ -55,7 +54,6 @@ public class MethodAccessMode extends BaseAccessMode {
             readers.putAll(Stream.of(clazz.getMethods())
                 .filter(it -> it.getDeclaringClass() != Object.class && 
it.getParameterCount() == 0)
                 .filter(it -> !"toString".equals(it.getName()) && 
!"hashCode".equals(it.getName()))
-                .filter(it -> !Modifier.isStatic(it.getModifiers()))
                 .filter(it -> !isIgnored(it.getName()) && 
Meta.getAnnotation(it, JohnzonAny.class) == null)
                 .collect(toMap(m -> extractKey(m.getName(), m, null), it -> 
new MethodReader(it, it.getGenericReturnType()))));
         } else {

Reply via email to