You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Alexander Falb (Jira)" <ji...@apache.org> on 2020/01/15 07:23:00 UTC

[jira] [Updated] (OPENJPA-2800) StateManager field in enhanced entities are not "synthetic"

     [ https://issues.apache.org/jira/browse/OPENJPA-2800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Falb updated OPENJPA-2800:
------------------------------------
    Description: 
I'm using reflection to do various things on an entity-class during my unit tests. Because my tests are not interested in any of OpenJPAs internals, I'm trying to skip any field generated during enhancement. Basically I skip every field with where [Field#isSynthetic|#isSynthetic--]] is true. The pcStateManager however does not have the flag ACC_SYNTHETIC set:
{code:java}
$ javap -verbose MyEntity.class
[...]
  protected transient org.apache.openjpa.enhance.StateManager pcStateManager;
    descriptor: Lorg/apache/openjpa/enhance/StateManager;
    flags: ACC_PROTECTED, ACC_TRANSIENT
[...]
{code}
According to the [JVM Specs|https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8]
{quote}[...]A class member that does not appear in the source code must be marked using a Synthetic attribute, or else it must have its ACC_SYNTHETIC flag set.[...]
{quote}
Is this flag intentionally not set?
  

  was:
I'm using reflection to do various things on an entity-class during my unit tests. Because my tests are not interested in any of OpenJPAs internals, I'm trying to skip any field generated during enhancement. Basically I skip every field with where [Field#isSynthetic|[https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html#isSynthetic--]] is true. The pcStateManager however does not have the flag ACC_SYNTHETIC set:
{code}
$ javap -verbose MyEntity.class
[...]
  protected transient org.apache.openjpa.enhance.StateManager pcStateManager;
    descriptor: Lorg/apache/openjpa/enhance/StateManager;
    flags: ACC_PROTECTED, ACC_TRANSIENT
[...]
{code}

Screenshot from my debugger:
 !image-2020-01-15-08-12-02-066.png|thumbnail! 

According to the [JVM Specs|https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8]
{quote}[...]A class member that does not appear in the source code must be marked using a Synthetic attribute, or else it must have its ACC_SYNTHETIC flag set.[...]{quote}

Is this flag intentionally not set?
 


> StateManager field in enhanced entities are not "synthetic"
> -----------------------------------------------------------
>
>                 Key: OPENJPA-2800
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2800
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.4.3
>            Reporter: Alexander Falb
>            Priority: Minor
>         Attachments: image-2020-01-15-08-12-02-066.png
>
>
> I'm using reflection to do various things on an entity-class during my unit tests. Because my tests are not interested in any of OpenJPAs internals, I'm trying to skip any field generated during enhancement. Basically I skip every field with where [Field#isSynthetic|#isSynthetic--]] is true. The pcStateManager however does not have the flag ACC_SYNTHETIC set:
> {code:java}
> $ javap -verbose MyEntity.class
> [...]
>   protected transient org.apache.openjpa.enhance.StateManager pcStateManager;
>     descriptor: Lorg/apache/openjpa/enhance/StateManager;
>     flags: ACC_PROTECTED, ACC_TRANSIENT
> [...]
> {code}
> According to the [JVM Specs|https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8]
> {quote}[...]A class member that does not appear in the source code must be marked using a Synthetic attribute, or else it must have its ACC_SYNTHETIC flag set.[...]
> {quote}
> Is this flag intentionally not set?
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)