Nice/testsuite/compiler/native constructors.testsuite,1.4,1.5

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
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();



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.