[openjpa] branch master updated: Revert "OPENJPA-2800 mark additional fields and methods as synthetic"

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[openjpa] branch master updated: Revert "OPENJPA-2800 mark additional fields and methods as synthetic"

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a850031  Revert "OPENJPA-2800 mark additional fields and methods as synthetic"
a850031 is described below

commit a850031d11aa7fd18e6828c9cce4fa6b2809ffdd
Author: Francesco Chicchiriccò <[hidden email]>
AuthorDate: Wed Apr 21 12:13:46 2021 +0200

    Revert "OPENJPA-2800 mark additional fields and methods as synthetic"
   
    This reverts commit 5b67ce51801cb646d772dadd03a623312603a0df.
---
 .../org/apache/openjpa/enhance/PCEnhancer.java     | 112 ++++++---------------
 1 file changed, 30 insertions(+), 82 deletions(-)

diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
index fdfb7e0..bb868dd 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
@@ -768,7 +768,6 @@ public class PCEnhancer {
         BCMethod method = _pc.declareMethod(PRE + "AttributeIndexToFieldName",
             String.class, new Class[] { int.class });
         method.makePublic();
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // switch (val)
@@ -1212,7 +1211,6 @@ public class PCEnhancer {
         BCMethod method = _pc.declareMethod(PRE + "ClearFields", void.class,
             null);
         method.makeProtected();
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // super.pcClearFields ()
@@ -1273,7 +1271,6 @@ public class PCEnhancer {
             (oid) ? new Class[]{ SMTYPE, Object.class, boolean.class }
                 : new Class[]{ SMTYPE, boolean.class };
         BCMethod method = _pc.declareMethod(PRE + "NewInstance", PCTYPE, args);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // if the type is abstract, throw a UserException
@@ -1329,7 +1326,6 @@ public class PCEnhancer {
         // protected static int pcGetManagedFieldCount ()
         BCMethod method = _pc.declareMethod(PRE + "GetManagedFieldCount",
             int.class, null);
-        method.setSynthetic(true);
         method.setStatic(true);
         method.makeProtected();
         Code code = method.getCode(true);
@@ -1363,7 +1359,6 @@ public class PCEnhancer {
         // public void pcProvideField (int fieldNumber)
         BCMethod method = _pc.declareMethod(PRE + "ProvideField", void.class,
             new Class[]{ int.class });
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // adds everything through the switch ()
@@ -1415,7 +1410,6 @@ public class PCEnhancer {
         // public void pcReplaceField (int fieldNumber)
         BCMethod method = _pc.declareMethod(PRE + "ReplaceField", void.class,
             new Class[]{ int.class });
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // adds everything through the switch ()
@@ -1482,7 +1476,6 @@ public class PCEnhancer {
             void.class.getName(),
             new String[]{ _managedType.getName(), int.class.getName() });
         method.makeProtected();
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // adds everything through the switch ()
@@ -1588,8 +1581,8 @@ public class PCEnhancer {
         // public void <method>s (int[] fields)
         Class[] args = (copy) ? new Class[]{ Object.class, int[].class }
             : new Class[]{ int[].class };
-        BCMethod method = _pc.declareMethod(single.getName() + "s", void.class, args);
-        method.setSynthetic(true);
+        BCMethod method = _pc.declareMethod(single.getName() + "s",
+            void.class, args);
         Code code = method.getCode(true);
 
         int fieldNumbers = 0;
@@ -1739,8 +1732,8 @@ public class PCEnhancer {
                         SMTYPE, "dirty", new Class[]{ String.class })), false);
 
             // pcGetStateManager
-            BCMethod meth = _pc.declareMethod(PRE + "GetStateManager", StateManager.class, null);
-            meth.setSynthetic(true);
+            BCMethod meth = _pc.declareMethod(PRE + "GetStateManager",
+                StateManager.class, null);
             Code code = meth.getCode(true);
             loadManagedInstance(code, false);
             code.getfield().setField(SM, StateManager.class);
@@ -1767,7 +1760,6 @@ public class PCEnhancer {
 
         // add the method to the pc
         BCMethod method = _pc.declareMethod(name, returnType, params);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // if (pcStateManager == null) return <default>;
@@ -1812,7 +1804,6 @@ public class PCEnhancer {
         throws NoSuchMethodException {
         BCMethod method = _pc.declareMethod(PRE + "GetVersion", Object.class,
             null);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // if (pcStateManager == null)
@@ -1881,8 +1872,8 @@ public class PCEnhancer {
      */
     private void addReplaceStateManagerMethod() {
         // public void pcReplaceStateManager (StateManager sm)
-        BCMethod method = _pc.declareMethod(PRE + "ReplaceStateManager", void.class, new Class[]{ SMTYPE });
-        method.setSynthetic(true);
+        BCMethod method = _pc.declareMethod(PRE + "ReplaceStateManager",
+            void.class, new Class[]{ SMTYPE });
         method.getExceptions(true).addException(SecurityException.class);
         Code code = method.getCode(true);
 
@@ -1925,7 +1916,6 @@ public class PCEnhancer {
         // Object oid)
         BCMethod method = _pc.declareMethod(PRE + "CopyKeyFieldsToObjectId",
             void.class, new Class[]{ OIDFSTYPE, Object.class });
-        method.setSynthetic(true);
         Code code = method.getCode(true);
         code.vreturn();
         code.calculateMaxLocals();
@@ -1933,7 +1923,6 @@ public class PCEnhancer {
         // public void pcCopyKeyFieldsToObjectId (Object oid)
         method = _pc.declareMethod(PRE + "CopyKeyFieldsToObjectId",
             void.class, new Class[]{ Object.class });
-        method.setSynthetic(true);
         code = method.getCode(true);
         code.vreturn();
         code.calculateMaxLocals();
@@ -1942,7 +1931,6 @@ public class PCEnhancer {
         // Object oid)
         method = _pc.declareMethod(PRE + "CopyKeyFieldsFromObjectId",
             void.class, new Class[]{ OIDFCTYPE, Object.class });
-        method.setSynthetic(true);
         code = method.getCode(true);
         code.vreturn();
         code.calculateMaxLocals();
@@ -1950,7 +1938,6 @@ public class PCEnhancer {
         // public void pcCopyKeyFieldsFromObjectId (Object oid)
         method = _pc.declareMethod(PRE + "CopyKeyFieldsFromObjectId",
             void.class, new Class[]{ Object.class });
-        method.setSynthetic(true);
         code = method.getCode(true);
         code.vreturn();
         code.calculateMaxLocals();
@@ -1958,7 +1945,6 @@ public class PCEnhancer {
         // public Object pcNewObjectIdInstance ()
         method = _pc.declareMethod(PRE + "NewObjectIdInstance",
             Object.class, null);
-        method.setSynthetic(true);
         code = method.getCode(true);
         code.constant().setNull();
         code.areturn();
@@ -1968,7 +1954,6 @@ public class PCEnhancer {
         // public Object pcNewObjectIdInstance (Object obj)
         method = _pc.declareMethod(PRE + "NewObjectIdInstance",
             Object.class, new Class[]{ Object.class });
-        method.setSynthetic(true);
         code = method.getCode(true);
         code.constant().setNull();
         code.areturn();
@@ -1989,7 +1974,6 @@ public class PCEnhancer {
             : new String[]{ Object.class.getName() };
         BCMethod method = _pc.declareMethod(PRE + "CopyKeyFieldsToObjectId",
             void.class.getName(), args);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // single field identity always throws exception
@@ -2485,7 +2469,6 @@ public class PCEnhancer {
             : new String[]{ Object.class.getName() };
         BCMethod method = _pc.declareMethod(PRE + "CopyKeyFieldsFromObjectId",
             void.class.getName(), args);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         // call superclass method
@@ -2741,7 +2724,6 @@ public class PCEnhancer {
         Class[] args = (obj) ? new Class[]{ Object.class } : null;
         BCMethod method = _pc.declareMethod(PRE + "NewObjectIdInstance",
             Object.class, args);
-        method.setSynthetic(true);
         Code code = method.getCode(true);
 
         Boolean usesClsString = usesClassStringIdConstructor();
@@ -2963,38 +2945,19 @@ public class PCEnhancer {
      * </ul>
      */
     private void addFields() {
-        BCField field;
-        field = _pc.declareField(INHERIT, int.class);
-        field.setStatic(true);
-        field.setSynthetic(true);
-
-        field = _pc.declareField(PRE + "FieldNames", String[].class);
-        field.setStatic(true);
-        field.setSynthetic(true);
-
-        field = _pc.declareField(PRE + "FieldTypes", Class[].class);
-        field.setStatic(true);
-        field.setSynthetic(true);
-
-        field = _pc.declareField(PRE + "FieldFlags", byte[].class);
-        field.setStatic(true);
-        field.setSynthetic(true);
-
-
-        field = _pc.declareField(SUPER, Class.class);
-        field.setSynthetic(true);
-        field.setStatic(true);
-
+        _pc.declareField(INHERIT, int.class).setStatic(true);
+        _pc.declareField(PRE + "FieldNames", String[].class).setStatic(true);
+        _pc.declareField(PRE + "FieldTypes", Class[].class).setStatic(true);
+        _pc.declareField(PRE + "FieldFlags", byte[].class).setStatic(true);
+        _pc.declareField(SUPER, Class.class).setStatic(true);
         if (_addVersionInitFlag && _meta.getVersionField() != null) {
             // protected transient boolean pcVersionInit;
-            field = _pc.declareField(VERSION_INIT_STR, boolean.class);
-            field.setSynthetic(true);
+            BCField field = _pc.declareField(VERSION_INIT_STR, boolean.class);
             field.makeProtected();
             field.setTransient(true);
         }
         if (_meta.getPCSuperclass() == null || getCreateSubclass()) {
-            field = _pc.declareField(SM, SMTYPE);
-            field.setSynthetic(true);
+            BCField field = _pc.declareField(SM, SMTYPE);
             field.makeProtected();
             field.setTransient(true);
         }
@@ -3181,7 +3144,6 @@ public class PCEnhancer {
             // private void writeObject (ObjectOutputStream out)
             write = _pc.declareMethod("writeObject", void.class,
                 new Class[]{ ObjectOutputStream.class });
-            write.setSynthetic(true);
             write.getExceptions(true).addException(IOException.class);
             write.makePrivate();
         }
@@ -3195,7 +3157,6 @@ public class PCEnhancer {
             // private void readObject (ObjectInputStream in)
             read = _pc.declareMethod("readObject", void.class,
                 new Class[]{ ObjectInputStream.class });
-            read.setSynthetic(true);
             read.getExceptions(true).addException(IOException.class);
             read.getExceptions(true).addException
                 (ClassNotFoundException.class);
@@ -3211,7 +3172,6 @@ public class PCEnhancer {
 
         // private Object writeReplace() throws ObjectStreamException
         BCMethod method = _pc.declareMethod("writeReplace", Object.class, null);
-        method.setSynthetic(true);
         method.getExceptions(true).addException(ObjectStreamException.class);
         Code code = method.getCode(true);
 
@@ -3300,7 +3260,7 @@ public class PCEnhancer {
 
     /**
      * Adds a custom readObject method that delegates to the
-     * {@link ObjectInputStream#readObject()} method.
+     * {@link ObjectInputStream#readObject} method.
      */
     private void modifyReadObjectMethod(BCMethod method, boolean full) {
         Code code = method.getCode(true);
@@ -3337,7 +3297,6 @@ public class PCEnhancer {
         // public boolean pcIsDetached()
         BCMethod method = _pc.declareMethod(PRE + "IsDetached",
             Boolean.class, null);
-        method.setSynthetic(true);
         method.makePublic();
         Code code = method.getCode(true);
         boolean needsDefinitiveMethod = writeIsDetachedMethod(code);
@@ -3350,8 +3309,8 @@ public class PCEnhancer {
         //   return false;
         // auxilliary enhancers may change the return value of this method
         // if their specs consider detached state definitive
-        method = _pc.declareMethod(ISDETACHEDSTATEDEFINITIVE, boolean.class, null);
-        method.setSynthetic(true);
+        method = _pc.declareMethod(ISDETACHEDSTATEDEFINITIVE, boolean.class,
+            null);
         method.makePrivate();
         code = method.getCode(true);
         code.constant().setValue(false);
@@ -3664,7 +3623,6 @@ public class PCEnhancer {
             // add clone method
             // protected Object clone () throws CloneNotSupportedException
             clone = _pc.declareMethod("clone", Object.class, null);
-            clone.setSynthetic(true);
             if (!setVisibilityToSuperMethod(clone))
                 clone.makeProtected();
             clone.getExceptions(true).addException
@@ -3767,8 +3725,8 @@ public class PCEnhancer {
         throws NoSuchMethodException {
         Class propType = fmd.getDeclaredType();
         String setterName = getSetterName(fmd);
-        BCMethod setter = _pc.declareMethod(setterName, void.class, new Class[] { propType });
-        setter.setSynthetic(true);
+        BCMethod setter = _pc.declareMethod(setterName, void.class,
+            new Class[] { propType });
         setVisibilityToSuperMethod(setter);
         Code code = setter.getCode(true);
 
@@ -3826,8 +3784,8 @@ public class PCEnhancer {
         String methName = "get" + StringUtil.capitalize(fmd.getName());
         if (_managedType.getMethods(methName, new Class[0]).length == 0)
             methName = "is" + StringUtil.capitalize(fmd.getName());
-        BCMethod getter = _pc.declareMethod(methName, fmd.getDeclaredType(), null);
-        getter.setSynthetic(true);
+        BCMethod getter = _pc.declareMethod(methName, fmd.getDeclaredType(),
+            null);
         setVisibilityToSuperMethod(getter);
         getter.makePublic();
         Code code = getter.getCode(true);
@@ -4004,7 +3962,6 @@ public class PCEnhancer {
             name = PRE + "DetachedState";
             declarer = _pc.getName();
             BCField field = _pc.declareField(name, Object.class);
-            field.setSynthetic(true);
             field.makePrivate();
             field.setTransient(true);
         } else if (impl) {
@@ -4013,8 +3970,8 @@ public class PCEnhancer {
         }
 
         // public Object pcGetDetachedState ()
-        BCMethod method = _pc.declareMethod(PRE + "GetDetachedState", Object.class, null);
-        method.setSynthetic(true);
+        BCMethod method = _pc.declareMethod(PRE + "GetDetachedState",
+            Object.class, null);
         method.setStatic(false);
         method.makePublic();
         int access = method.getAccessFlags();
@@ -4034,7 +3991,6 @@ public class PCEnhancer {
         // public void pcSetDetachedState (Object state)
         method = _pc.declareMethod(PRE + "SetDetachedState",
             void.class, new Class []{ Object.class });
-        method.setSynthetic(true);
         method.setAccessFlags(access);
         code = method.getCode(true);
         if (impl) {
@@ -4227,7 +4183,6 @@ public class PCEnhancer {
         throws NoSuchMethodException {
         Class[] inargs = new Class[]{ ObjectInput.class };
         BCMethod meth = _pc.declareMethod("readExternal", void.class, inargs);
-        meth.setSynthetic(true);
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
         exceps.addException(ClassNotFoundException.class);
@@ -4286,7 +4241,6 @@ public class PCEnhancer {
     private void addReadExternalFields() throws NoSuchMethodException {
         Class<?>[] inargs = new Class[]{ ObjectInput.class };
         BCMethod meth = _pc.declareMethod("readExternalFields", void.class, inargs);
-        meth.setSynthetic(true);
         meth.setAccessFlags(Constants.ACCESS_PROTECTED);
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
@@ -4321,8 +4275,8 @@ public class PCEnhancer {
     private void addReadUnmanaged(Collection unmgd, boolean parentDetachable)
         throws NoSuchMethodException {
         Class[] inargs = new Class[]{ ObjectInput.class };
-        BCMethod meth = _pc.declareMethod(PRE + "ReadUnmanaged", void.class, inargs);
-        meth.setSynthetic(true);
+        BCMethod meth = _pc.declareMethod(PRE + "ReadUnmanaged", void.class,
+            inargs);
         meth.makeProtected();
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
@@ -4407,7 +4361,6 @@ public class PCEnhancer {
         throws NoSuchMethodException {
         Class[] outargs = new Class[]{ ObjectOutput.class };
         BCMethod meth = _pc.declareMethod("writeExternal", void.class, outargs);
-        meth.setSynthetic(true);
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
         Code code = meth.getCode(true);
@@ -4479,7 +4432,6 @@ public class PCEnhancer {
         throws NoSuchMethodException {
         Class<?>[] outargs = new Class[]{ ObjectOutput.class };
         BCMethod meth = _pc.declareMethod("writeExternalFields", void.class, outargs);
-        meth.setSynthetic(true);
         meth.setAccessFlags(Constants.ACCESS_PROTECTED);
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
@@ -4513,8 +4465,8 @@ public class PCEnhancer {
     private void addWriteUnmanaged(Collection unmgd, boolean parentDetachable)
         throws NoSuchMethodException {
         Class[] outargs = new Class[]{ ObjectOutput.class };
-        BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class, outargs);
-        meth.setSynthetic(true);
+        BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class,
+            outargs);
         meth.makeProtected();
         Exceptions exceps = meth.getExceptions(true);
         exceps.addException(IOException.class);
@@ -4710,7 +4662,6 @@ public class PCEnhancer {
             BCField field = _pc.getDeclaredField(fmd.getName());
             getter = _pc.declareMethod(PRE + "Get" + fmd.getName(), fmd.
                 getDeclaredType().getName(), new String[]{ _pc.getName() });
-            getter.setSynthetic(true);
             getter.setAccessFlags(field.getAccessFlags()
                 & ~Constants.ACCESS_TRANSIENT & ~Constants.ACCESS_VOLATILE);
             getter.setStatic(true);
@@ -4726,7 +4677,6 @@ public class PCEnhancer {
             meth.getParameterTypes());
         BCMethod newgetter = _pc.declareMethod(PRE + meth.getName(),
             meth.getReturnType(), meth.getParameterTypes());
-        newgetter.setSynthetic(true);
         newgetter.setAccessFlags(getter.getAccessFlags());
         newgetter.makeProtected();
         transferCodeAttributes(getter, newgetter);
@@ -4744,7 +4694,6 @@ public class PCEnhancer {
             BCField field = _pc.getDeclaredField(fmd.getName());
             setter = _pc.declareMethod(PRE + "Set" + fmd.getName(), void.class,
                 new Class[]{ getType(_meta), fmd.getDeclaredType() });
-            setter.setSynthetic(true);
             setter.setAccessFlags(field.getAccessFlags()
                 & ~Constants.ACCESS_TRANSIENT & ~Constants.ACCESS_VOLATILE);
             setter.setStatic(true);
@@ -4759,7 +4708,6 @@ public class PCEnhancer {
             new Class[]{ fmd.getDeclaredType() });
         BCMethod newsetter = _pc.declareMethod(PRE + setter.getName(),
             setter.getReturnName(), setter.getParamNames());
-        newsetter.setSynthetic(true);
         newsetter.setAccessFlags(setter.getAccessFlags());
         newsetter.makeProtected();
         transferCodeAttributes(setter, newsetter);
@@ -4768,8 +4716,8 @@ public class PCEnhancer {
 
     private void addGetEnhancementContractVersionMethod() {
         // public int getEnhancementContractVersion()
-        BCMethod method = _pc.declareMethod(PRE + "GetEnhancementContractVersion", int.class, null);
-        method.setSynthetic(true);
+        BCMethod method = _pc.declareMethod(PRE +
+                "GetEnhancementContractVersion", int.class, null);
         method.makePublic();
         Code code = method.getCode(true);
         code.constant().setValue(ENHANCER_VERSION);
@@ -4998,8 +4946,8 @@ public class PCEnhancer {
     }
 
     private void addGetIDOwningClass() throws NoSuchMethodException {
-        BCMethod method = _pc.declareMethod(PRE + "GetIDOwningClass", Class.class, null);
-        method.setSynthetic(true);
+        BCMethod method = _pc.declareMethod(PRE + "GetIDOwningClass",
+            Class.class, null);
         Code code = method.getCode(true);
 
         code.classconstant().setClass(getType(_meta));