OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sdo message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: AW: Issue 27: Byte-Code compatibility of interfaces with andwithout Generics


Oops, pasted the wrong client code, should be:
 

public static void main(String[] args) {

Lib lib = new Lib();

List a = lib.getStrings();

Iterator i = a.iterator();

while (i.hasNext()) {

System.out.println(i.next());

}

}



Von: Barack, Ron [mailto:ron.barack@sap.com]
Gesendet: Freitag, 23. Oktober 2009 12:53
An: sdo@lists.oasis-open.org
Betreff: [sdo] Issue 27: Byte-Code compatibility of interfaces with and without Generics

Hi Everyone,
 
I took an action item to evaluate whether adding generics to SDO 3 interfaces would require a recompile of applications that use SDO 2.1 interfaces.
 
To evaluate this, I wrote a small library and compiled it using Java 1.4.19.  The code looks like
 
public class Lib {
 
        public List getStrings() {
                List ret = new ArrayList();
                ret.add("nonGeneric");
                return ret;
        }
 
}
 
I then wrote a client program that uses the lib, also compiled against Java 1.4
 
        public List getStrings() {
                List ret = new ArrayList();
                ret.add("nonGeneric");
                return ret;
        }
 
Running the client with the library on the classpath produces the expected result (printing out "nonGeneric").
 
I then compiled the following code using Java 6
 
        public List<String> getStrings() {
                return Collections.singletonList("Hello");
        }
 
Modifying the classpath to include the Java 6 version instead of the Java 1.4 version of the library printed out "Hello", as expected.
 
I also tried some variations, eg, using interfaces, without noticing any problems.
 
From this, I conclude that adding generics to our interfaces will not require recompilation of code.
 
Best Regards,
Ron
 
 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]