Bug 180082

Summary: API breakage: IClassFile.getType no longer throws JavaModelException
Product: [Eclipse Project] JDT Reporter: Steve Francisco <stephen.francisco>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.3   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Steve Francisco CLA 2007-03-29 17:31:07 EDT
The method org.eclipse.jdt.core.IClassFile.getType() method used to be defined as throwing JavaModelException.  Code exists that make use of this method, and that code no longer compiles with error messages similar to this:
>> 37. ERROR in /some/path/SomeClass.java  (at line 2306)
>>		 } catch (JavaModelException e) {
>>		          ^^^^^^^^^^^^^^^^^^
>> Unreachable catch block for JavaModelException. This exception is never thrown >> from the try statement body

This seems like an unintentional API change to the getType method that appeared between M5 and M6 of Eclipse 3.3.  Can the throws statement be put back to avoid these errors?
Comment 1 Olivier Thomann CLA 2007-03-29 19:04:53 EDT
This is a consequence of fix for bug 154667.
You need to remove the try/catch.
Closing as WONTFIX.
Comment 2 Steve Francisco CLA 2007-03-29 22:26:55 EDT
Thanks for clarifying the API change rules.  We'll remove the catch and move on.