Community
Participate
Working Groups
import java.util.*; public class Hey { public static void main(String[] args) { var x = args.length > 0 ? new TreeSet<>() : new HashSet<>(); x.add(1); } } When computing the text hover for x: java.lang.IllegalArgumentException: java.util.AbstractSet<java.lang.Object>&java.lang.Cloneable&java.io.Serializable at org.eclipse.jdt.core.Signature.createCharArrayTypeSignature(Signature.java:1097) at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:1293) at org.eclipse.jdt.internal.core.SelectionRequestor.acceptLocalVariable(SelectionRequestor.java:476) at org.eclipse.jdt.internal.codeassist.SelectionEngine.selectFrom(SelectionEngine.java:1385) at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1083) at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:165) at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:387) at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:380) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getJavaElementsAt(AbstractJavaEditorTextHover.java:121) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:671) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:667) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:164) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:130) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:86) at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)
Jay, can you please check?
New Gerrit change created: https://git.eclipse.org/r/126080
(In reply to Eclipse Genie from comment #2) > New Gerrit change created: https://git.eclipse.org/r/126080 Draft of a possible fix. Feel free to modify ... Note: Back in https://git.eclipse.org/r/#/c/119966/ I simply advised to add a comment regarding the unfortunate swap of | vs &. Today, when looking at the implementation of org.eclipse.jdt.internal.core.util.Util.typeSignature(TypeReference) I'm utterly confused by this paragraph: if ((type.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsUnionType) != 0) { // special treatment for union type reference UnionTypeReference unionTypeReference = (UnionTypeReference) type; TypeReference[] typeReferences = unionTypeReference.typeReferences; String[] typeSignatures = typeSignatures(typeReferences); signature = Signature.createIntersectionTypeSignature(typeSignatures); } else if (type instanceof IntersectionCastTypeReference) { IntersectionCastTypeReference intersection = (IntersectionCastTypeReference) type; TypeReference[] typeReferences = intersection.typeReferences; String[] typeSignatures = typeSignatures(typeReferences); signature = Signature.createUnionTypeSignature(typeSignatures); } else { so, red is green and green is red? Really??
Bulk move out of 4.11
(In reply to Stephan Herrmann from comment #3) > Note: Back in https://git.eclipse.org/r/#/c/119966/ I simply advised to add > a comment regarding the unfortunate swap of | vs &. > > Today, when looking at the implementation of > org.eclipse.jdt.internal.core.util.Util.typeSignature(TypeReference) I'm > utterly confused by this paragraph: > > if ((type.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsUnionType) > != 0) { > // special treatment for union type reference > UnionTypeReference unionTypeReference = (UnionTypeReference) type; > TypeReference[] typeReferences = unionTypeReference.typeReferences; > String[] typeSignatures = typeSignatures(typeReferences); > signature = Signature.createIntersectionTypeSignature(typeSignatures); > } else if (type instanceof IntersectionCastTypeReference) { > IntersectionCastTypeReference intersection = > (IntersectionCastTypeReference) type; > TypeReference[] typeReferences = intersection.typeReferences; > String[] typeSignatures = typeSignatures(typeReferences); > signature = Signature.createUnionTypeSignature(typeSignatures); > } else { > > so, red is green and green is red? Really?? I pushed this to a new bug 551077 to unblock this bug.
Gerrit change https://git.eclipse.org/r/126080 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=5b9892bd4cc46055e381266dc749bbc43aff733b
(In reply to Eclipse Genie from comment #6) > Gerrit change https://git.eclipse.org/r/126080 was merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/ > ?id=5b9892bd4cc46055e381266dc749bbc43aff733b Resolved for 4.14 M1
Verified for Eclipse Version: 2019-12 (4.14) M1 with Build id: I20191008-1800