Bug 537257 - Need better warning message for unhandled exception due to implicit super() call
Summary: Need better warning message for unhandled exception due to implicit super() call
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-21 22:22 EDT by Luke Hutchison CLA
Modified: 2022-12-26 10:49 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 Luke Hutchison CLA 2018-07-21 22:22:40 EDT
In the following code, the SubClass() constructor gives the compiler error "Unhandled exception type IOException". It is not obvious that this is coming from the superclass constructor ImplicitException(), because the error message doesn't say so. 

    import java.io.IOException;

    public class ImplicitException {
        public ImplicitException() throws IOException {
        }
    
        public static class SubClass extends ImplicitException {
            public SubClass() {   // "Unhandled exception type IOException"
            }
        }
    }

If you make the superclass constructor call explicit, the message makes sense, since it is given over the super() call, rather than at the top of the declaration of SubClass():


    import java.io.IOException;

    public class ImplicitException {
        public ImplicitException() throws IOException {
        }
    
        public static class SubClass extends ImplicitException {
            public SubClass() {
                super();         // "Unhandled exception type IOException"
            }
        }
    }

Whether or not the first line in SubClass is "super()", the superconstructor is called at the top of the SubClass constructor. But in the case that this call is implicit (in the top code example), the warning message needs to give the user more information, even by just adding the words "...in implicit call to default constructor of superclass".
Comment 1 Eclipse Genie CLA 2020-10-14 15:13:43 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Luke Hutchison CLA 2020-10-14 15:42:56 EDT
Pinging so that the bug is not automatically closed
Comment 3 Eclipse Genie CLA 2022-12-26 10:49:56 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.