Skip to content

chore: setup-java Oracle action supports Java 21+ only#3215

Merged
krmahadevan merged 2 commits into
testng-team:masterfrom
vlsi:ci
Mar 7, 2025
Merged

chore: setup-java Oracle action supports Java 21+ only#3215
krmahadevan merged 2 commits into
testng-team:masterfrom
vlsi:ci

Conversation

@vlsi

@vlsi vlsi commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Updated Java compatibility settings to support a broader range of Oracle JDK versions.
    • Enhanced version handling logic by removing previous limitations, ensuring more flexible Java version support.
    • Transitioned logging framework from Logback to Pax Logging for improved compatibility in the OSGi test environment.

@vlsi
vlsi requested review from juherr and krmahadevan as code owners March 6, 2025 05:18
@coderabbitai

coderabbitai Bot commented Mar 6, 2025

Copy link
Copy Markdown

Walkthrough

The pull request updates the Java version handling in the matrix configuration. The constant eaJava is changed from '22' to '24'. The logic now uses a function to imply that if the java_version equals eaJava or is greater than or equal to 21 then the java_distribution must be 'oracle'. Additionally, the previous exclusion condition for Oracle JDK with Java version 11 has been removed. Changes are also made to the logging dependencies in the OSGi test environment, shifting from SLF4J and Logback to Pax Logging.

Changes

File(s) Changes
.github/workflows/matrix.js Updated constant eaJava from '22' to '24'. Modified the implication logic to set java_distribution to 'oracle' when java_version equals eaJava or is >= 21. Removed the exclusion condition for Java version 11 with Oracle distribution.
testng-test-osgi/src/test/java/org/testng/test/osgi/DefaultTestngOsgiOptions.java Removed Maven bundles for SLF4J and Logback; added Maven bundles for Pax Logging.
testng-test-osgi/testng-test-osgi-build.gradle.kts Removed dependencies for Logback; added dependencies for Pax Logging.

Sequence Diagram(s)

sequenceDiagram
    participant M as Matrix Config
    participant V as Version Checker
    participant D as Distribution Setter

    M->>V: Check java_version
    V-->>M: Return (java_version === eaJava or java_version >= 21)
    alt Condition met
        M->>D: Set java_distribution to 'oracle'
    else
        M->>D: No change to java_distribution
    end
Loading

Suggested reviewers

  • juherr
  • krmahadevan

Poem

I'm a coding rabbit, hopping through the scheme,
Jumping from '22' to '24' in the Java stream.
Checking versions with a careful eye,
Setting Oracle right when numbers fly.
In matrix fields, my updates gleam!
🥕🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vlsi

vlsi commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

pax waving does not support java 24:

Gradle suite > Gradle test > org.testng.test.osgi.PlainOsgiTest > guiceModuleFactoryLoads STANDARD_OUT
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2335)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:297)
        at java.base/java.lang.Thread.run(Thread.java:1447)
    08:46:56.888 [FelixDispatchQueue] ERROR o.o.p.e.n.i.NativeTestContainer - Framework ERROR event org.osgi.framework.FrameworkEvent[source=org.ops4j.pax.exam.extender.service [3]]
    org.osgi.framework.BundleException: Activator start error in bundle org.ops4j.pax.exam.extender.service [3].
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2479)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2335)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:297)
        at java.base/java.lang.Thread.run(Thread.java:1447)
    Caused by: java.lang.ClassFormatError: Weaving hook failed.
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.transformClass(BundleWiringImpl.java:2397)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2075)
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
        at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1358)
        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1612)
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1528)
        at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
        at org.ops4j.pax.swissbox.extender.BundleWatcher.<clinit>(BundleWatcher.java:58)
        at org.ops4j.pax.exam.raw.extender.intern.Activator.start(Activator.java:42)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429)
        ... 4 common frames omitted
    Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 68
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:200)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:288)
        at org.apache.aries.spifly.dynamic.OSGiFriendlyClassWriter.getCommonSuperClass(OSGiFriendlyClassWriter.java:84)
        at org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1264)
        at org.objectweb.asm.Frame.merge(Frame.java:1311)
        at org.objectweb.asm.Frame.merge(Frame.java:1208)
        at org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1612)
        at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1548)
        at org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:786)
        at org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(LocalVariablesSorter.java:147)
        at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:767)
        at org.objectweb.asm.commons.JSRInlinerAdapter.visitEnd(JSRInlinerAdapter.java:159)
        at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1519)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
        at org.apache.aries.spifly.dynamic.ClientWeavingHook.weave(ClientWeavingHook.java:60)
        at org.apache.felix.framework.util.SecureAction.invokeWeavingHook(SecureAction.java:1408)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.transformClass(BundleWiringImpl.java:2383)
        ... 19 common frames omitted

…bytecode waving for services

Previously, java services required bytecode waving in the runtime to expose as osgi servies.
Now we use pax-logging module so it does it automatically

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56f7a49 and b1556fa.

