Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute problems #2052

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3a12d40
ASTParser.createAST looses ability to resolve some bindings
mickaelistria Jan 29, 2024
ae5076d
Switch to make some operations rely on DOM instead of ECJ
mickaelistria Jan 12, 2024
e2555a1
Set methods with null return type to have "void" return type
datho7561 Feb 7, 2024
ddbb871
Add specific GH workflow for DOM-first and Javac
mickaelistria Feb 9, 2024
0a45d93
[DOM to Model] Support default value, deprecated, and more
datho7561 Feb 9, 2024
5ef3b46
Test execution report
mickaelistria Feb 10, 2024
52e7ecc
Fix NPE with importContainer
mickaelistria Feb 12, 2024
975aca2
DOM to Model: better support for TypeParameters
mickaelistria Feb 12, 2024
990744a
Fixes to `DOMToModelPopulator` to address test failures in `Compilati…
datho7561 Feb 12, 2024
aaa7843
Keep track of types declared local to a method
datho7561 Feb 12, 2024
553b7f7
[DOM to Model] fix exception and varargs translation
mickaelistria Feb 13, 2024
0484f6a
[DOM To Model] Improve some types
mickaelistria Feb 13, 2024
ea9744f
Record anonymous classes in model
datho7561 Feb 12, 2024
e94788f
[DOM To Model] Fix some flags
mickaelistria Feb 13, 2024
737db3c
Fix regression caused by superclass fix
datho7561 Feb 14, 2024
c616e8f
[DOM To Model] Pass compiler options to ASTParser
mickaelistria Feb 14, 2024
30b1564
[DOM To Model] better support for record and constructors
mickaelistria Feb 15, 2024
24ed9fb
[DOM To Model] Set field constants
mickaelistria Feb 16, 2024
741e317
[DOM To Model] Fix processing Class with sources
mickaelistria Feb 16, 2024
f521f4a
Fix not reporting problems directly when a placeholder is provided
mickaelistria Feb 16, 2024
1656b25
[DOM To Model] Fix LocalVariable type signature
mickaelistria Feb 16, 2024
2aec28b
[DOM To Model] Fix when astLevel == 0
mickaelistria Feb 18, 2024
f6eebd9
Honor ICompilationUnit.IGNORE_METHOD_BODIES
mickaelistria Feb 18, 2024
a125ef4
codeSelect support more binding types
mickaelistria Feb 19, 2024
28fc268
Fix node used by codeSelect
mickaelistria Feb 19, 2024
c42b1ae
[DOM To Model] buildStructure better honor computeProblems
mickaelistria Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci-dom-javac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Continuous Integration with DOM/Javac
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-dom
cancel-in-progress: true

on:
push:
branches: [ 'dom-based-operations', 'dom-with-javac' ]
pull_request:
branches: [ 'dom-based-operations', 'dom-with-javac' ]

jobs:
build-dom-javac:
runs-on: ubuntu-latest
steps:
- name: Install xmllint
shell: bash
run: |
sudo apt update
sudo apt install -y libxml2-utils
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Enable DOM-first and Javac
run: sed -i 's$</argLine>$ -DCompilationUnit.DOM_BASED_OPERATIONS=true -DSourceIndexer.DOM_BASED_INDEXER=false -DICompilationUnitResolver=org.eclipse.jdt.core.dom.JavacCompilationUnitResolver -DAbstractImageBuilder.compiler=org.eclipse.jdt.internal.javac.JavacCompiler_</argLine>$g' */pom.xml
- name: Set up JDKs ☕
uses: actions/setup-java@v3
with:
java-version: |
8
17
20
mvn-toolchain-id: |
JavaSE-1.8
JavaSE-17
JavaSE-20
distribution: 'temurin'
- name: Set up Maven
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
with:
maven-version: 3.9.3
- name: Build with Maven 🏗️
run: |
mvn clean install --batch-mode -f org.eclipse.jdt.core.compiler.batch -DlocalEcjVersion=99.99
mvn -U clean verify --batch-mode --fail-at-end -Ptest-on-javase-20 -Pbree-libs -Papi-check -Djava.io.tmpdir=$WORKSPACE/tmp -Dproject.build.sourceEncoding=UTF-8 -Dtycho.surefire.argLine="--add-modules ALL-SYSTEM -Dcompliance=1.8,11,17,20 -Djdt.performance.asserts=disabled" -Dcbi-ecj-version=99.99
- name: Test Report
if: success() || failure() # run this step even if previous step failed
run: |
echo ▶️ TESTS RUN: $(xmllint --xpath 'string(/testsuite/@tests)' */target/surefire-reports/TEST-*.xml | awk '{n += $1}; END{print n}' -)
echo ❌ FAILURES: $(xmllint --xpath 'string(/testsuite/@failures)' */target/surefire-reports/TEST-*.xml | awk '{n += $1}; END{print n}' -)
echo 💥 ERRORS: $(xmllint --xpath 'string(/testsuite/@errors)' */target/surefire-reports/TEST-*.xml | awk '{n += $1}; END{print n}' -)
echo 🛑 SKIPPED: $(xmllint --xpath 'string(/testsuite/@skipped)' */target/surefire-reports/TEST-*.xml | awk '{n += $1}; END{print n}' -)
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.BindingKey;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -7866,13 +7867,13 @@ public void test0238() throws JavaModelException {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=173338
*/
public void test0238_2() throws JavaModelException {
this.workingCopy = getWorkingCopy("/Converter15/src/test0238/X.java", true/*resolve*/);
String contents =
"package test0238;\n" +
"public class X extends A {\n" +
"}";
this.workingCopy = getWorkingCopy("/Converter15/src/test0238/X.java",
"""
package test0238;
public class X extends A {
}""", true/*resolve*/);
ASTNode node = buildAST(
contents,
this.workingCopy.getSource(),
this.workingCopy,
false,
false,
Expand All @@ -7891,6 +7892,29 @@ public void test0238_2() throws JavaModelException {
assertEquals("wrong size", 2, methodBindings.length);
}

/*
* https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1915
*/
public void test0238_ASTParser() throws JavaModelException, CoreException {
this.workingCopy = getWorkingCopy("/Converter15/src/test0238/X.java",
"""
package test0238;
public class X extends A {
}
""", true /*resolve*/);
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());
parser.setBindingsRecovery(true);
parser.setResolveBindings(true);
parser.setStatementsRecovery(true);
parser.setSource(this.workingCopy);
parser.setProject(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject("Converter15")));
CompilationUnit unit = (CompilationUnit) parser.createAST(null);
TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().get(0);
ITypeBinding superTypeBinding = typeDeclaration.resolveBinding().getSuperclass();
IMethodBinding[] methodBindings = superTypeBinding.getDeclaredMethods();
assertEquals("wrong size", 2, methodBindings.length);
}

/*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=173338
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,9 @@ private CompilationUnitDeclaration resolve(
if (unit == null) {
unit = this.unitsToProcess[0]; // fall back to old behavior
}
if (this.totalUnits == 1 && this.lookupEnvironment.unitBeingCompleted == null) {
this.lookupEnvironment.unitBeingCompleted = unit;
}
} else {
// initial type binding creation
this.lookupEnvironment.buildTypeBindings(unit, null /*no access restriction*/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.jdt.core.dom.CompilationUnit;

public class ASTHolderCUInfo extends CompilationUnitElementInfo {
int astLevel;
public int astLevel;
boolean resolveBindings;
int reconcileFlags;
Map<String, CategorizedProblem[]> problems = null;
Expand Down
Loading
Loading