Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 6 additions & 24 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
name: Maven CI

on:
push:
branches:
- '**'
branches: ['**']
pull_request:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
cache: maven

- name: Run tests
run: mvn -B test

- name: Build package
run: mvn -B package
ci:
# Pin to the floating major tag @v1 to auto-receive security re-pins; immutable tags (e.g. v1.1.0) remain available for strict pinning.
uses: UltiKits/ci-workflows/.github/workflows/maven-ci.yml@v1
with:
needs-nms: false
18 changes: 15 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,31 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.11.0</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.11.0</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
Comment on lines 78 to +94

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does Mockito 5.2.0 support running tests on JDK 21, or is a newer Mockito 5.x release recommended?

💡 Result:

Mockito 5.2.0 can run tests on JDK 21, but you may need to ensure the correct Byte Buddy dependency is resolved; otherwise you can hit JDK-21-related Byte Buddy issues with mockito-inline 5.2.0.[1][2] Recommendation: use a newer Mockito 5.x (e.g., the latest 5.x) for best JDK-21 compatibility and fixes. Mockito explicitly documents JDK 21+ instrumentation behavior (Java 21 restricts agent attachment) and provides guidance to configure Mockito as a Java agent when running tests on Java 21+.[3] Mockito 5.x also continues to add JDK 21-related support over time (e.g., “Support for JDK21 Sequenced Collections” in releases around 5.19+).[4] In short: 5.2.0 is not guaranteed to be the smoothest experience on JDK 21; for reliability on JDK 21, prefer a more recent Mockito 5.x and follow the Java 21+ agent setup guidance.[3]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show relevant portions of pom.xml
echo "=== pom.xml (java.version + compiler/surefire) ==="
sed -n '1,140p' pom.xml | nl -ba | sed -n '1,140p'

echo
echo "=== pom.xml (dependencies around Mockito/byte-buddy) ==="
nl -ba pom.xml | sed -n '60,140p'

echo
echo "=== Search for mockito inline / mock maker extension files ==="
rg -n --hidden --no-ignore-vcs "mockito-inline|MockMaker|mockito-extensions|org\.mockito\.plugins\.MockMaker" .

Repository: UltiKits/UltiBackup

Length of output: 175


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Print pom.xml top section with line numbers
echo "=== pom.xml (top: java.version / properties) ==="
sed -n '1,120p' pom.xml | cat -n

echo
echo "=== pom.xml (Mockito/byte-buddy dependencies around 60-140) ==="
sed -n '60,160p' pom.xml | cat -n

echo
echo "=== Search for Mockito mock-maker configuration files/usages ==="
rg -n --hidden --no-ignore-vcs "mockito-inline|MockMaker|mockito-extensions|org\.mockito\.plugins\.MockMaker" .
echo
rg -n --hidden --no-ignore-vcs "byte-buddy|byte-buddy-agent" pom.xml

Repository: UltiKits/UltiBackup

Length of output: 9841


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== CI workflows: look for setup-java / Java version ==="
ls -la .github 2>/dev/null || true
ls -la .github/workflows 2>/dev/null || true
rg -n "setup-java|JAVA_VERSION|java-version|temurin|adoptopenjdk|jdk" .github/workflows .github 2>/dev/null || true

echo
echo "=== Any other CI config (e.g., Jenkins) mentioning Java version? ==="
rg -n "JDK|JAVA_HOME|sourceCompatibility|maven.*java|setup-java|temurin|adoptopenjdk|java" . 2>/dev/null | head -n 50

Repository: UltiKits/UltiBackup

Length of output: 6028


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== .github/workflows/maven-ci.yml ==="
sed -n '1,220p' .github/workflows/maven-ci.yml | cat -n

echo
echo "=== Search for Mockito static mocking / inline-only APIs ==="
rg -n "mockStatic\(|MockedStatic|mockito\\.inline|inline mock|`@Mock`|`@InjectMocks`" src/test/java -S || true

echo
echo "=== Search for mockito-extensions directory/files ==="
fd "mockito-extensions" . -t f 2>/dev/null || true
rg -n --hidden --no-ignore-vcs "org\.mockito\.plugins\.MockMaker|mockito-extensions" . || true

