Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342035

Summary: [xbase][typeconformance] Supertype may not be visible
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 Flags: sebastian.zarnekow: kepler+
Version: 2.0.0   
Target Milestone: M6   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 376037    
Bug Blocks:    

Description Sebastian Zarnekow CLA 2011-04-06 11:23:31 EDT
if (true) new StringBuilder() else new StringBuffer()

The type of this expression is AbstractStringBuilder & Comparable<? extends CharSequence> or something similar.

However, AbstractStringBuilder is not visible but exposes public methods such as #trimToSize which may only be referenced from classes in the java.lang package. That's why the infered type of the if-expression should take the visibility of potential super types into account.

Proposed solution:
Add an error marker and a quickfix that adds a cast to a visible type such as CharSequence, Serializable or Object or at least a hint on what the user should do to avoid the problem.

Scheduled for Indigo but marked as minor since this is a rare corner case.
Comment 1 Sven Efftinge CLA 2012-11-21 04:07:01 EST
duplicate

*** This bug has been marked as a duplicate of bug 343710 ***
Comment 2 Eclipse Webmaster CLA 2017-10-31 11:31:13 EDT
Requested via bug 522520.

-M.