This repository packages Eclipse's Java Development Tools (JDT) for SonarJava, including patches needed by the Java analyzer. The maintenance instructions below explain how to update JDT and test the resulting package with SonarJava.
To learn more about Sonar’s Java analysis, visit the Sonar website.
This repository exists because we need to patch some files from Eclipse JDT to fix some issues, but we can only do this in a repository with the same license as Eclipse.
When a new version of JDT is released, we update the dependency and reapply the complete ordered patch series in patches/series.
Eclipse Public License - v 2.0 see LICENSE.
scripts/jdt.py is the entry point for updating JDT, maintaining SonarJava's patches,
building the shaded package, and reproducing bugs against an upstream JDT branch.
scripts/patch.py handles patch maintenance and packaging, scripts/build.py handles work on upstream
branches, and scripts/eclipseDrop.py imports artifacts from Eclipse.
Most of JDT is packaged directly from Maven dependencies. This repository also contains complete copies of a few upstream classes:
ASTParser, ClasspathJar, ClasspathJmod, ClasspathMultiReleaseJar, ProblemHandler, and ProblemReporter. Maven compiles these local copies and includes them as
replacements for the original classes in jdt-package. Each copy contains the upstream implementation plus small changes needed by SonarJava.
Updating only the dependency version would leave these replacements based on an older implementation; replacing them with pristine
upstream sources would discard the SonarJava fixes. The tool updates both parts together by applying the complete patch series to
the new upstream sources.
The files involved have distinct roles:
| File or directory | Role |
|---|---|
| pom.xml | Selects the JDT Core dependency that Maven packages. |
| patches/upstream.json | Records the upstream baseline: JDT Core and ECJ versions, SHA-256 checksums of their POMs and source JARs, and the source files to replace. |
| patches/series | Lists every active patch in application order, including patches that depend on earlier ones. |
patches/*.patch |
Describe the individual SonarJava changes to upstream code, grouped by purpose and independent of Git commit history. |
| src/main/java/org/eclipse/jdt/ | Contains the patched replacement classes that Maven compiles, together with separately maintained local helpers. |
For the replacement classes listed in the manifest, the tool enforces this relationship:
Pinned upstream sources + patches applied in series order = checked-in replacement sources
The checked-in replacement sources make ordinary Maven builds and IDE use straightforward. The patches record how to recreate those
sources and carry the fixes forward to another release. A reconstruction check compares the recreated files byte for byte with the
checked-in copies, catching changes that were made on only one side. Local helpers such as SystemReleaseClasspath.java are maintained
as ordinary project source; they are preserved during upgrades and are not reconstructed from upstream.
- Release baselines use official JDT releases from Maven Central or the configured Maven repository. The tool reads the
matching ECJ version from JDT Core's published POM. For example, Core
3.47.0uses ECJ3.46.100. See JDT Core releases and ECJ releases on Maven Central. - Preview baselines use timestamped Eclipse drops for release candidates (
RC) or builds from branches that add support for upcoming Java versions (Ybuilds). Each baseline pins the exact build, matching Core and ECJ binaries and sources, generated Maven POMs, Platform dependency versions, and the minimum Java version. See the Eclipse 4.42 RC2 drop and the Beta Java 28 drop.
Run the tool with Python 3.9+ and Git installed. The examples below assume the repository root as the working directory:
Command after python3 scripts/jdt.py |
What it does |
|---|---|
check |
Verifies the current dependency version, pinned artifact checksums, patch list, and exact reconstruction of the replacement sources. Leaves project files untouched. |
update VERSION or update --eclipse-build-url URL |
Reapplies and refreshes the patches for a released JDT version or an Eclipse preview, then writes the verified sources, patches, baseline metadata, and dependency version. |
edit PATCH.patch |
Opens a temporary workspace for changing an existing patch, or appending a new patch. Prints where to edit the Java sources and how to continue. Project files are updated only after continuation succeeds. |
continue WORKSPACE |
Resumes an update, patch edit, or experimental package using the workspace record. |
continue --drop WORKSPACE |
Explicitly removes an empty pending patch, for example when upstream has incorporated the fix, and resumes the remaining patches. |
prepare |
Installs the pinned preview artifacts into the Maven repository used by the next build. |
checkout, build, test |
Check out and build an upstream JDT branch and run targeted upstream tests. |
package |
Build and test a shaded JAR in a temporary workspace using a release, an Eclipse preview, or a captured local build. |
Run python3 scripts/jdt.py --help for the command list, or add --help after a command for its options.
The update and edit commands write working-tree files after successful reconstruction. Git staging, commits, and pushes are manual.
CI runs the reconstruction check and prepares the pinned preview artifacts before Maven.
The Eclipse IDE follows a quarterly release schedule (typically March, June, September, December). You can find the release history on wikipedia.
Compare the org.eclipse.jdt:org.eclipse.jdt.core version in pom.xml with the published releases at:
- https://central.sonatype.com/artifact/org.eclipse.jdt/org.eclipse.jdt.core
- https://mvnrepository.com/artifact/org.eclipse.jdt/org.eclipse.jdt.core
# Verify the existing dependency, baseline checksums, complete patch series, and generated sources.
python3 scripts/jdt.py check
# Replace 3.47.0 with the target published JDT Core release.
python3 scripts/jdt.py update 3.47.0For a release baseline, both commands first read artifacts from ~/.m2/repository and download missing ones into a temporary workspace, retrying transient
failures (network errors, HTTP 429 and 5xx) up to three times. Downloads come from Maven Central by default. When
SONARSOURCE_REPOSITORY_URL is set, as the build-maven action does in CI, they come from that repox repository instead, authenticated
with ARTIFACTORY_ACCESS_TOKEN (and ARTIFACTORY_USERNAME) over HTTPS only; use --repository-url URL to select another repository
(credentials are never sent to it). The tool never writes to the local Maven repository for these commands. Use --offline to require cached artifacts, or
--maven-repo PATH to select a different local repository. These options follow the command, for example
python3 scripts/jdt.py check --offline.
update VERSION also compares its POMs and source JARs (including cached ones) with the .sha1 files published next to them in the
repository, so a corrupted or tampered local copy cannot become the new baseline. With --offline this verification is impossible and
the tool prints a warning. check additionally verifies that the maven-shade-plugin filter for org.eclipse.jdt:* in pom.xml
excludes the .class and .java files of every replacement source, so the shaded jar cannot contain the unpatched upstream classes.
An update proceeds in a temporary workspace:
- Reconstruct and verify the current replacement sources before attempting to upgrade them.
- Resolve the target JDT Core and ECJ versions and obtain the pristine replacement sources from their published artifacts.
- Apply every patch in
patches/seriesin order. Regenerate each successful patch against the target sources while preserving its description and its place in the series. If a patch conflicts, pause for the manual resolution described below. - Verify that the refreshed series recreates the staged result, then write the replacement sources,
pom.xml, patches, andpatches/upstream.jsonback to the project together.
Refreshing a patch updates its diff to match the new upstream implementation; it preserves the edits introduced by that patch.
Successful textual application still needs behavioral validation through the tests and downstream checks described below.
When switching between upstream lines, a fix already present in the current baseline can be missing
from the target. For example, 4.42 RC2 includes the archive caching fix from patch 0005, while the
Java 28 Y build used below still needs it. Restore the missing change through edit and rerun mvn verify.
Choose a timestamped RC or Y build using the Eclipse build selection instructions.
Pass its download page URL to update to pin the preview in this checkout. After resolving any patch
conflicts, build with the JDK reported by prepare --print-java-version or a newer one; prepare itself runs on any JDK.
python3 scripts/jdt.py update --eclipse-build-url https://download.eclipse.org/eclipse/downloads/drops4/Y20261125-1500/
python3 scripts/jdt.py check
python3 scripts/jdt.py prepare --java-home "$JAVA_HOME"
mvn verifyprepare installs the exact bundles pinned in patches/upstream.json into ~/.m2/repository by default, the only command here
that writes to the local Maven repository, and warns before replacing a different artifact with the same coordinates. If you use --maven-repo PATH,
pass the same path to Maven with -Dmaven.repo.local=PATH. Retain the downloaded preview artifacts in
workdir/patched-jdt/eclipse-rc/ if the build needs to remain reproducible after Eclipse removes the
drop. Point --rc-cache at the restored cache and use --offline to require the retained files.
Use update VERSION to return to a published release.
If a patch cannot be applied, the command exits unsuccessfully and prints the retained workspace path. Project files have not been
changed. work/ contains the target upstream sources with all earlier patches applied; before/ is the state immediately before
the pending patch. Application uses git apply --check before git apply, without partial .rej application.
- Inspect the named patch under the workspace's
patches/directory and the upstream changes. - Edit the managed Java files in
WORKSPACE/work/to implement that patch's intended behavior. Preserve the earlier patches. - Update its description in
WORKSPACE/patches/PATCH.patchif needed; the diff is regenerated from the edited Java files. - Resume with:
python3 scripts/jdt.py continue WORKSPACEPrinted continuation commands use the current Python interpreter and absolute paths, so they can be run from any directory.
The tool refreshes only the pending patch and then applies the remaining patches in order. A later conflict pauses in the same way.
If upstream has incorporated a patch completely, leave work/ identical to before/ for that step and explicitly remove it with:
python3 scripts/jdt.py continue --drop WORKSPACEAn empty pending patch is otherwise an error, so accidentally continuing an unresolved conflict cannot silently discard a fix. To abandon a staged update, discard its temporary workspace; project files are updated only after all patches have been resolved and verified.
Use the checkout, build, and test commands to develop upstream JDT and reproduce bugs on a specific branch.
Install Python 3.9+, Git, and Maven. The current BETA_JAVA28 branch requires Java 25
or newer; set JAVA_HOME accordingly. Packaging published releases normally needs
Java 21 or newer. The commands below run from this repository root, but script paths
and workspaces are resolved relative to the scripts, independently of your current directory.
# Clone and create a local tracking branch, without building:
python3 scripts/jdt.py checkout BETA_JAVA28
# Build the branch, including local commits and uncommitted changes:
python3 scripts/jdt.py build BETA_JAVA28 --java-home "$JAVA_HOME"
# After editing the checkout, rebuild its current branch or detached revision:
python3 scripts/jdt.py build --java-home "$JAVA_HOME"The checkout is in workdir/local-jdt/eclipse.jdt.core. Existing local branches and edits
are preserved. Normal Git checkout rules protect changes when switching branches;
the tool never resets, rebases, cleans, stashes, or automatically detaches the checkout.
An existing local branch is not automatically fetched or updated. checkout --fetch
fetches remote references without merging or moving local branches. Choose how to
incorporate upstream changes using Git inside the checkout.
Edit sources and add regression tests directly in that checkout. To run a targeted upstream compiler regression suite:
python3 scripts/jdt.py test \
--test org.eclipse.jdt.core.tests.compiler.regression.ConditionalExpressionTest \
--compliance 25 --java-home "$JAVA_HOME"--test also accepts Class#method where supported by the upstream runner. Use
--module to select another test module inside the checkout. The build skips upstream
tests; the test command runs them explicitly. It uses the same private Maven repository
as the build, so build first to install the needed local artifacts.
The CLI accepts --java-home /absolute/path/to/jdk on build/test/package commands.
This is useful when Python version-manager shims overwrite JAVA_HOME. For ordinary
release-maintenance commands (check, edit, update, continue), no Java invocation is needed.
JDT builds use scripts/jdt-settings.xml and workdir/local-jdt/m2, preserving artifacts
in ~/.m2/repository. The first build may download dependencies again. Each run retains
a workdir/local-jdt/build-*/ directory with build.log, build.json, and immutable
copies of the Core/compiler-batch binaries, matching source JARs, and POMs. The build
record captures the revision, working-tree status, input hashes, artifact coordinates,
and checksums. The package --local-build command consumes this record and its
captured artifacts. Upstream test logs are retained under
workdir/local-jdt/test-*/tests.log.
Use the build directory printed by jdt.py build:
python3 scripts/jdt.py package \
--local-build workdir/local-jdt/build-EXAMPLE \
--java-home "$JAVA_HOME"A path to its build.json is also accepted. This reuses the captured artifacts without
rebuilding or changing JDT, even if the checkout or its Maven cache has since changed.
Missing artifacts, altered checksums, or source JARs that disagree with recorded build
inputs are rejected. Further upstream edits require a new local build record.
To test packaging directly against a published Core version instead:
python3 scripts/jdt.py package --version 3.47.0 --java-home "$JAVA_HOME"The release path obtains matching Core and ECJ binaries, source JARs, and POMs, resolving
the ECJ version from Core's POM. --repository-url, --maven-repo, and --offline are
available. Online downloads verify published checksums; offline mode requires cached
artifacts and Maven plugins/dependencies and cannot verify newly selected bytes remotely.
The pinned release's source/POM checksums are checked even offline.
Packaging runs in workdir/patched-jdt/package-*/, with its own Maven repository at
workdir/patched-jdt/m2 by default. The captured artifacts are installed there, rather
than into your normal Maven repository. An explicit --maven-repo overrides that cache.
The command copies the packaging project, including local helpers in src/main and
repository tests. It regenerates the managed replacement classes from the selected
upstream source JARs plus patches/series, then configures a temporary dependency POM
while preserving tests and shading exclusions. Maven compiles and shades the package
and runs its unit and integration tests against the resulting JAR. This detects both
patch-application conflicts and behavior or compilation incompatibilities.
The source repository's POM, checked-in replacement sources, tests, patch series, and release baseline remain unchanged. The resulting package is not installed or deployed. The release-maintenance commands above still explicitly update working-tree sources and patches when requested.
Each packaging workspace retains:
input.jsonandartifacts/: the selected baseline, checksums, and frozen inputs;pristine/andbefore/: managed sources before patching and before the pending patch;packaging/: the isolated project, shaded JAR, and test reports undertarget/;packaging.json: patch progress, conflict resolutions, dependencies, and final status;install.log,dependencies.log, andpackaging.log: Maven output.
The experimental baseline lives in the workspace's input.json. Run check in the
repository to verify the baseline pinned by patches/upstream.json.
Start on the Eclipse Project Downloads page.
- To test an Eclipse release candidate, open Stable Builds and choose an entry marked
RCfor the Eclipse release you want to test, such as 4.42 RC2. Its download page has a timestamped identifier such asS-4.42RC2-202611252300. - To test JDT support for an upcoming Java version, open Beta Java Builds and choose a
Ybuild. Check the heading on the build's download page for the target Java version. For example,Y20261125-1500is labeled Beta Java 28 Build.
Copy the build's download page URL under https://download.eclipse.org/eclipse/downloads/drops4/.
If it ends in index.html, use the containing directory URL. Pass that URL to --eclipse-build-url.
The script derives the build-specific p2 URL, verifies the matching JDT Core and ECJ binaries and
sources against Eclipse's checksums, and runs the same patching and packaging workflow as for a
published release. Both example builds below require Java 25 or newer.
python3 scripts/jdt.py package \
--eclipse-build-url https://download.eclipse.org/eclipse/downloads/drops4/S-4.42RC2-202611252300/ \
--java-home "$JAVA_HOME"
python3 scripts/jdt.py package \
--eclipse-build-url https://download.eclipse.org/eclipse/downloads/drops4/Y20261125-1500/ \
--java-home "$JAVA_HOME"If a patch conflicts, resolve it in the packaging workspace and run continue as described below.
For 4.42 RC2, patch 0005 only needs to add the EPL header to ClasspathMultiReleaseJar.java in the
workspace. The RC already contains the caching fix.
The workspace contains the captured JARs and POMs for retries. To start a new package after Eclipse
removes a drop, retain workdir/patched-jdt/eclipse-rc/<drop-id>/ from a successful online import and use
--offline. This also requires cached Maven dependencies and plugins. Use --rc-cache PATH to point
to another parent directory containing the retained drop.
After the build passes, install the shaded JAR from the printed packaging/target directory in the
Maven repository SonarJava uses. Give it a drop-qualified version so Maven can distinguish it from
other builds of jdt-package. For Eclipse 4.42 RC2 on the 1.12 development branch, for example:
mvn org.apache.maven.plugins:maven-install-plugin:3.1.4:install-file \
-Dfile=WORKSPACE/packaging/target/jdt-package-1.12-SNAPSHOT.jar \
-DgroupId=org.sonarsource.java -DartifactId=jdt-package \
-Dversion=1.12-eclipse-S-4.42RC2-202611252300 -Dpackaging=jar -DgeneratePom=trueIn SonarJava, use that version for jdt-package in java-frontend/pom.xml. With the test-source
fixtures already built, run mvn -pl java-frontend -am test with a compatible JDK.
Use a JDK that supports the desired source level when testing a new Java feature. The JVM that
loads the shaded JAR must also support its classfiles, which can require a newer JDK than
SonarJava's regular build. See the SonarJava testing instructions.
Inspect the named patch in WORKSPACE/packaging/patches/ and edit the affected Java
files under WORKSPACE/packaging/src/. Then continue:
python3 scripts/jdt.py continue WORKSPACE --java-home "$JAVA_HOME"Only the pending patch in that workspace is refreshed, then later patches are applied
and the shaded package is rebuilt and tested. If upstream already contains the fix,
leave that step's sources identical to before/ and explicitly drop it from the
experimental series with continue WORKSPACE --drop.
The same continuation command retries a failed packaging build after fixing staged
helpers or configuration. If an offline run lacks dependencies, add --online to the
continuation command to allow Maven downloads; --offline forces cached resolution. Frozen artifacts and pristine sources are verified before
reuse. Repository patches are never published by these experimental commands. Keep
permanent packaging fixes through the normal edit / continue maintenance workflow.
patches/series is the authoritative application order. Every *.patch in patches/ must appear exactly once. Patches are grouped
by behavior, can affect multiple replacement classes, and may depend on earlier patches. Their headers document the purpose,
upstream context, and relevant tests. patches/upstream.json pins the JDT Core and ECJ versions, SHA-256 checksums of their
POMs and source JARs, and the mapping from upstream sources to local replacement files.
Maintain existing patches through a temporary edit session:
python3 scripts/jdt.py edit 0004-select-system-release-api.patch
# Edit the files under the printed WORKSPACE/work/ and, if needed, the patch description.
python3 scripts/jdt.py continue WORKSPACEFor a new behavior, pass a new patch filename to edit; it is appended after all existing patches. Supply a meaningful patch header
in the printed workspace before continuing. To remove an existing patch, start an edit session for it, restore the managed files in
work/ to their before/ contents, and use continue --drop. Later patches may need adaptation if they depended on the removed fix.
Edit the staged copies of upstream classes, rather than editing the committed replacement sources directly. Local helpers, tests,
and Maven configuration remain ordinary project files and do not belong in upstream patches. To override another upstream class,
add its source/destination mapping to the manifest, initially copy its pristine source into src/main/java, and update the Shade
exclusions before starting a patch edit session. This makes the new file part of reconstruction and preserves the existing fixes.
Before submitting a change, run:
python3 scripts/jdt.py check
mvn verifyCI runs the reconstruction check before the Maven build. Reconstruction detects missing patches, dependency
or baseline drift, and source changes that were not recorded in a patch. It does not replace behavioral tests or downstream validation.
The Maven integration tests run after packaging and verify that the compiler and replacement classes are loaded from the
shaded JAR with assertions enabled. They compile and execute valid Java code, reject invalid code with expected diagnostics,
exercise the problem-context and missing-type fixes, and check that batch parsing delivers every AST while preserving known
type bindings despite unresolved types. Release API and projectless classpath behavior are also covered. These checks run
with mvn verify; mvn package alone does not execute them. Release API verification requires a full JDK with lib/ct.sym
and a Java compiler, and fails if these prerequisites are missing. Test reports are written to target/failsafe-reports.
Every file in src/main/java must carry the Eclipse Public License 2.0 notice (including SPDX-License-Identifier: EPL-2.0).
Files that override an ECJ class keep their original Eclipse (IBM) copyright header, and files that we wrote ourselves
carry the Copyright (C) SonarSource copyright. Both rules are enforced at build time by EclipseLicenseHeaderTest:
a class is considered overridden when it also exists in the org.eclipse.jdt.core or ecj jar.
Once we have a branch of sonar-java-jdt with the new version, we can test that version on sonar-java, either using a
SNAPSHOT version when installed locally, or a build version when there is a PR on sonar-java-jdt.
The dependency on sonar-java-jdt is in the sonar-java-frontend module, artifact jdt-package.
When the sonar-java-jdt version is updated there may be compilation errors caused by changes in the API that need to be fixed on
the sonar-java side.
We need to check the new version does not cause issue on sonar-java, in particular checking peach results are not badly impacted.
As an optional step, it is a good idea to look at the diff for the parts of the eclipse-jdt-core library that are used in sonar-java.
If possible, we should also look for example repositories that use features of the new Java versions, and add them on peach.
Once we validated that the new version of sonar-java-jdt works with sonar-java (using peach results and possibly new projects), we need to release
sonar-java-jdt so that sonar-java does not depend on an unreleased version.
The current modifications are maintained as five patches:
| Patch | Purpose |
|---|---|
0001-preserve-problem-context.patch |
Avoid aborting analysis on unreportable semantic problems and preserve the problem context. |
0002-tolerate-missing-type-assertion.patch |
Tolerate methods incorrectly tagged as containing missing types. |
0003-allow-projectless-system-library.patch |
Support projectless environments with custom platform classpaths, including Android. |
0004-select-system-release-api.patch |
Delegate platform API selection to the separately maintained SystemReleaseClasspath helper. |
0005-cache-jar-compilation-unit-lookups.patch |
Backport upstream f55dfc33757c: index compilation unit packages once per archive, including JMODs and multi-release JARs (JAVA-7277). |
The following notes describe historical baseline imports. The current updater uses Maven sources and the checked-in series instead of these manual downloads or historical override commits.
In order to update org.eclipse.jdt.core to 3.46.0, the following files have been downloaded and patched to fix the (...) is wrongly tagged as containing missing types in sanity tests and the Missing system library problem in ASTParser.getClasspath(...).
ProblemHandler.java was unchanged upstream between R4_38 and R4_40, so it did not need to be re-fetched.
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_40/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_40/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java > src/main/java/org/eclipse/jdt/core/dom/ASTParser.javaIn order to update org.eclipse.jdt.core to 3.41.0, the following files have been downloaded and patched to fix the referenceContext == null problem
, the Missing system library problem in ASTParser.getClasspath(...) and the (...) is wrongly tagged as containing missing types in sanity tests.
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_35/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_35/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_35/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java > src/main/java/org/eclipse/jdt/core/dom/ASTParser.javaIn order to update org.eclipse.jdt.core to 3.39.0, the following files have been downloaded and patched to fix the referenceContext == null problem:
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_33/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_33/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
In order to update org.eclipse.jdt.core to 3.38.0, the following files have been downloaded and patched to fix the referenceContext == null problem:
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_32/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
curl -sSLf -o - https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/R4_32/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java > src/main/java/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
JDT core 3.36.0 and 3.37.0 introduce a bug which prevent analysis of files when there are semantic problems.
The ProblemReporter could have a null referenceContext during the resolution of unknown types which produces
AbortCompilation exception, instead of adding the semantic problems to the compilation result.
The logic in ProblemReporter is sometimes wrong, and it wrongly set referenceContext to null.
For the Java analyzer, it's an important problem because even when the semantic is not 100% resolved, we still want
to analyze the source code. And this bug also silently prevent the following files in the same compilation batch to be analyzed.
Modified source code in the SONARJAVA-4 Fix the referenceContext == null problem commit:
- https://github.com/eclipse-jdt/eclipse.jdt.core/blob/R4_31/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
- https://github.com/eclipse-jdt/eclipse.jdt.core/blob/R4_31/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java