Bug 140156

Summary: [1.5][search] Invalid method handle with parameterized parameters when no source is attached
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipsetalk2, markus.kell.r
Version: 3.2   
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Search debug + JME traces
none
Proposed patch
none
Complete patch (fix+tests) for bugs 95152, 123679 and 140156 none

Description Frederic Fusier CLA 2006-05-04 09:49:25 EDT
While verifying bug 139160 I tried to search for references/declarations of method Collections.iteratorBinarySearch(List<? extends Comparable<? super T>>, T) and get several JME in console (I'll attach them to this bug).

We cannot say this a regression as this handle was already wrong in 3.1.2 but it seems that JDT/UI make additional verifications on returned match which cause these exception.
Comment 1 Frederic Fusier CLA 2006-05-04 09:50:58 EDT
Created attachment 40352 [details]
Search debug + JME traces
Comment 2 Frederic Fusier CLA 2006-05-04 09:52:28 EDT
Here is Search debug using 3.1.2:
BasicSearchEngine.search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
Searching for pattern: MethodDeclarationPattern: iteratorBinarySearch(java.util.List, T, java.util.Comparator), exact match, case sensitive, erasure only
JavaWorkspaceScope
Locating matches in documents [
        SearchDocument for D:\a\JDKs\sun\1.5.0\jre\lib\rt.jar|java/util/Collections.class
]
Parsing Collections.class [in java.util [in D:\a\JDKs\sun\1.5.0\jre\lib\rt.jar [in b140xxx]]]
Reporting match
        Resource: P/b140xxx
        Positions: [offset=-1, length=0]
        Java element: iteratorBinarySearch(java.util.List, java.lang.Object, java.util.Comparator) {key=Ljava/util/Collections;.iteratorBinarySearch<T:Ljava/lang/Object;>(Ljava/util/List<+TT;>;TT;Ljava/util/Comparator<-TT;>;)I} [in Collections [in Collections.class [in java.util [in D:\a\JDKs\sun\1.5.0\jre\lib\rt.jar [in b140xxx]]]]]
                WARNING: this element does NOT exist!
        Accuracy: EXACT_MATCH
        Rule: EXACT
        Raw: false

Note that the method handle already didn't exist in this version... :-(

Markus, what's your mind about this issue?
Comment 3 Markus Keller CLA 2006-05-04 10:06:30 EDT
I don't think we will change our enablement tests because of this. It only happens on a few special binary methods, so it does not justify a workaround. Furthermore, I couldn't even reproduce in the UI (N20060504-0010 + JDT from around -0730).

-> fix it if you can do it safely, otherwise postpone to 3.3.
Comment 4 Frederic Fusier CLA 2006-05-04 10:47:09 EDT
Created attachment 40356 [details]
Proposed patch

Fix is quite simple...
Comment 5 Frederic Fusier CLA 2006-05-04 10:48:16 EDT
I confirm that using JDT/UI HEAD I didn't get any JME in the console
=> I think it's safer to postpone to 3.3
Comment 6 Frederic Fusier CLA 2006-05-12 03:52:51 EDT
Created attachment 41286 [details]
Complete patch (fix+tests) for bugs 95152, 123679 and 140156

The attached zip file includes patches for bug 95152, bug 123679 and bug 140156.
It also includes some jar files for binary test cases...
Comment 7 Frederic Fusier CLA 2006-05-16 08:58:02 EDT
Candidate for 3.2.1
Released in TARGET_321 stream.
Comment 8 Frederic Fusier CLA 2006-06-12 05:14:36 EDT
Released for 3.2.1
Released for 3.3 M1 while merging TARGET_321 in HEAD
Comment 9 Frederic Fusier CLA 2006-08-04 12:03:07 EDT
Verified for 3.3 M1 using build I20060804-0010.
Comment 10 Olivier Thomann CLA 2006-09-11 13:10:43 EDT
Verified for 3.2.1 using build M20060908-1655.
Comment 11 Frederic Fusier CLA 2007-12-18 05:24:00 EST
*** Bug 122653 has been marked as a duplicate of this bug. ***