Bug 368986 - ITypeBinding.getInterfaces() throws AbortCompilation
Summary: ITypeBinding.getInterfaces() throws AbortCompilation
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-18 11:16 EST by Brian Vosburgh CLA
Modified: 2013-04-30 02:26 EDT (History)
5 users (show)

See Also:


Attachments
stack trace (6.71 KB, text/plain)
2012-01-18 11:16 EST, Brian Vosburgh CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Vosburgh CLA 2012-01-18 11:16:20 EST
Created attachment 209689 [details]
stack trace

When Dali calls ITypeBinding.getInterfaces() it throws an AbortCompilation exception, seemingly when the project's build path points to a missing JRE.
See attached stack trace.
Comment 1 Srikanth Sankaran CLA 2012-01-18 11:32:48 EST
What is the behavior do you expect to see here ?
Comment 2 Brian Vosburgh CLA 2012-01-18 11:43:28 EST
No exception? The API doc does not indicate an AbortCompilation exception might be thrown. Other methods in ITypeBinding seem to handle AbortCompilation. See the code for TypeBinding.isAssignmentCompatible(ITypeBinding): It returns false if it catches an AbortCompilation. (See bug 143013.) I'm not sure what *should* happen. What is the intent of the entire ITypeBinding interface in this situation? The method getInterfaces() could return an array with the problematic interface(s) removed, or it could return an empty array if *any* interface is problematic. In any case, the JavaDoc should describe the behavior.

Given the other code in TypeBinding that handles the exception, it seems like something similar should happen here. What do you think?
Comment 3 Brian Vosburgh CLA 2012-01-18 14:51:41 EST
I've looked at this a bit closer. I had some problems figuring out exactly what was happening because both the JDT code and the Dali code have exception handlers that would catch any exceptions; and, just to complicate things, the Dali code was executing on a long-running background thread....

Anyway: Despite my initial description, TypeBinding.getInterfaces() *is* catching and logging the exception and returning an empty array. It is catching RuntimeException instead of AbortCompilation (as I was looking for...). My mistake was reacting to the stack trace appearing in the Error Log. I thought Dali was logging the exception; but it was TypeBinding.getInterfaces() that was logging the error. Seems like that is the expected behavior. Sorry about the confusion.
Comment 4 Stephan Herrmann CLA 2012-01-24 09:13:50 EST
Verified for 3.8 M5
Comment 5 Sven Efftinge CLA 2012-09-07 05:28:17 EDT
In Xtext the binding API is used to create EMF-based facades of the java types, since it's very common to have unresolved type references in a workspace the error log is full of AbortCompilation errors.

I'm reopening because I'd like to suggest logging the AbortCompilation with a DEBUG severity or provide a way to configure it.
Comment 6 Dani Megert CLA 2013-04-23 08:58:36 EDT
AbortCompilation should never be surfaced to clients.
Comment 7 Stephan Herrmann CLA 2013-04-23 09:15:16 EDT
This bug's state is a bit confusing by now.

We had verified for 3.8 M5 that the exception is not surfaced but
caught and logged.

The re-open in comment 5 does not question this fact but is an RFE to
only change the way this exception is logged when caught.

To resolve this confusion I've moved the new RFE to its own bug 406317.

The original problem in this bug has been resolved and verified OK.
Comment 8 Stephan Herrmann CLA 2013-04-23 09:16:32 EDT
Restoring the original fix status.
Comment 9 Dani Megert CLA 2013-04-23 09:27:16 EDT
(In reply to comment #7)

Agreed.