[Nice-commit] Nice/testsuite/compiler/native constructors.testsuite,1.4,1.5
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-03-01 17:37:31
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27179/testsuite/compiler/native Modified Files: constructors.testsuite Log Message: Make sure that constructors with defaults omitted are compiled first so they get unmangled names, in case they clash with ones with all values. Cleaned up DefaultConstructor by creating a class CompiledConstructor to handle the details of bytecode generation. Index: constructors.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/constructors.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** constructors.testsuite 26 Dec 2004 06:21:16 -0000 1.4 --- constructors.testsuite 1 Mar 2005 17:36:33 -0000 1.5 *************** *** 30,34 **** /// PASS /// package pkg ! /* java.lang.Thread has many constructors, including one () and one (Runnable). There is therefore ambiguity in A(Runnable x) between --- 30,34 ---- /// PASS /// package pkg ! /* java.lang.Thread has many constructors, including one () and one (Runnable). There is therefore ambiguity in A(Runnable x) between *************** *** 37,42 **** super.(x) + this.dummy = null In this case the second interpretation must be taken. */ ! Class c = Class.forName("pkg.A"); Constructor make = c.getConstructor([Runnable.class]); --- 37,45 ---- super.(x) + this.dummy = null In this case the second interpretation must be taken. + The rationale is that you should be able to use the inherited constructor + as usual. You can always use the full constructor to specify all values. + Most important is, this is better specified than random. */ ! Class c = Class.forName("pkg.A"); Constructor make = c.getConstructor([Runnable.class]); *************** *** 49,53 **** try { instance.join(); } catch(InterruptedException ex) {} ! assert ran; --- 52,56 ---- try { instance.join(); } catch(InterruptedException ex) {} ! assert ran; *************** *** 58,61 **** --- 61,80 ---- /// PASS + // Simpler testcase than the one using Thread. + /// package pkg + Class c = Class.forName("pkg.A"); + Constructor make = c.getConstructor([Collection.class]); + + Collection<Object> col = new ArrayList(); + + A<Object> instance = cast(make.newInstance([col])); + assert instance.dummy == null; + + /// Toplevel + import java.lang.reflect.*; + + class A<T> extends LinkedList<T> { ?Collection<T> dummy = null; } + + /// PASS // bug #1090888 HashMap<String,String> m = new HashMap(); |