You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Craig Russell (JIRA)" <ji...@apache.org> on 2008/09/05 19:36:44 UTC

[jira] Created: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Require no-args constructor for PMF implementations and add static methods to PMF interface
-------------------------------------------------------------------------------------------

                 Key: JDO-607
                 URL: https://issues.apache.org/jira/browse/JDO-607
             Project: JDO
          Issue Type: New Feature
          Components: api2
    Affects Versions: JDO 2 maintenance release 1
            Reporter: Craig Russell
             Fix For: JDO 2 maintenance release 2


In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 


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


[jira] Updated: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Bouschen updated JDO-607:
---------------------------------

    Fix Version/s: JDO 3 maintenance release 1

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig L Russell
>            Assignee: Craig L Russell
>             Fix For: JDO 3 maintenance release 1
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Updated: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell updated JDO-607:
------------------------------

    Fix Version/s:     (was: JDO 2 maintenance release 2)
                   JDO 2 maintenance release 3

We can resolve this in the next release. 

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 3
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Updated: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell updated JDO-607:
------------------------------

    Attachment: jdo-607.patch

Please review this patch. It adds the methods getPersistenceManagerFactory(Map) and getPersistenceManagerFactory(Map,Map) to the PersistenceManagerFactory interface to enable the Java 6 ServiceLoader technique.

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Commented: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Andy Jefferson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630851#action_12630851 ] 

Andy Jefferson commented on JDO-607:
------------------------------------

I just tried to build DataNucleus with the api2 jar with this change. It won't build

    [javac] /home/andy/work/datanucleus/platform/core/trunk/src/java/org/datanucleus/jdo/JDOPersistenceManagerFactory.java:163: getPersistenceManagerFactory(java.util.Map,java.util.Map) in org.datanucleus.jdo.JDOPersistenceManagerFactory cannot implement getPersistenceManagerFactory(java.util.Map,java.util.Map) in javax.jdo.PersistenceManagerFactory; overriding method is static
    [javac]     public synchronized static PersistenceManagerFactory getPersistenceManagerFactory(Map overrides, Map props)
    [javac]                                                          ^
    [javac] /home/andy/work/datanucleus/platform/core/trunk/src/java/org/datanucleus/jdo/JDOPersistenceManagerFactory.java:130: getPersistenceManagerFactory(java.util.Map) in org.datanucleus.jdo.JDOPersistenceManagerFactory cannot implement getPersistenceManagerFactory(java.util.Map) in javax.jdo.PersistenceManagerFactory; overriding method is static
    [javac]     public synchronized static PersistenceManagerFactory getPersistenceManagerFactory(Map overridingProps)
    [javac]                                                          ^


So the PMF interface is requiring these methods, yet JDOHelper expects static methods with the same signatures. Hmmmmmmmmmm

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Assigned: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell reassigned JDO-607:
---------------------------------

    Assignee: Craig Russell

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Updated: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell updated JDO-607:
------------------------------

    Attachment: jdo-607.patch

Updated to include signature file.

The RI passes the TCK with these changes.

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Commented: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Andy Jefferson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630907#action_12630907 ] 

Andy Jefferson commented on JDO-607:
------------------------------------

Language spec. I'd guess at something like 8.4.8.2
http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4
"A compile-time error occurs if a static method hides an instance method."



> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Updated: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell updated JDO-607:
------------------------------

    Fix Version/s:     (was: JDO 2 maintenance release 3)

Defer to future release.

> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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


[jira] Commented: (JDO-607) Require no-args constructor for PMF implementations and add static methods to PMF interface

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JDO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630899#action_12630899 ] 

Craig Russell commented on JDO-607:
-----------------------------------

I've reverted this change.

I've looked in the Java language specification for the reason the compiler complains and can't find anything. We did a very similar thing with the JDOHelper in which the user can either use the helper methods statically or via an instance. The difference seems to be that JDOHelper is a class that doesn't implement an interface. Any pointers to the language spec section disallowing this would be appreciated.

Moving on, we have a choice: either declare a new interface that is referenced by the services file, e.g. PersistenceManagerFactoryService that declares these two methods as non-static, or declare two new methods that are non-static, e.g. createPersistenceManagerFactory(Map) and createtPersistenceManagerFactory(Map, Map).


> Require no-args constructor for PMF implementations and add static methods to PMF interface
> -------------------------------------------------------------------------------------------
>
>                 Key: JDO-607
>                 URL: https://issues.apache.org/jira/browse/JDO-607
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: jdo-607.patch, jdo-607.patch
>
>
> In order to use Java 6 ServiceLoader to instantiate PMF, the class needs to implement a no-args constructor, and the PMF interface needs to define the methods that are currently static (and therefore not defined in the interface). 

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