📒 Files selected for processing (2)
  • testng-test-osgi/src/test/java/org/testng/test/osgi/DefaultTestngOsgiOptions.java (1 hunks)
  • testng-test-osgi/testng-test-osgi-build.gradle.kts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: 24, oracle, ubuntu, America/New_York, tr_TR
  • GitHub Check: 21, liberica, macos, America/New_York, tr_TR, stress JIT
  • GitHub Check: 17, zulu, same hashcode, windows, Pacific/Chatham, fr_FR
  • GitHub Check: 17, microsoft, macos, Pacific/Chatham, tr_TR, stress JIT
  • GitHub Check: 11, microsoft, macos, UTC, tr_TR, stress JIT
  • GitHub Check: 11, liberica, windows, America/New_York, fr_FR, stress JIT
  • GitHub Check: 11, liberica, macos, UTC, ru_RU
🔇 Additional comments (3)
testng-test-osgi/src/test/java/org/testng/test/osgi/DefaultTestngOsgiOptions.java (1)

43-44: Consistent update to OSGi options

The addition of Pax Logging bundles aligns with the changes in the build script, ensuring a consistent approach to logging in the OSGi environment.

Note that even with the switch to Pax Logging, the code still uses the Logback configuration file (line 42), which is appropriate because Pax Logging uses Logback as its underlying implementation in this setup.

testng-test-osgi/testng-test-osgi-build.gradle.kts (2)

48-50: Introduce Pax Logging API dependency

The addition of

testRuntimeOnly("org.ops4j.pax.logging:pax-logging-api:2.2.8") {
    because("It will actually be used in osgi for logging")
}

provides the necessary logging API for the OSGi environment. Verify that version 2.2.8 is adequately tested for compatibility with Java 21+ and that it integrates well with your overall logging configuration.


51-53: Integrate Pax Logging Logback adapter

The new dependency

testRuntimeOnly("org.ops4j.pax.logging:pax-logging-logback:2.2.8") {
    because("It will actually be used in osgi for logging, basic slf4j+logback is hard to launch in osgi, see https://stackoverflow.com/a/77867804")
}

completes the switch from the removed Logback dependencies by providing an appropriate logback adapter within the Pax Logging framework. Please ensure that any existing logging configurations (for example, the system property for logback.configurationFile set later in the build script) are still applicable and do not conflict with this new setup.

Comment on lines +48 to +53
testRuntimeOnly("org.ops4j.pax.logging:pax-logging-api:2.2.8") {
because("It will actually be used in osgi for logging")
}
testRuntimeOnly("org.ops4j.pax.logging:pax-logging-logback:2.2.8") {
because("It will actually be used in osgi for logging, basic slf4j+logback is hard to launch in osgi, see https://stackoverflow.com/a/77867804")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Good shift to specialized OSGi logging framework

The addition of Pax Logging dependencies is a good approach to address logging in OSGi environments. This change likely helps address the Java 24 compatibility issues mentioned in the PR objectives (ClassFormatError in the OSGi environment).

Some notes:

  1. The change from testImplementation (for the removed Logback dependencies) to testRuntimeOnly correctly reflects that these are runtime-only dependencies
  2. The reference to Stack Overflow provides helpful context for why this change is necessary

🌐 Web query:

Is Pax Logging 2.2.8 compatible with Java 24?

💡 Result:

Pax Logging 2.2.8 does not appear to exist based on the provided sources, which reference versions up to 2.0.8 for Pax Logging 2.x releases[1][2]. For compatibility with modern Java versions:

  • Pax Logging 2.0.8 (the latest 2.x version mentioned) includes fixes for JDK11 compatibility[1], but there is no explicit information about support for newer Java versions like Java 24.
  • Java 24 is not a released version as of March 2025 (the current date in the context)[1][4]. Software compatibility with unreleased JDK versions is typically unconfirmed unless explicitly stated by the project.

For future Java versions, check the official Pax Logging release notes for updates. Current releases focus on OSGi R7 logging standards and integration with frameworks like Log4j2 and Logback[1][3].

Citations:


Action Required: Verify Dependency Versions and JDK Compatibility

  • The change from testImplementation to testRuntimeOnly is appropriate for runtime-only logging dependencies in OSGi.
  • However, web research indicates that version 2.2.8 of the Pax Logging dependencies does not appear to exist—sources only list versions up to 2.0.8. Please verify if the intended version is a custom snapshot or if it needs to be updated.
  • Additionally, the comment about addressing "Java 24 compatibility issues" is misleading since Java 24 has not been released as of March 2025. Consider revising this note to reflect compatibility with supported JDK versions or remove the reference until Java 24 is officially available.
  • The provided Stack Overflow reference remains useful context for the logging challenges in OSGi.

@juherr

juherr commented Mar 6, 2025

Copy link
Copy Markdown
Member

@krmahadevan wdyt?

@krmahadevan
krmahadevan merged commit 40cd805 into testng-team:master Mar 7, 2025
This was referenced Dec 30, 2025
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.

3 participants