Community
Participate
Working Groups
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.
duplicate *** This bug has been marked as a duplicate of bug 343710 ***
Requested via bug 522520. -M.