echo
echo "=== Search for explicit final/static mocking hints ==="
rg -n "when\\(|thenReturn\\(|final class|final .*\\{|static .*\\{" src/test/java -S || true

Repository: UltiKits/UltiBackup

Length of output: 50375


🌐 Web query:

What is the minimum supported Java version for Mockito 5.x (specifically 5.2.0)? Mockito 5 Java 11+ requirement

💡 Result:

The minimum supported Java version for all versions of Mockito 5.x, including 5.2.0, is Java 11 [1][2][3]. Mockito increased its minimum Java requirement from Java 8 to Java 11 starting with the release of version 5.0.0 [1][4]. This change was implemented to reduce maintenance costs, manage infrastructure complexities, and accommodate evolving JDK APIs (such as the SecurityManager) [1][5]. Users who require support for Java 8 or earlier versions are advised to continue using Mockito 4 [1][3].

Citations:


🌐 Web query:

Does Mockito static mocking (MockedStatic / mockStatic) require mockito-inline (inline mock maker) even when mockito-core is present?

💡 Result:

No, not necessarily. 1) If you are on Mockito 5.0.0+ (and your setup uses the inline MockMaker by default), then static mocking via mockStatic/MockedStatic does not require adding the mockito-inline artifact explicitly, because the default mock maker is the inline one that supports static mocks.[1][2] 2) If you are on an older Mockito version, or if your configuration is using the subclass MockMaker (e.g., you have only mockito-core with a MockMaker that “does not support the creation of static mocks”), then you must enable the inline mock maker. Mockito’s guidance is to “enable this mock mode, by placing the 'mockito-inline' artifact where you are currently using 'mockito-core'” and to use the inline mock maker to support static mocking.[3][4] Practical takeaway: whether mockito-inline is required depends on which MockMaker is active in your test runtime. For Mockito 5+, it’s typically not required because inline is the default; for Mockito 3/4 or a subclass MockMaker configuration, it is required for mockStatic to work.[3][1][4]

Citations:


🌐 Web query:

UltiKits/ci-workflows maven-ci.yml: what Java version does it run tests with? (setup-java java-version)

💡 Result:

The repository UltiKits/ci-workflows does not appear to exist as a public GitHub repository. Consequently, there is no authoritative maven-ci.yml file associated with this path to provide a specific Java version. Development and CI for UltiKits projects (such as UltiTools-Reborn) are primarily managed via the UltiTools CLI [1][2], which scaffolds Maven projects locally [2]. Users looking for Java CI templates for Maven projects typically use the standard GitHub Actions "Java with Maven" template [3][4][5], which commonly defaults to Java 17 [4][6][7].

Citations:


Mockito 5.2.0 requires a Java 11+ test runtime (not just compilation to 1.8)

<java.version>1.8</java.version> (line 16) only sets the compiler source/target; Mockito 5.2.0 needs Java 11+ to run tests, so mvn test on a JDK 8 JVM will fail with class-version/runtime errors. Ensure both local dev and the test CI job execute with JDK >= 11 (maven-ci.yml delegates to a reusable workflow, so that workflow’s JDK needs to be checked/adjusted).

mockito-inline:5.2.0 is not redundant: the test suite uses org.mockito.MockedStatic / mockStatic(...), which relies on inline mocking being available.

Optional: targeting JDK 21—Mockito 5.2.0 can work, but upgrading to a newer Mockito 5.x release can reduce Byte Buddy/JDK21 edge-case friction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pom.xml` around lines 78 - 94, Mockito 5.2.0 (dependencies mockito-core,
mockito-junit-jupiter, mockito-inline) requires a Java 11+ test runtime even if
compilation target is 1.8; update the project/CI to run tests on JDK >=11 by
changing the project java runtime configuration (e.g., update <java.version>
from 1.8 to 11 or configure Maven toolchains/surefire/failsafe to use Java 11+)
and adjust the reusable workflow referenced by maven-ci.yml so the test job runs
on JDK 11+ (do not remove mockito-inline since mockStatic usage depends on it).

<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.15.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.15.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down