Skip to content

Commit 9b84083

Browse files
authored
Upgrade dependencies: Support Java 25's class file major version 69 (#1440)
This PR upgrades * [ASM](https://asm.ow2.io/versions.html): 9.7.1 → 9.8 – supporting Java 25's class file major version 69 * resolves #1439 * [Guava](https://github.com/google/guava): 33.3.1-jre → 33.4.8-jre * [SLF4J](http://www.slf4j.org): 2.0.16 → 2.0.17 * [JUnit](https://junit.org/junit5/): 5.11.2 → 5.12.2 and for tests: * [Log4j](https://logging.apache.org/log4j/2.x/): 2.24.1 → 2.24.3 * [AssertJ](https://assertj.github.io/doc/): 3.26.3 → 3.27.3 It reduces the memory footprint of `ClassFileImporterSlowTest` by exluding classes from `sun` packages. * resolves #1446
2 parents 395bca8 + 7739b0b commit 9b84083

File tree

5 files changed

+53
-44
lines changed

5 files changed

+53
-44
lines changed

archunit/src/test/java/com/tngtech/archunit/core/importer/ClassFileImporterSlowTest.java

+18-8
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,19 @@ public void creates_JavaPackages() {
179179
}
180180

181181
private JavaClasses importJavaBase() {
182-
return new ClassFileImporter()
183-
.withImportOption(location ->
184-
// before Java 9 packages like java.lang were in rt.jar
185-
location.contains("rt.jar") ||
186-
// from Java 9 on those packages were in a JRT with name 'java.base'
187-
(location.asURI().getScheme().equals("jrt") && location.contains("java.base"))
188-
)
189-
.importClasspath();
182+
return new ClassFileImporter().withImportOption(location -> !isSunPackage(location) && (
183+
// before Java 9 packages like java.lang were in rt.jar;
184+
location.contains("rt.jar") ||
185+
// from Java 9 on those packages were in a JRT with name 'java.base'
186+
(location.asURI().getScheme().equals("jrt") && location.contains("java.base"))
187+
)).importClasspath();
190188
}
191189

192190
private ImportOption importJavaBaseOrRtAndJUnitJarAndFilesOnTheClasspath() {
193191
return location -> {
192+
if (isSunPackage(location)) {
193+
return false;
194+
}
194195
if (!location.isArchive()) {
195196
return true;
196197
}
@@ -200,4 +201,13 @@ private ImportOption importJavaBaseOrRtAndJUnitJarAndFilesOnTheClasspath() {
200201
return location.asURI().getScheme().equals("jrt") && location.contains("java.base");
201202
};
202203
}
204+
205+
/**
206+
* Importing the full classpath may give thousands of classes in {@link sun} and (especially for Java 8) {@link com.sun} packages.
207+
* Importing those would increase the memory footprint tremendously, but not give an additional benefit for the test,
208+
* so it is convenient to ignore those.
209+
*/
210+
private static boolean isSunPackage(Location location) {
211+
return location.contains("/sun/");
212+
}
203213
}

build.gradle

+31-32
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,47 @@ ext {
3535
googleRelocationPackage = "${thirdPartyRelocationPackage}.com.google"
3636

3737
dependency = [
38-
asm : [group: 'org.ow2.asm', name: 'asm', version: '9.7.1'],
39-
guava : [group: 'com.google.guava', name: 'guava', version: '33.3.1-jre'],
40-
addGuava : { dependencyHandler ->
38+
asm : [group: 'org.ow2.asm', name: 'asm', version: '9.8'],
39+
guava : [group: 'com.google.guava', name: 'guava', version: '33.4.8-jre'],
40+
addGuava : { dependencyHandler ->
4141
dependencyHandler(dependency.guava) {
4242
exclude module: 'listenablefuture'
43-
exclude module: 'jsr305'
44-
exclude module: 'checker-qual'
43+
exclude module: 'jspecify'
4544
exclude module: 'error_prone_annotations'
4645
exclude module: 'j2objc-annotations'
4746
}
4847
},
49-
slf4j : [group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'],
50-
log4j_api : [group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.24.1'],
51-
log4j_core : [group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.24.1'],
52-
log4j_slf4j : [group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: '2.24.1'],
48+
slf4j : [group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'],
49+
log4j_api : [group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.24.3'],
50+
log4j_core : [group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.24.3'],
51+
log4j_slf4j : [group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: '2.24.3'],
5352

54-
junit4 : [group: 'junit', name: 'junit', version: '4.13.2'],
55-
junit5JupiterApi : [group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.11.2'],
56-
junit5JupiterEngine : [group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.11.2'],
57-
junit5VintageEngine : [group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.11.2'],
58-
junitPlatform : [group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.11.2'],
59-
junitPlatformCommons: [group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.11.2'],
60-
junitPlatformEngine : [group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.11.2'],
61-
hamcrest : [group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'],
62-
junit_dataprovider : [group: 'com.tngtech.java', name: 'junit-dataprovider', version: '1.11.0'],
63-
mockito : [group: 'org.mockito', name: 'mockito-core', version: '4.11.0'], // mockito 5 requires Java 11
64-
mockito_junit5 : [group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.6.1'],
65-
assertj : [group: 'org.assertj', name: 'assertj-core', version: '3.26.3'],
66-
assertj_guava : [group: 'org.assertj', name: 'assertj-guava', version: '3.26.3'],
53+
junit4 : [group: 'junit', name: 'junit', version: '4.13.2'],
54+
junit5Jupiter : [group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.12.2'],
55+
junit5VintageEngine : [group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.12.2'],
56+
junitPlatform : [group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.12.2'],
57+
junitPlatformCommons : [group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.12.2'],
58+
junitPlatformEngine : [group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.12.2'],
59+
junitPlatformLauncher: [group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.12.2'],
60+
hamcrest : [group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'],
61+
junit_dataprovider : [group: 'com.tngtech.java', name: 'junit-dataprovider', version: '1.11.0'],
62+
mockito : [group: 'org.mockito', name: 'mockito-core', version: '4.11.0'], // mockito 5 requires Java 11
63+
mockito_junit5 : [group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.6.1'],
64+
assertj : [group: 'org.assertj', name: 'assertj-core', version: '3.27.3'],
65+
assertj_guava : [group: 'org.assertj', name: 'assertj-guava', version: '3.27.3'],
6766

6867
// Dependencies for example projects / tests
69-
javaxAnnotationApi : [group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'],
70-
springBeans : [group: 'org.springframework', name: 'spring-beans', version: '5.3.23'],
71-
springBootLoader : [group: 'org.springframework.boot', name: 'spring-boot-loader', version: '2.7.13'],
72-
jakartaInject : [group: 'jakarta.inject', name: 'jakarta.inject-api', version: '2.0.1'],
73-
jakartaAnnotations : [group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1'],
74-
guice : [group: 'com.google.inject', name: 'guice', version: '5.1.0'],
68+
javaxAnnotationApi : [group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'],
69+
springBeans : [group: 'org.springframework', name: 'spring-beans', version: '5.3.23'],
70+
springBootLoader : [group: 'org.springframework.boot', name: 'spring-boot-loader', version: '2.7.13'],
71+
jakartaInject : [group: 'jakarta.inject', name: 'jakarta.inject-api', version: '2.0.1'],
72+
jakartaAnnotations : [group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1'],
73+
guice : [group: 'com.google.inject', name: 'guice', version: '5.1.0'],
7574
// NOTE: The pure javaee-api dependencies are crippled, so to run any test we need to choose a full implementation provider
76-
geronimoEjb : [group: 'org.apache.geronimo.specs', name: 'geronimo-ejb_3.1_spec', version: '1.0.2'],
77-
geronimoJpa : [group: 'org.apache.geronimo.specs', name: 'geronimo-jpa_2.0_spec', version: '1.1'],
78-
jodaTime : [group: 'joda-time', name: 'joda-time', version: '2.12.7'],
79-
joox : [group: 'org.jooq', name: 'joox-java-6', version: '1.6.0']
75+
geronimoEjb : [group: 'org.apache.geronimo.specs', name: 'geronimo-ejb_3.1_spec', version: '1.0.2'],
76+
geronimoJpa : [group: 'org.apache.geronimo.specs', name: 'geronimo-jpa_2.0_spec', version: '1.1'],
77+
jodaTime : [group: 'joda-time', name: 'joda-time', version: '2.12.7'],
78+
joox : [group: 'org.jooq', name: 'joox-java-6', version: '1.6.0']
8079
]
8180

8281
minSupportedJavaVersion = JavaVersion.VERSION_1_8

buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ abstract class ArchUnitTestExtension {
99
ext.archUnitTest = extensions.create('archUnitTest', ArchUnitTestExtension)
1010

1111
dependencies {
12-
testImplementation dependency.junit5JupiterApi
12+
testImplementation dependency.junit5Jupiter
1313

14-
testRuntimeOnly dependency.junit5JupiterEngine
1514
testRuntimeOnly dependency.junit5VintageEngine
15+
testRuntimeOnly dependency.junitPlatformLauncher
1616
testRuntimeOnly dependency.log4j_slf4j
1717
}
1818

buildSrc/src/main/resources/release_check/archunit-junit5-engine-api.pom

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<dependency>
4747
<groupId>org.junit.platform</groupId>
4848
<artifactId>junit-platform-engine</artifactId>
49-
<version>1.11.2</version>
49+
<version>1.12.2</version>
5050
<scope>compile</scope>
5151
</dependency>
5252
</dependencies>

buildSrc/src/main/resources/release_check/archunit.pom

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<dependency>
5151
<groupId>org.slf4j</groupId>
5252
<artifactId>slf4j-api</artifactId>
53-
<version>2.0.16</version>
53+
<version>2.0.17</version>
5454
<scope>compile</scope>
5555
</dependency>
5656
</dependencies>

0 commit comments

Comments
 (0)