Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 44653 Details for
Bug 139555
[hierarchy] Opening a class from Type hierarchy will give the wrong one if source and compiled are in defined in project
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
139555.txt (text/plain), 7.06 KB, created by
Jerome Lanneluc
on 2006-06-16 11:27:15 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2006-06-16 11:27:15 EDT
Size:
7.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java,v >retrieving revision 1.97 >diff -u -r1.97 IndexBasedHierarchyBuilder.java >--- model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 29 Mar 2006 03:14:01 -0000 1.97 >+++ model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 16 Jun 2006 15:29:12 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; > import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; >+import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt; > import org.eclipse.jdt.internal.compiler.util.SuffixConstants; > import org.eclipse.jdt.internal.core.*; > import org.eclipse.jdt.internal.core.search.IndexQueryRequestor; >@@ -137,13 +138,40 @@ > } > } > private void buildForProject(JavaProject project, ArrayList potentialSubtypes, org.eclipse.jdt.core.ICompilationUnit[] workingCopies, HashSet localTypes, IProgressMonitor monitor) throws JavaModelException { >- // copy vectors into arrays >- int openablesLength = potentialSubtypes.size(); >- Openable[] openables = new Openable[openablesLength]; >- potentialSubtypes.toArray(openables); >- > // resolve >+ int openablesLength = potentialSubtypes.size(); > if (openablesLength > 0) { >+ // copy vectors into arrays >+ Openable[] openables = new Openable[openablesLength]; >+ potentialSubtypes.toArray(openables); >+ >+ // sort in the order of roots and in reverse alphabetical order for .class file >+ // since requesting top level types in the process of caching an enclosing type is >+ // not supported by the lookup environment >+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots(); >+ int rootsLength = roots.length; >+ final HashtableOfObjectToInt indexes = new HashtableOfObjectToInt(openablesLength); >+ for (int i = 0; i < openablesLength; i++) { >+ IJavaElement root = openables[i].getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); >+ int index; >+ for (index = 0; index < rootsLength; index++) { >+ if (roots[index].equals(root)) >+ break; >+ } >+ indexes.put(openables[i], index); >+ } >+ Util.sort(openables, new Util.Comparer() { >+ public int compare(Object a, Object b) { >+ int aIndex = indexes.get(a); >+ int bIndex = indexes.get(b); >+ if (aIndex < bIndex) >+ return -1; >+ else if (aIndex > bIndex) >+ return 1; >+ return ((Openable) b).getElementName().compareTo(((Openable) a).getElementName()); >+ } >+ }); >+ > IType focusType = this.getType(); > boolean inProjectOfFocusType = focusType != null && focusType.getJavaProject().equals(project); > org.eclipse.jdt.core.ICompilationUnit[] unitsToLookInside = null; >@@ -240,17 +268,7 @@ > length++; > } > >- // sort by projects >- /* >- * NOTE: To workaround pb with hierarchy resolver that requests top >- * level types in the process of caching an enclosing type, this needs to >- * be sorted in reverse alphabetical order so that top level types are cached >- * before their inner types. >- */ >- org.eclipse.jdt.internal.core.util.Util.sortReverseOrder(allPotentialSubTypes); >- > ArrayList potentialSubtypes = new ArrayList(); >- > try { > // create element infos for subtypes > HandleFactory factory = new HandleFactory(); >Index: model/org/eclipse/jdt/internal/core/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v >retrieving revision 1.96 >diff -u -r1.96 Util.java >--- model/org/eclipse/jdt/internal/core/util/Util.java 9 Jun 2006 11:25:03 -0000 1.96 >+++ model/org/eclipse/jdt/internal/core/util/Util.java 16 Jun 2006 15:29:13 -0000 >@@ -1616,39 +1616,6 @@ > } > > /** >- * Sort the objects in the given collection using the given sort order. >- */ >- private static void quickSort(Object[] sortedCollection, int left, int right, int[] sortOrder) { >- int original_left = left; >- int original_right = right; >- int mid = sortOrder[ (left + right) / 2]; >- do { >- while (sortOrder[left] < mid) { >- left++; >- } >- while (mid < sortOrder[right]) { >- right--; >- } >- if (left <= right) { >- Object tmp = sortedCollection[left]; >- sortedCollection[left] = sortedCollection[right]; >- sortedCollection[right] = tmp; >- int tmp2 = sortOrder[left]; >- sortOrder[left] = sortOrder[right]; >- sortOrder[right] = tmp2; >- left++; >- right--; >- } >- } while (left <= right); >- if (original_left < right) { >- quickSort(sortedCollection, original_left, right, sortOrder); >- } >- if (left < original_right) { >- quickSort(sortedCollection, left, original_right, sortOrder); >- } >- } >- >- /** > * Sort the strings in the given collection. > */ > private static void quickSort(String[] sortedCollection, int left, int right) { >@@ -1679,35 +1646,6 @@ > } > > /** >- * Sort the strings in the given collection in reverse alphabetical order. >- */ >- private static void quickSortReverse(String[] sortedCollection, int left, int right) { >- int original_left = left; >- int original_right = right; >- String mid = sortedCollection[ (left + right) / 2]; >- do { >- while (sortedCollection[left].compareTo(mid) > 0) { >- left++; >- } >- while (mid.compareTo(sortedCollection[right]) > 0) { >- right--; >- } >- if (left <= right) { >- String tmp = sortedCollection[left]; >- sortedCollection[left] = sortedCollection[right]; >- sortedCollection[right] = tmp; >- left++; >- right--; >- } >- } while (left <= right); >- if (original_left < right) { >- quickSortReverse(sortedCollection, original_left, right); >- } >- if (left < original_right) { >- quickSortReverse(sortedCollection, left, original_right); >- } >- } >- /** > * Reads in a string from the specified data input stream. The > * string has been encoded using a modified UTF-8 format. > * <p> >@@ -1923,14 +1861,6 @@ > } > > /** >- * Sorts an array of objects in place, using the sort order given for each item. >- */ >- public static void sort(Object[] objects, int[] sortOrder) { >- if (objects.length > 1) >- quickSort(objects, 0, objects.length - 1, sortOrder); >- } >- >- /** > * Sorts an array of strings in place using quicksort. > */ > public static void sort(String[] strings) { >@@ -1991,15 +1921,6 @@ > return copy; > } > >- /** >- * Sorts an array of strings in place using quicksort >- * in reverse alphabetical order. >- */ >- public static void sortReverseOrder(String[] strings) { >- if (strings.length > 1) >- quickSortReverse(strings, 0, strings.length - 1); >- } >- > /* > * Returns whether the given compound name starts with the given prefix. > * Returns true if the n first elements of the prefix are equals and the last element of the
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 139555
: 44653 |
44656