Bug 25255

Summary: ICompilationUnit::getUnderlyingResource throws an exception
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED WORKSFORME QA Contact:
Severity: major    
Priority: P2    
Version: 2.0   
Target Milestone: 2.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2002-10-23 12:05:57 EDT
it throws a JavaModelException for ICompilationUnits outside the classpath
the spec says that the exception is thrown when the element does not exist

but it does exist - calling exists() confirms it

it used to work - now a lot of code is broken
Comment 1 Philipe Mulet CLA 2002-10-23 16:09:21 EDT
We warned you about this change, and we are still debating on the right 
behavior. See the question asked on jdt-core-dev.

Jerome-please investigate asap. I thought we hadn't changed yet.
Comment 2 Jerome Lanneluc CLA 2002-10-23 16:59:45 EDT
I don't understand how this could happen. The implementation of 
CompilationUnit.getUnderlyingResource() is to return getResource() which cannot 
throw a JavaModelException. Which version are using?
Comment 3 Adam Kiezun CLA 2002-10-28 11:04:04 EST
i was using a sneak preview version from Philippe
Comment 4 Jerome Lanneluc CLA 2002-11-08 09:38:31 EST
Fix for bug 25184 now ensures that exists() returns false for a cu outside the 
classpath. In this case getUnderlyingResource() will throw a JavaModelException 
as specified.