Skip to content

Commit e2fa37f

Browse files
committed
chore: update to actual implementation in spotless-lib
Refs: diffplug/spotless#2427
1 parent 323c032 commit e2fa37f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/src/main/java/com/diffplug/spotless/cli/core/CliJarProvisioner.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,20 @@
2525
import com.diffplug.spotless.JarState;
2626
import com.diffplug.spotless.Provisioner;
2727

28+
/**
29+
* Since we are not a build tool per se, we do not actually have a provisioning
30+
* method other than our app bundle itself. And as we want to compile to native
31+
* we cannot use dynamic class loading. So override spotless-lib dynamic class loading
32+
* to actually use only classes within our distribution.
33+
*/
2834
public class CliJarProvisioner implements Provisioner {
2935

3036
public static final CliJarProvisioner INSTANCE = new CliJarProvisioner();
3137

3238
public static final File OWN_JAR = createSentinelFile();
3339

3440
public CliJarProvisioner() {
35-
JarState.setOverrideClassLoader(getClass().getClassLoader()); // use the classloader of this class
36-
// TODO (simschla, 11.11.2024): THIS IS A HACK, replace with proper solution
41+
JarState.setForcedClassLoader(getClass().getClassLoader()); // use the classloader of this class
3742
}
3843

3944
private static File createSentinelFile() {

gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ durian = "1.2.0"
55
junit = "5.8.1"
66
native-include-googleJavaFormat = "1.24.0"
77
picocli = "4.7.6"
8-
spotless-lib = "3.0.2-SNAPSHOT"
8+
spotless-lib = "3.1.0-SNAPSHOT"
99

1010
[libraries]
1111
annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }

0 commit comments

Comments
 (0)