You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Rolf Schumacher (JIRA)" <xm...@xml.apache.org> on 2005/03/12 15:22:54 UTC

[jira] Created: (XMLBEANS-127) jdk1.5 compliance

jdk1.5 compliance
-----------------

         Key: XMLBEANS-127
         URL: http://issues.apache.org/jira/browse/XMLBEANS-127
     Project: XMLBeans
        Type: Improvement
  Components: Compiler  
    Versions: Version 2    
 Environment: linux
    Reporter: Rolf Schumacher
    Priority: Minor


I would recommend to generate Array access slightly different from what it is now:

 1        /**
 2         * Gets array of all "MyElement" elements
 3         */
 4        public mypackage.x2004.mySchema.MyElementDocument.MyElement[] getMyElementArray()
 5        {
 6            synchronized (monitor())
 7            {
 8                check_orphaned();
 9                java.util.List<mypackage.x2004.mySchema.MyElementDocument.MyElement> targetList = 
 			new java.util.ArrayList<mypackage.x2004.mySchema.MyElementDocument.MyElement>();
10                get_store().find_all_element_users(MYELEMENT$0, targetList);
11                mypackage.x2004.mySchema.MyElementDocument.MyElement[] result = 
			new mypackage.x2004.mySchema.MyElementDocument.MyElement[targetList.size()];
12                targetList.toArray(result); 
13                return result;
14            }
15        }

as opposed to

 9                java.util.List targetList = new java.util.ArrayList();


Rolf


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


Re: [jira] Created: (XMLBEANS-127) jdk1.5 compliance

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Rolf Schumacher (JIRA) wrote:
> jdk1.5 compliance
> -----------------
<snip>
>  9                java.util.List<mypackage.x2004.mySchema.MyElementDocument.MyElement> targetList = 

I really like this.
+1.

-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Commented: (XMLBEANS-127) jdk1.5 compliance

Posted by "Rolf Schumacher (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-127?page=comments#action_60717 ]
     
Rolf Schumacher commented on XMLBEANS-127:
------------------------------------------

Hi, Jacob, thanks for your annotation. Unfortunately, it's not as convenient as I hoped for.

I did as you recommended: attributed my ant target based on "org.apache.xmlbeans.impl.tool.XMLBean" with javasource="1.5" in order generate my schema based xmlBeans sources.

Usually I do compile with "-Xlint:unchecked" in order to get maximum quality at source code level.

It's not a problem to avoid the massive warnings attack from javac: I have to separate the schema induced xmlBeans sources from my project and have to compile them apart without -Xlint:unchecked.

It's just inconvenient and I thought /javasource="1.5"/ is supposed to fulfil that gap. But it didn't. And from what you've admitted it seems not be a fault in my thinking.

I can live with my workaround.

Rolf

> jdk1.5 compliance
> -----------------
>
>          Key: XMLBEANS-127
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-127
>      Project: XMLBeans
>         Type: Improvement
>   Components: Compiler
>     Versions: Version 2
>  Environment: linux
>     Reporter: Rolf Schumacher
>     Priority: Minor

>
> I would recommend to generate Array access slightly different from what it is now:
>  1        /**
>  2         * Gets array of all "MyElement" elements
>  3         */
>  4        public mypackage.x2004.mySchema.MyElementDocument.MyElement[] getMyElementArray()
>  5        {
>  6            synchronized (monitor())
>  7            {
>  8                check_orphaned();
>  9                java.util.List<mypackage.x2004.mySchema.MyElementDocument.MyElement> targetList = 
>  			new java.util.ArrayList<mypackage.x2004.mySchema.MyElementDocument.MyElement>();
> 10                get_store().find_all_element_users(MYELEMENT$0, targetList);
> 11                mypackage.x2004.mySchema.MyElementDocument.MyElement[] result = 
> 			new mypackage.x2004.mySchema.MyElementDocument.MyElement[targetList.size()];
> 12                targetList.toArray(result); 
> 13                return result;
> 14            }
> 15        }
> as opposed to
>  9                java.util.List targetList = new java.util.ArrayList();
> Rolf

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Closed: (XMLBEANS-127) jdk1.5 compliance

