Bug 105278

Summary: Problems with generics and exceptions from other classes
Product: [Eclipse Project] JDT Reporter: drsoong
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: minor    
Priority: P3    
Version: 3.1   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.