[ nice-Bugs-1327932 ] Missing compiler errors

"SourceForge.net" <[email protected]> Sun, 16 Oct 2005 06:32:52 -0700
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1327932, was opened at 2005-10-16 06:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1327932&group_id=12788

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Missing compiler errors

Initial Comment:
The following is accepted by the compiler (using
Eclipse plugin v0.9.8). Note the illegal (I think)
implementing of non-abstract interfaces, and the fact
that an interface can implment an abstract interface:

abstract interface AbInterface1 {
	(int, int) getDimensions();
	
	int getArea() {
		(int width, int length) = this.getDimensions();
		return width * length;
	}
}

interface Interface1 implements AbInterface1 {}
interface Interface2 extends AbInterface1 {}

class java.lang.String implements Interface1;
class java.lang.String implements Interface2;
getDimensions(String s) = (1, s.length());

<AbInterface1 T> void printout1(T x) {
	println(x.getArea());
}

void printout2(Interface1 x) {
	println(x.getArea());
}

void printout3(Interface2 x) {
	println(x.getArea());
}

void main(String[] args) {
	String s = "Hello World!";
	print("Printout 1: ");
	printout1(s);
	
	try {
		print("Printout 2: ");
		printout2(s);
	}catch(Exception e) {
		e.printStackTrace();
	}
	
	try {
		print("Printout 2 - Interface1: ");
		Interface1 x = s;
		printout2(x);
	}catch(Exception e) {
		e.printStackTrace();
	}	
	
	try {
		print("Printout 3: ");	
		printout3(s);
	}catch(Exception e) {
		e.printStackTrace();
	}

	try {
		print("Printout 3 - Interface2: ");	
		Interface2 x = s;
		printout3(x);
	}catch(Exception e) {
		e.printStackTrace();
	}	
}

The output produced when run is:

Printout 1: 12
Printout 2: Argument #0 to 'printout2' has wrong type
(java.lang.String)
        at gnu.mapping.WrongType.make(WrongType.java:56)
        at temp.fun.main(fun.nice:8)
        at temp.dispatch.main(dispatch.nice)
Caused by: java.lang.ClassCastException: java.lang.String
        ... 2 more
Printout 2 - Interface1: java.lang.ClassCastException:
java.lang.String
        at temp.fun.main(fun.nice:15)
        at temp.dispatch.main(dispatch.nice)
Printout 3: Argument #0 to 'printout3' has wrong type
(java.lang.String)
        at gnu.mapping.WrongType.make(WrongType.java:56)
        at temp.fun.main(fun.nice:23)
        at temp.dispatch.main(dispatch.nice)
Caused by: java.lang.ClassCastException: java.lang.String
        ... 2 more
Printout 3 - Interface2: java.lang.ClassCastException:
java.lang.String
        at temp.fun.main(fun.nice:30)
        at temp.dispatch.main(dispatch.nice)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1327932&group_id=12788


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl