You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by rz...@apache.org on 2026/08/20 10:38:28 UTC
(openjpa) branch OPENJPA-2981 created (now 1cc206da5)
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a change to branch OPENJPA-2981
in repository https://gitbox.apache.org/repos/asf/openjpa.git
at 1cc206da5 [OPENJPA-2981] Remove dead access-type helper methods
This branch includes the following new commits:
new 1cc206da5 [OPENJPA-2981] Remove dead access-type helper methods
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(openjpa) 01/01: [OPENJPA-2981] Remove dead access-type helper methods
Posted by rz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch OPENJPA-2981
in repository https://gitbox.apache.org/repos/asf/openjpa.git
commit 1cc206da5981d91defff2c26654603c4cdc6747e
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Thu Aug 20 12:33:57 2026 +0200
[OPENJPA-2981] Remove dead access-type helper methods
Remove the private helpers hasMixedAnnotations(Class, OpenJPAConfiguration),
hasFieldStrategyAnnotations(Class) and hasGetterStrategyAnnotations(Class) from
PersistenceMetaDataDefaults. All three were private and had no callers anywhere
in the code base.
They were added in b53766529 ("[OPENJPA-2940] Allow mixed FIELD+PROPERTY
annotation placement without @Access") as a draft shape of the mixed-annotation
access resolution; the version that actually shipped in that commit was written
inline in determineImplicitAccessType(...), so the helpers were unused from the
moment they were introduced. Commit 58ffe9c53 ("[OPENJPA-2940] Fix
AccessDefiningFilter for dual-annotated entities and mappedBy resolution") then
rewrote that inline logic and removed the last live uses of the
accessTypeFilter field, leaving its only remaining references inside the dead
helpers.
Consequently the accessTypeFilter field and the AccessTypeFilter nested filter
class, which after that rework are reachable only from the removed methods, are
dropped as well. No other member or import becomes unused.
Raised in review of PR 144.
---
.../persistence/PersistenceMetaDataDefaults.java | 58 ----------------------
1 file changed, 58 deletions(-)
diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
index 5e8cf4b7e..026cddd84 100644
--- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
+++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
@@ -143,7 +143,6 @@ public class PersistenceMetaDataDefaults
protected MemberFilter methodFilter = new MemberFilter(Method.class);
protected TransientFilter nonTransientFilter = new TransientFilter(false);
protected AnnotatedFilter annotatedFilter = new AnnotatedFilter();
- protected AccessTypeFilter accessTypeFilter = new AccessTypeFilter();
protected GetterFilter getterFilter = new GetterFilter();
protected SetterFilter setterFilter = new SetterFilter();
private Boolean _isAbstractMappingUniDirectional = null;
@@ -526,42 +525,6 @@ public class PersistenceMetaDataDefaults
return AccessCode.UNKNOWN;
}
- /**
- * Checks whether the given class has JPA annotations on both fields AND
- * getters, indicating mixed annotation placement.
- */
- private boolean hasMixedAnnotations(Class<?> cls, OpenJPAConfiguration conf) {
- Field[] allFields = cls.getDeclaredFields();
- Method[] methods = cls.getDeclaredMethods();
- List<Field> fields = filter(allFields, new TransientFilter(true));
- getterFilter.setIncludePrivate(
- conf.getCompatibilityInstance().getPrivatePersistentProperties());
- List<Method> getters = filter(methods, getterFilter);
- fields = filter(fields, annotatedFilter);
- getters = filter(getters, annotatedFilter);
- List<Method> setters = filter(methods, setterFilter);
- getters = matchGetterAndSetter(getters, setters);
- return !fields.isEmpty() && !getters.isEmpty();
- }
-
- private boolean hasFieldStrategyAnnotations(Class<?> cls) {
- for (Field f : cls.getDeclaredFields()) {
- if (accessTypeFilter.includes(f)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean hasGetterStrategyAnnotations(Class<?> cls) {
- for (Method m : cls.getDeclaredMethods()) {
- if (accessTypeFilter.includes(m)) {
- return true;
- }
- }
- return false;
- }
-
/**
* Explicit access type, if any, is generally detected by the parser. This
* is only used for metadata of an embeddable type which is encountered
@@ -1155,27 +1118,6 @@ public class PersistenceMetaDataDefaults
}
}
- /**
- * Filter that includes only members annotated with access-type-determining
- * annotations: persistence strategy annotations (@Id, @Basic, @ManyToOne, etc.),
- * @Version, and @EmbeddedId. Supplementary annotations like @Column,
- * @JoinColumn, @Enumerated do NOT determine the access type per JPA spec.
- */
- static class AccessTypeFilter implements InclusiveFilter<AnnotatedElement> {
- @Override
- public boolean includes(AnnotatedElement obj) {
- for (Annotation anno : obj.getAnnotations()) {
- Class<?> type = anno.annotationType();
- if (_strats.containsKey(type)
- || type == Id.class
- || type == Version.class) {
- return true;
- }
- }
- return false;
- }
- }
-
private void logNoSetter(ClassMetaData meta, String name, Exception e) {
Log log = meta.getRepository().getConfiguration()
.getLog(OpenJPAConfiguration.LOG_METADATA);