Bug 12431 - Unclear compiler error
Summary: Unclear compiler error
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-28 09:59 EST by Genady Beryozkin CLA
Modified: 2002-04-02 05:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Genady Beryozkin CLA 2002-03-28 09:59:31 EST
Create empty class that inherits UnicastRemoteObject.
You get an error "Unhandled exception type java.rmi.RemoteException".
javac produces much better error message "A default constructor cannot be
created for this class because the constructor of its superclass throws the
exception java.rmi.RemoteException.  Define the constructor for this class
explicitly."
Comment 1 Philipe Mulet CLA 2002-03-29 13:00:13 EST
Which version of javac have you been tested ? 1.3.1 and 1.4 only report poorly:

package p1;
import java.io.IOException;
public class X extends Y {
}  
class Y {
	Y() throws IOException {
	}
}

D:\>javac p1\X.java -d \test
p1\X.java:5: unreported exception java.io.IOException; must be caught or 
declared to be thrown
public class X extends Y {
       ^
1 error
Comment 2 Philipe Mulet CLA 2002-03-29 13:11:01 EST
Anyway, improved error messages for unbound/visibility/ambiguity + unhandled 
exceptions on both default constructors and implicit super constructor calls.

"Default constructor cannot handle exception type java.io.IOException thrown by 
implicit super constructor. Must define an explicit constructor"

Fixed
Comment 3 Genady Beryozkin CLA 2002-03-29 14:15:52 EST
I checked it with 1.2.2 (sometimes it's good to have 
an old compiler as well. Otherwise I'd have searched for a reason for hours). 
Comment 4 Genady Beryozkin CLA 2002-03-29 14:18:01 EST
here is the console output:


comp:~>javac test.java 
test.java:4: A default constructor cannot be created for this class because the 
constructor of its superclass throws the exception java.rmi.RemoteException.  
Define the constructor for this class explicitly.
public class test extends UnicastRemoteObject {
             ^
1 error
Comment 5 Philipe Mulet CLA 2002-04-02 05:37:00 EST
Closing, fixed.