Bug 105278 - Problems with generics and exceptions from other classes
Summary: Problems with generics and exceptions from other classes
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.2 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-27 04:43 EDT by drsoong CLA
Modified: 2006-02-05 15:38 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 drsoong CLA 2005-07-27 04:43:20 EDT
An Unhandled Exception error is reported by the gui instead of a Type-safety
warning in the following code:

----
package test;

import test.SomeOtherClass.SomeException;

public class SomeClass<T> {
    
    public SomeClass() throws SomeOtherClass.SomeException {
        throw new SomeOtherClass.SomeException();
    }
    
    public static void main(String[] args) {
        
        // reports uncaught exception compiler error
        try {
            SomeClass<String> x = new SomeClass();
            System.out.println(x.hashCode());
        } catch (SomeException e) {
        }

        // reports type safety warning
        try {
            SomeClass<String> x = new SomeClass();
            System.out.println(x.hashCode());
        } catch (Exception e) {
        }

        // correct
        try {
            SomeClass<String> x = new SomeClass<String>();
            System.out.println(x.hashCode());
        } catch (SomeException e) {
        }

    }
}
Comment 1 Philipe Mulet CLA 2006-02-05 15:38:27 EST
Cannot reproduce any issue with a recent 3.2 drop.
Closing as worksforme, if you can still reproduce it, then pls reopen it with complete steps (including missing required SomeOtherClass file).
Also please check your .log for a stacktrace which may reveal the underlying issue.