Skip to content

Commit

Permalink
Fix regressions ASTConverterAST3Test.test0009 and others; also 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 authored and robstryker committed Dec 11, 2024
1 parent 3fdb0c2 commit 3dda5a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,22 +541,12 @@ public CompilationUnit toCompilationUnit(org.eclipse.jdt.internal.compiler.env.I
pathToUnit.put(pathOfClassUnderAnalysis, sourceUnit);
}

// TODO currently only parse
//CompilationUnit res2 = CompilationUnitResolver.getInstance().toCompilationUnit(sourceUnit, resolveBindings, project, classpaths, focalPoint, apiLevel, compilerOptions, typeRootWorkingCopyOwner, typeRootWorkingCopyOwner, flags, monitor);
CompilationUnit res = parse(pathToUnit.values().toArray(org.eclipse.jdt.internal.compiler.env.ICompilationUnit[]::new),
apiLevel, compilerOptions, resolveBindings, flags, project, workingCopyOwner, focalPoint, monitor).get(sourceUnit);
if (resolveBindings) {
resolveBindings(res, apiLevel);
}
// For comparison
// CompilationUnit res2 = CompilationUnitResolver.FACADE.toCompilationUnit(sourceUnit, initialNeedsToResolveBinding, project, classpaths, nodeSearcher, apiLevel, compilerOptions, typeRootWorkingCopyOwner, typeRootWorkingCopyOwner, flags, monitor);
// //res.typeAndFlags=res2.typeAndFlags;
// String res1a = res.toString();
// String res2a = res2.toString();
//
// AnnotationTypeDeclaration l1 = (AnnotationTypeDeclaration)res.types().get(0);
// AnnotationTypeDeclaration l2 = (AnnotationTypeDeclaration)res2.types().get(0);
// Object o1 = l1.bodyDeclarations().get(0);
// Object o2 = l2.bodyDeclarations().get(0);
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,6 @@ private ArrayInitializer createArrayInitializerFromJCNewArray(JCNewArray jcNewAr
commonSettings(initializer, jcNewArray);
if (!jcNewArray.getInitializers().isEmpty()) {
jcNewArray.getInitializers().stream().map(this::convertExpression).filter(Objects::nonNull).forEach(initializer.expressions()::add);
this.rawText.charAt(0);
int start = ((Expression)initializer.expressions().getFirst()).getStartPosition() - 1;
while (start >= 0 && this.rawText.charAt(start) != '{') {
start--;
Expand All @@ -2012,7 +2011,7 @@ private ArrayInitializer createArrayInitializerFromJCNewArray(JCNewArray jcNewAr
while (end < this.rawText.length() && this.rawText.charAt(end) != '}') {
end++;
}
initializer.setSourceRange(start, end - start);
initializer.setSourceRange(start, end - start + 1);
}
return initializer;
}
Expand Down

0 comments on commit 3dda5a5

Please sign in to comment.