Posted by "Jacob Danner (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-127?page=all ]
     
Jacob Danner closed XMLBEANS-127:
---------------------------------


Closing

> jdk1.5 compliance
> -----------------
>
>          Key: XMLBEANS-127
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-127
>      Project: XMLBeans
>         Type: Improvement
>   Components: Compiler
>     Versions: Version 2
>  Environment: linux
>     Reporter: Rolf Schumacher
>     Priority: Minor

>
> I would recommend to generate Array access slightly different from what it is now:
>  1        /**
>  2         * Gets array of all "MyElement" elements
>  3         */
>  4        public mypackage.x2004.mySchema.MyElementDocument.MyElement[] getMyElementArray()
>  5        {
>  6            synchronized (monitor())
>  7            {
>  8                check_orphaned();
>  9                java.util.List<mypackage.x2004.mySchema.MyElementDocument.MyElement> targetList = 
>  			new java.util.ArrayList<mypackage.x2004.mySchema.MyElementDocument.MyElement>();
> 10                get_store().find_all_element_users(MYELEMENT$0, targetList);
> 11                mypackage.x2004.mySchema.MyElementDocument.MyElement[] result = 
> 			new mypackage.x2004.mySchema.MyElementDocument.MyElement[targetList.size()];
> 12                targetList.toArray(result); 
> 13                return result;
> 14            }
> 15        }
> as opposed to
>  9                java.util.List targetList = new java.util.ArrayList();
> Rolf

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


Re: [jira] Resolved: (XMLBEANS-127) jdk1.5 compliance

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Jacob Danner (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/XMLBEANS-127?page=history ]
>      
> Jacob Danner resolved XMLBEANS-127:
> -----------------------------------
> 
>     Resolution: Won't Fix
> 
> Generics are not supported in JDK 1.4. Much of the user community still uses 1.4 and this change would break backwards compatibility.
 >
> As a side Note:
> If you would like to get schema jars that have generics enabled you can set the javasource flag == 1.5 when building your schemas.

Oh! From looking at the code generated with -javasource 1.5 it seems 
XmlBeans already does what Rolf was asking for (or at least that is what 
I gave the +1 for :-)

Sample of XmlBean scomp generated source with -javasource 1.5:

(from the sample numerals.xsd)

java.util.List<org.apache.xmlbeans.XmlShort> xgetShortList();

Cheers.

-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Resolved: (XMLBEANS-127) jdk1.5 compliance

Posted by "Jacob Danner (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-127?page=history ]
     
Jacob Danner resolved XMLBEANS-127:
-----------------------------------

    Resolution: Won't Fix

Generics are not supported in JDK 1.4. Much of the user community still uses 1.4 and this change would break backwards compatibility.

As a side Note:
If you would like to get schema jars that have generics enabled you can set the javasource flag == 1.5 when building your schemas.

> jdk1.5 compliance
> -----------------
>
>          Key: XMLBEANS-127
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-127
>      Project: XMLBeans
>         Type: Improvement
>   Components: Compiler
>     Versions: Version 2
>  Environment: linux
>     Reporter: Rolf Schumacher
>     Priority: Minor

>
> I would recommend to generate Array access slightly different from what it is now:
>  1        /**
>  2         * Gets array of all "MyElement" elements
>  3         */
>  4        public mypackage.x2004.mySchema.MyElementDocument.MyElement[] getMyElementArray()
>  5        {
>  6            synchronized (monitor())
>  7            {
>  8                check_orphaned();
>  9                java.util.List<mypackage.x2004.mySchema.MyElementDocument.MyElement> targetList = 
>  			new java.util.ArrayList<mypackage.x2004.mySchema.MyElementDocument.MyElement>();
> 10                get_store().find_all_element_users(MYELEMENT$0, targetList);
> 11                mypackage.x2004.mySchema.MyElementDocument.MyElement[] result = 
> 			new mypackage.x2004.mySchema.MyElementDocument.MyElement[targetList.size()];
> 12                targetList.toArray(result); 
> 13                return result;
> 14            }
> 15        }
> as opposed to
>  9                java.util.List targetList = new java.util.ArrayList();
> Rolf

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org