Revert "feat(#419): filter out static methods from records"
This reverts commit 1cff66fe75c5d0fac9d949cf8ecea8a47e610bda.
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 8684702..16397c8 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.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 @@
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 64bdcf3..79e07ac 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.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 @@
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 {