← All tasks
javajavaparser/javaparser #5071Not a task: already works

Stale comment: Spotless version pinned for Java 8 support (constraint doesn't apply)

envgap__javaparser__javaparser-5071

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
a088f6d87b02461fd7b0591920843a884bbbb21a
Manifest
pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

javaparser/javaparser #5071 · read the original issue
## The Comment

In `pom.xml`:
```xml
<artifactId>spotless-maven-plugin</artifactId>
<!-- This is the last version with Java 8 support -->
<version>2.46.1</version>
```

## Two Problems

### 1. Factually incorrect

The last Spotless version compiled for Java 8 was **2.34.0** (released 2023-02-05, per [CHANGES.md](https://github.com/diffplug/spotless/blob/main/CHANGES.md#2341---2023-02-05)). Version 2.46.1 requires Java 11 (class file version 55) and fails with `UnsupportedClassVersionError` on JDK 8.

### 2. The constraint itself is unnecessary

Spotless is a **build-time tool** — it runs on the developer's/CI's JDK, not on end users' JVMs. JavaParser targets Java 8 bytecode for its *output*, but build plugins are not bound by the target JDK.

Evidence: the CI formatting check in `.github/workflows/formatting_check.yml` already runs on JDK 11:
```yaml
- name: Set up JDK 11
  uses: actions/setup-java@v5
  with:
    java-version: '11'
```

This means Spotless could be upgraded to the **latest version** without affecting JavaParser's Java 8 compatibility. The pinning is based on a misunderstanding that no longer applies (if it ever did).

## Suggested Fix

Either:
- **Update the comment** to reflect reality: `<!-- Build-time only; requires JDK 11+ -->`
- **Or remove it entirely**
- **Or remove it entirely and upgrade to latest Spotless** (which may affect the bugfixes of features like `sortPom()` for POM formatting — see #5070) this requires to update the formatting check java version to JDK 17.

## References

- Spotted by @jlerbsc in [PR #5060 review](https://github.com/javaparser/javaparser/pull/5060#issuecomment-5024995591)
- [Spotless CHANGES.md — 2.34.1 (last Java 8)](https://github.com/diffplug/spotless/blob/main/CHANGES.md#2341---2023-02-05)
- #5070 — POM formatting proposal (could benefit from newer Spotless with bugfixed sortPom support)
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]