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 64576 Details for
Bug 182930
JavaModelCache's size grows when displaying type hierarchy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
182930c.txt (text/plain), 6.77 KB, created by
Jerome Lanneluc
on 2007-04-23 04:45:47 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-04-23 04:45:47 EDT
Size:
6.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java,v >retrieving revision 1.45 >diff -u -r1.45 JavaProjectElementInfo.java >--- model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java 19 Apr 2007 08:27:09 -0000 1.45 >+++ model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java 23 Apr 2007 08:43:41 -0000 >@@ -33,12 +33,13 @@ > > /* package */ > class JavaProjectElementInfo extends OpenableElementInfo { >+ >+ static final IPackageFragmentRoot[] NO_ROOTS = new IPackageFragmentRoot[0]; > > static class ProjectCache { >- ProjectCache(IPackageFragmentRoot[] allPkgFragmentRootsCache, HashtableOfArrayToObject allPkgFragmentsCache, HashtableOfArrayToObject isPackageCache, Map rootToResolvedEntries) { >+ ProjectCache(IPackageFragmentRoot[] allPkgFragmentRootsCache, HashtableOfArrayToObject allPkgFragmentsCache, Map rootToResolvedEntries) { > this.allPkgFragmentRootsCache = allPkgFragmentRootsCache; > this.allPkgFragmentsCache = allPkgFragmentsCache; >- this.isPackageCache = isPackageCache; > this.rootToResolvedEntries = rootToResolvedEntries; > } > >@@ -72,13 +73,12 @@ > * Adds the given name and its super names to the given set > * (e.g. for {"a", "b", "c"}, adds {"a", "b", "c"}, {"a", "b"}, and {"a"}) > */ >- public static void addNames(String[] name, HashtableOfArrayToObject set) { >- set.put(name, name); >- int length = name.length; >+ public static void addSuperPackageNames(String[] pkgName, HashtableOfArrayToObject packageFragments) { >+ int length = pkgName.length; > for (int i = length-1; i > 0; i--) { >- String[] superName = new String[i]; >- System.arraycopy(name, 0, superName, 0, i); >- set.put(superName, superName); >+ System.arraycopy(pkgName, 0, pkgName = new String[i], 0, i); >+ if (packageFragments.get(pkgName) == null) >+ packageFragments.put(pkgName, NO_ROOTS); > } > } > >@@ -209,7 +209,6 @@ > > HashMap otherRoots = JavaModelManager.getJavaModelManager().deltaState.otherRoots; > HashtableOfArrayToObject fragmentsCache = new HashtableOfArrayToObject(); >- HashtableOfArrayToObject isPackageCache = new HashtableOfArrayToObject(); > for (int i = 0, length = roots.length; i < length; i++) { > IPackageFragmentRoot root = roots[i]; > IJavaElement[] frags = null; >@@ -230,11 +229,11 @@ > PackageFragment fragment= (PackageFragment) frags[j]; > String[] pkgName = fragment.names; > Object existing = fragmentsCache.get(pkgName); >- if (existing == null) { >+ if (existing == null || existing == NO_ROOTS) { > fragmentsCache.put(pkgName, root); >- // cache whether each package and its including packages (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161) >- // are actual packages >- addNames(pkgName, isPackageCache); >+ // ensure super packages (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161) >+ // are also in the map >+ addSuperPackageNames(pkgName, fragmentsCache); > } else { > if (existing instanceof PackageFragmentRoot) { > fragmentsCache.put(pkgName, new IPackageFragmentRoot[] {(PackageFragmentRoot) existing, root}); >@@ -248,7 +247,7 @@ > } > } > } >- cache = new ProjectCache(roots, fragmentsCache, isPackageCache, reverseMap); >+ cache = new ProjectCache(roots, fragmentsCache, reverseMap); > this.projectCache = cache; > } > return cache; >@@ -290,7 +289,7 @@ > */ > NameLookup newNameLookup(JavaProject project, ICompilationUnit[] workingCopies) { > ProjectCache cache = getProjectCache(project); >- return new NameLookup(cache.allPkgFragmentRootsCache, cache.allPkgFragmentsCache, cache.isPackageCache, workingCopies, cache.rootToResolvedEntries); >+ return new NameLookup(cache.allPkgFragmentRootsCache, cache.allPkgFragmentsCache, workingCopies, cache.rootToResolvedEntries); > } > > /* >Index: model/org/eclipse/jdt/internal/core/NameLookup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java,v >retrieving revision 1.112 >diff -u -r1.112 NameLookup.java >--- model/org/eclipse/jdt/internal/core/NameLookup.java 6 Oct 2006 17:42:56 -0000 1.112 >+++ model/org/eclipse/jdt/internal/core/NameLookup.java 23 Apr 2007 08:43:41 -0000 >@@ -125,12 +125,6 @@ > */ > protected HashtableOfArrayToObject packageFragments; > >- /* >- * A set of names (String[]) that are known to be package names. >- * Value is not null for known package. >- */ >- protected HashtableOfArrayToObject isPackageCache; >- > /** > * Reverse map from root path to corresponding resolved CP entry > * (so as to be able to figure inclusion/exclusion rules) >@@ -149,7 +143,6 @@ > public NameLookup( > IPackageFragmentRoot[] packageFragmentRoots, > HashtableOfArrayToObject packageFragments, >- HashtableOfArrayToObject isPackage, > ICompilationUnit[] workingCopies, > Map rootToResolvedEntries) { > long start = -1; >@@ -163,12 +156,10 @@ > this.packageFragmentRoots = packageFragmentRoots; > if (workingCopies == null) { > this.packageFragments = packageFragments; >- this.isPackageCache = isPackage; > } else { > // clone tables as we're adding packages from working copies > try { > this.packageFragments = (HashtableOfArrayToObject) packageFragments.clone(); >- this.isPackageCache = (HashtableOfArrayToObject) isPackage.clone(); > } catch (CloneNotSupportedException e1) { > // ignore (implementation of HashtableOfArrayToObject supports cloning) > } >@@ -213,11 +204,11 @@ > IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent(); > String[] pkgName = pkg.names; > Object existing = this.packageFragments.get(pkgName); >- if (existing == null) { >+ if (existing == null || existing == JavaProjectElementInfo.NO_ROOTS) { > this.packageFragments.put(pkgName, root); >- // cache whether each package and its including packages (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161) >- // are actual packages >- JavaProjectElementInfo.addNames(pkgName, this.isPackageCache); >+ // ensure super packages (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161) >+ // are also in the map >+ JavaProjectElementInfo.addSuperPackageNames(pkgName, this.packageFragments); > } else { > if (existing instanceof PackageFragmentRoot) { > if (!existing.equals(root)) >@@ -778,7 +769,7 @@ > } > > public boolean isPackage(String[] pkgName) { >- return this.isPackageCache.get(pkgName) != null; >+ return this.packageFragments.get(pkgName) != null; > } > > /**
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 182930
:
64162
| 64576 |
64656
|
64691
|
64707
|
65764