Skip to content

Align programmatic Java-level config with the Java 21 baseline - #3780

Open
szarnekow wants to merge 2 commits into
mainfrom
sz_3770
Open

Align programmatic Java-level config with the Java 21 baseline#3780
szarnekow wants to merge 2 commits into
mainfrom
sz_3770

Conversation

@szarnekow

Copy link
Copy Markdown
Contributor

Fixes #3770: PerformanceTestProjectSetup hardcoded a stale J2SE-1.5/Java 8 JDT compliance level for its test project. On a modern JDK that EE has no strictly-compatible VM, so JDT falls back to the default JDK 21; java.util.List then exposes getLast() (Java 21 SequencedCollection), Xtend resolves .last to it, and the pinned 1.8 compliance rejects the generated code. The prior emergency fix (#3771) patched the classpath container but left the generated manifest declaring JavaSE-1.8.

  • Derive JDT compliance from the project's actual JRE container instead of pinning a fixed version (JavaProjectSetupUtil.makeDefaultCompliant), and apply it everywhere the same hardcode-and-drift pattern existed.
  • Raise the default source/target Java version from 8 to 21 across the generator, standalone builder and IDE preferences, while keeping the ability to compile Java-8-target output for downstream DSLs.
  • Fix the JavaVersion preference dropdown offering "Java 8" four times (JAVA5/6/7 are deprecated aliases of JAVA8 that don't satisfy isAtLeast(JAVA8), so selecting one silently downgraded codegen).
  • Introduce JavaVersion.DEFAULT as the single source of truth for Xtext's default Java version, replacing ~15 independent JAVA21/"21"/ "JavaSE-21" literals scattered across the Maven plugins, project wizard, language generator and JDT-facing utilities.

Fixes #3770: PerformanceTestProjectSetup hardcoded a stale J2SE-1.5/Java
8 JDT compliance level for its test project. On a modern JDK that EE has
no strictly-compatible VM, so JDT falls back to the default JDK 21;
java.util.List then exposes getLast() (Java 21 SequencedCollection),
Xtend resolves .last to it, and the pinned 1.8 compliance rejects the
generated code. The prior emergency fix (#3771) patched the classpath
container but left the generated manifest declaring JavaSE-1.8.

- Derive JDT compliance from the project's actual JRE container instead
  of pinning a fixed version (JavaProjectSetupUtil.makeDefaultCompliant),
  and apply it everywhere the same hardcode-and-drift pattern existed.
- Raise the default source/target Java version from 8 to 21 across the
  generator, standalone builder and IDE preferences, while keeping the
  ability to compile Java-8-target output for downstream DSLs.
- Fix the JavaVersion preference dropdown offering "Java 8" four times
  (JAVA5/6/7 are deprecated aliases of JAVA8 that don't satisfy
  isAtLeast(JAVA8), so selecting one silently downgraded codegen).
- Introduce JavaVersion.DEFAULT as the single source of truth for
  Xtext's default Java version, replacing ~15 independent JAVA21/"21"/
  "JavaSE-21" literals scattered across the Maven plugins, project
  wizard, language generator and JDT-facing utilities.

Signed-off-by: Sebastian Zarnekow <sebastian.zarnekow@gmail.com>
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

Test Results

  8 054 files  +4    8 054 suites  +4   4h 7m 26s ⏱️ + 29m 32s
 43 167 tests ±0   42 583 ✅ ±0    584 💤 ±0  0 ❌ ±0 
212 378 runs  +4  209 457 ✅ +1  2 921 💤 +3  0 ❌ ±0 

Results for commit 4104c27. ± Comparison against base commit 40eeb0c.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
org.eclipse.xtend.ide.tests.compiler.JavaVersionSettingTest ‑ testCompileWithJava8
org.eclipse.xtend.ide.tests.compiler.JavaVersionSettingTest ‑ testOverrideAnnotationIsGenerated

♻️ This comment has been updated with latest results.

CI (run 32637751053) failed identically on all 5 matrix jobs (Linux,
macOS, Windows; JDK 21 and 25) with a single failure:
JvmModelGeneratorTest.testMethodModifiers, at the assertion
Modifier.isStrict(compiled.getMethod("strictFpMethod").getModifiers()).

Since Java 17 (JEP 306, "Restore Always-Strict Floating-Point
Semantics"), javac/ecj no longer emit the ACC_STRICT class file flag for
strictfp members - verified locally: `javac -source 21 -target 21` on a
strictfp method compiles cleanly but Modifier.isStrict() on the result
is false. OnTheFlyJavaCompiler2's default target moved from Java 8 to
JavaVersion.DEFAULT (21) earlier in this branch, so this test's
in-memory compilation now hits that JDK behavior.

Xtend's own code generation is unaffected - JvmModelGenerator still
unconditionally emits the strictfp keyword into the generated source.
Assert that instead of the now-permanently-absent bytecode flag.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

org.eclipse.xtend.performance.tests fail in latest

1 participant