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

Bug 549024

Summary: [1.8][impl] inconsistent array typing in BoundSet.ThreeSets.upperBounds(boolean, InferenceVariable)
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.12   
Target Milestone: 4.13 M3   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=543480
https://git.eclipse.org/r/146497
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=efd24e7042e7f6e5e796560acd02bd5961efb8a3
https://git.eclipse.org/r/146521
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=9a9e397521055c943a0ead8b88f6fcb21b4f4b9e
Whiteboard:

Description Stephan Herrmann CLA 2019-07-06 12:40:09 EDT
While playing with https://git.eclipse.org/r/#/c/142458/ (rebased on today's head) I observed ArrayStoreException and indeed we are quite inconsistent with TypeBinding[] vs. ReferenceBinding[].
Things then blew up in

java.lang.ArrayStoreException: org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
	at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.resolve(InferenceContext18.java:1241)
	at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.solve(InferenceContext18.java:1028)
	

Also see the unprotected cast in IC18.resolve() at
											ReferenceBinding[] glbs = Scope.greaterLowerBound((ReferenceBinding[])upperBounds);
Comment 1 Eclipse Genie CLA 2019-07-23 07:53:28 EDT
New Gerrit change created: https://git.eclipse.org/r/146497
Comment 3 Stephan Herrmann CLA 2019-07-23 13:05:14 EDT
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/146497 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=efd24e7042e7f6e5e796560acd02bd5961efb8a3

Fixed for 4.13 M3.

The implementation now explicitly rejects any intersections containing a non-reference type.

In the same code area also this looks fishy:
	if (glbs == null) {
		return null;
but I couldn't find any behavioral difference in GRT_18, so I shied back from changing this.
Comment 4 Eclipse Genie CLA 2019-07-23 13:08:55 EDT
New Gerrit change created: https://git.eclipse.org/r/146521
Comment 6 Stephan Herrmann CLA 2019-07-24 08:57:44 EDT
Previous change was only regarding the confused client of ThreeSets.upperBounds() ...

(In reply to Eclipse Genie from comment #5)
> Gerrit change https://git.eclipse.org/r/146521 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=9a9e397521055c943a0ead8b88f6fcb21b4f4b9e

This change fixes the method upperBounds() itself.
Comment 7 Manoj N Palat CLA 2019-08-20 23:16:52 EDT
Verified for Eclipse 2019-09 (4.13) M3 with Build id: I20190820-1800
(via code reading)