Lines 122-132
Link Here
|
122 |
public long timeSpentInSeekTypesInSourcePackage = 0; |
122 |
public long timeSpentInSeekTypesInSourcePackage = 0; |
123 |
|
123 |
|
124 |
public NameLookup(IPackageFragmentRoot[] packageFragmentRoots, HashtableOfArrayToObject packageFragments, ICompilationUnit[] workingCopies, Map rootToResolvedEntries) { |
124 |
public NameLookup(IPackageFragmentRoot[] packageFragmentRoots, HashtableOfArrayToObject packageFragments, ICompilationUnit[] workingCopies, Map rootToResolvedEntries) { |
|
|
125 |
long start = -1; |
125 |
if (VERBOSE) { |
126 |
if (VERBOSE) { |
126 |
System.out.println(Thread.currentThread() + " BUILDING NameLoopkup"); //$NON-NLS-1$ |
127 |
System.out.println(Thread.currentThread() + " BUILDING NameLoopkup"); //$NON-NLS-1$ |
127 |
System.out.println(Thread.currentThread() + " -> pkg roots size: " + (packageFragmentRoots == null ? 0 : packageFragmentRoots.length)); //$NON-NLS-1$ |
128 |
System.out.println(Thread.currentThread() + " -> pkg roots size: " + (packageFragmentRoots == null ? 0 : packageFragmentRoots.length)); //$NON-NLS-1$ |
128 |
System.out.println(Thread.currentThread() + " -> pkgs size: " + (packageFragments == null ? 0 : packageFragments.size())); //$NON-NLS-1$ |
129 |
System.out.println(Thread.currentThread() + " -> pkgs size: " + (packageFragments == null ? 0 : packageFragments.size())); //$NON-NLS-1$ |
129 |
System.out.println(Thread.currentThread() + " -> working copy size: " + (workingCopies == null ? 0 : workingCopies.length)); //$NON-NLS-1$ |
130 |
System.out.println(Thread.currentThread() + " -> working copy size: " + (workingCopies == null ? 0 : workingCopies.length)); //$NON-NLS-1$ |
|
|
131 |
start = System.currentTimeMillis(); |
130 |
} |
132 |
} |
131 |
this.packageFragmentRoots = packageFragmentRoots; |
133 |
this.packageFragmentRoots = packageFragmentRoots; |
132 |
try { |
134 |
try { |
Lines 176-194
Link Here
|
176 |
this.packageFragments.put(pkgName, root); |
178 |
this.packageFragments.put(pkgName, root); |
177 |
} else { |
179 |
} else { |
178 |
if (existing instanceof PackageFragmentRoot) { |
180 |
if (existing instanceof PackageFragmentRoot) { |
179 |
this.packageFragments.put(pkgName, new IPackageFragmentRoot[] {(PackageFragmentRoot) existing, root}); |
181 |
if (!existing.equals(root)) |
|
|
182 |
this.packageFragments.put(pkgName, new IPackageFragmentRoot[] {(PackageFragmentRoot) existing, root}); |
180 |
} else { |
183 |
} else { |
181 |
IPackageFragmentRoot[] roots = (IPackageFragmentRoot[]) existing; |
184 |
IPackageFragmentRoot[] roots = (IPackageFragmentRoot[]) existing; |
182 |
int rootLength = roots.length; |
185 |
int rootLength = roots.length; |
183 |
System.arraycopy(roots, 0, roots = new IPackageFragmentRoot[rootLength+1], 0, rootLength); |
186 |
boolean containsRoot = false; |
184 |
roots[rootLength] = root; |
187 |
for (int j = 0; j < rootLength; j++) { |
185 |
this.packageFragments.put(pkgName, roots); |
188 |
if (roots[j].equals(root)) { |
|
|
189 |
containsRoot = true; |
190 |
break; |
191 |
} |
192 |
} |
193 |
if (containsRoot) { |
194 |
System.arraycopy(roots, 0, roots = new IPackageFragmentRoot[rootLength+1], 0, rootLength); |
195 |
roots[rootLength] = root; |
196 |
this.packageFragments.put(pkgName, roots); |
197 |
} |
186 |
} |
198 |
} |
187 |
} |
199 |
} |
188 |
visited.add(root); |
200 |
visited.add(root); |
189 |
} |
201 |
} |
190 |
} |
202 |
} |
191 |
this.rootToResolvedEntries = rootToResolvedEntries; |
203 |
this.rootToResolvedEntries = rootToResolvedEntries; |
|
|
204 |
if (VERBOSE) { |
205 |
System.out.println(Thread.currentThread() + " -> spent: " + (start - System.currentTimeMillis()) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
206 |
} |
192 |
} |
207 |
} |
193 |
|
208 |
|
194 |
/** |
209 |
/** |