db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-540) Support for final modifier on fields of Persistence-Capable classes
Date Fri, 19 Oct 2007 23:21:50 GMT

    [ https://issues.apache.org/jira/browse/JDO-540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536374
] 

Craig Russell commented on JDO-540:
-----------------------------------

Meantime, here is some text from the specification making it clear that certain modifiers
are not required to be supported.

6.2 All class and field modifiers supported by the Java language including A6.2-1 [private],
A6.2-2 [public], A6.2-3 [protected], A6.2-4 [static], A6.2-5 [transient], A6.2-6 [abstract],
A6.2-7 [final], A6.2-8 [synchronized], and A6.2-9 [volatile], should be supported by JDO instances.
There are some known issues with final and static field, therefore implementations are not
required to support making final or static fields persistent.

6.4.4 Static and final fields
Static fields pose a challenge for implementations. Since they are singletons typically initialized
when the class is loaded, there is no convenient time to load the values from the database.
Therefore, static fields are not persistent.
Final fields pose a challenge for implementations. While it is possible to modify the values
of static fields, it can only be done via reflection and there are synchronization issues.
Therefore, final fields are not persistent.

6.4.5 Complex enum types
Complex enum types are enums that contain fields that might change during execution instead
of being initialized at class initialization. While it is possible to manage these singleton
instances persistent state, there are issues with the transaction isolation of the instances
and with the ownership of the instances by a persistence manager. Therefore, dynamically changing
fields of enum types are not persistent.

> Support for final modifier on fields of Persistence-Capable classes
> -------------------------------------------------------------------
>
>                 Key: JDO-540
>                 URL: https://issues.apache.org/jira/browse/JDO-540
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>            Reporter: Chris Beams
>            Assignee: Chris Beams
>             Fix For: JDO 2 maintenance release 1
>
>
> Per changes introduced in Java5 as part of JSR-133, post-construction modification of
final fields is now possible when calling setAccessible(true) on a field via reflection.
> Heinz Kabutz gives a good discussion of the feature: http://www.javaspecialists.eu/archive/Issue096.html
> Supporting final on fields would make JDO even less intrusive than it already is, and
would allow users to create richer class definitions.
> Let's discuss...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message