Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed Dec 10, 2024
1 parent 2ff1a47 commit b785b2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1177,27 +1177,27 @@ public IBinding[] createBindings(IJavaElement[] elements, IProgressMonitor monit
static IBinding[] resolve(
final IJavaElement[] elements,
int apiLevel,
Map compilerOptions,
Map<String,String> compilerOptions,
IJavaProject javaProject,
WorkingCopyOwner owner,
int flags,
ICompilationUnitResolver unitResolver,
IProgressMonitor monitor) {

final int length = elements.length;
final HashMap sourceElementPositions = new HashMap(); // a map from ICompilationUnit to int[] (positions in elements)
final HashMap<ICompilationUnit, IntArrayList> sourceElementPositions = new HashMap<>(); // a map from ICompilationUnit to int[] (positions in elements)
int cuNumber = 0;
final HashtableOfObjectToInt binaryElementPositions = new HashtableOfObjectToInt(); // a map from String (binding key) to int (position in elements)
for (int i = 0; i < length; i++) {
IJavaElement element = elements[i];
if (!(element instanceof SourceRefElement))
throw new IllegalStateException(element + " is not part of a compilation unit or class file"); //$NON-NLS-1$
Object cu = element.getAncestor(IJavaElement.COMPILATION_UNIT);
if (cu != null) {
if (cu != null && cu instanceof ICompilationUnit cu2) {
// source member
IntArrayList intList = (IntArrayList) sourceElementPositions.get(cu);
IntArrayList intList = sourceElementPositions.get(cu2);
if (intList == null) {
sourceElementPositions.put(cu, intList = new IntArrayList());
sourceElementPositions.put(cu2, intList = new IntArrayList());
cuNumber++;
}
intList.add(i);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ class Requestor extends ASTRequestor {
@Override
public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
// TODO (jerome) optimize to visit the AST only once
IntArrayList intList = (IntArrayList) sourceElementPositions.get(source);
IntArrayList intList = sourceElementPositions.get(source);
for (int i = 0; i < intList.length; i++) {
final int index = intList.list[i];
SourceRefElement element = (SourceRefElement) elements[index];
Expand Down

0 comments on commit b785b2e

Please sign in to comment.