Community
Participate
Working Groups
I20060620 1. Create the following CU: import java.util.Collections; import java.util.LinkedList; public class SortedList<E extends Comparable> extends LinkedList<E> { public boolean add(E e){ int index = Collections.binarySearch(this,e); if (index<0) super.add(-index-1,e); return true; } } 2. Select 'binarySearch' 3. Press F3 Observe: Collections.class is open, but binarySeach(...) is not selected.
Smells like a source mapper issue.
Actually, even simpler steps. Open type on 'java.util.Collections' Select #binarySearch(List<? extends Comparable<? super T>>, T)<T> in outliner Observe nothing occurs... (no scrolling in editor)
Tempting for 3.2.1
The problem comes from the method getUnqualifiedMethodHandle(...) in SourceMapper that doesn't recognize the signature of this method. When the simple name is extracted, the + is not persisted. Then when the signature is rebuilt, it is considered to be invalid. I'll investigate a fix.
The method getUnqualifiedMethodHandle(IMethod, boolean) seems to be completely boggus. It doesn't handle well the type parameters that could be nested and the usage of nested types. See the first result below. Here is some output of the qualified name, simple name and resulting unqualified name. Note that some identical entries for the qualified name and the simple name don't result in the same unqualified name. --------------------------------------------------------- Qualified name = Ljava.util.Map$Entry<TK;TV;>; Simple name = Map$Entry<TK;TV;>; Unqualified name = QMap$Entry<QK;QV;>; --------------------------------------------------------- Qualified name = Ljava.util.Map$Entry<TK;TV;>; Simple name = Map$Entry<TK;TV;>; Unqualified name = QEntry<QK;QV;>; --------------------------------------------------------- Qualified name = Ljava.util.Collection<+Ljava.util.Map$Entry<TK;TV;>;>; Simple name = Collection<Map$Entry<TK;TV;>;>; Unqualified name = QCollection<Map$Entry<QK;QV;>;>; --------------------------------------------------------- Qualified name = Ljava.util.Collection<+Ljava.util.Map$Entry<TK;TV;>;>; Simple name = Collection<Map$Entry<TK;TV;>;>; Unqualified name = QEntry<QK;QV;>;>; or: Qualified name = Ljava.util.List<+Ljava.lang.Comparable<-TT;>;>; Simple name = List<Comparable<-TT;>;>; Unqualified name = QList<Comparable<-QT;>;>; for the method referenced in this PR. Note the missing Q in the unqualified name. If the result would be: Unqualified name = QList<+QComparable<-QT;>;>; Then it would find the source range of the method.
Created attachment 45322 [details] Proposed fix Jérôme, Could you please review it?
Created attachment 45324 [details] Regression test Regression test for simple name signature.
In Signature#appendSimpleName(...), shouldn't the code be: if (name[start] == C_EXTENDS || name[start] == C_C_SUPER) { buffer.append(name[start]); } instead of if (name[start] == C_EXTENDS || name[start] == C_EXTENDS) { buffer.append(name[start]); } ? Otherwise the patch looks good.
Yes, my mistake. This is why it is good to have a review :-). I'll fix it and release it in HEAD. So Philippe, do you want it for 3.2.1 or I leave it there only for 3.3?
Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.model.SignatureTests.testGetSimpleName
If the fix is safe, I think we should put it in 3.2.1 as well, since it hurts when broken (many features are no longer performing). Olivier is the broken scenario very rare or not ?
*** Bug 88023 has been marked as a duplicate of this bug. ***
Released for 3.3 M1. I don't think the fix is risky. Jérôme, any thoughts on this? With the usage of generics, this case might not be rare (usage of wildcard is required however).
Agree to backport the fix to 3.2.1
+1 for 3.2.1
Verified for 3.3 M1 using build I20060807-2000. Not clear if this bug is a duplicate of bug 100093 or bug 129317 or if this is a separated issue... Looking at bug description I would expect a duplicate but it seems that there was a specific fix, perhaps any redondant changes in the code? I think it should be revewied carefully for 3.2.1...
reopening as not yet fixed in 3.2.1 target
Released for 3.2.1. Regression test added in org.eclipse.jdt.core.tests.model.SignatureTests.testGetSimpleName
Verified for 3.2.1 using build M20060908-1655
*** Bug 157081 has been marked as a duplicate of this bug. ***