Skip to content

Commit

Permalink
Start using the new helper from more modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed May 3, 2024
1 parent 37a09fb commit 55496e0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import org.jboss.jandex.Type.Kind;
import org.junit.jupiter.api.Test;

import io.quarkus.commons.classloading.ClassloadHelper;

public class JandexUtilTest {

private static final DotName SIMPLE = DotName.createSimple(Single.class.getName());
Expand Down Expand Up @@ -307,7 +309,7 @@ private static Index index(Class<?>... classes) {
for (Class<?> clazz : classes) {
try {
try (InputStream stream = JandexUtilTest.class.getClassLoader()
.getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) {
.getResourceAsStream(ClassloadHelper.fromClassNameToResourceName(clazz.getName()))) {
indexer.index(stream);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.quarkus.commons.benchmarks;

import io.quarkus.commons.classloading.ClassloadHelper;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -12,8 +14,7 @@
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import io.quarkus.commons.classloading.ClassloadHelper;

/**
* We benchmark this strategy with CompilerControl.Mode.EXCLUDE as this code
Expand Down
4 changes: 4 additions & 0 deletions independent-projects/bootstrap/maven-resolver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-classloader-commons</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.beanbag</groupId>
<artifactId>smallrye-beanbag-maven</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.maven.shared.utils.cli.CommandLineUtils;

import io.quarkus.bootstrap.util.PropertyUtils;
import io.quarkus.commons.classloading.ClassloadHelper;

/**
* This class resolves relevant Maven command line options in case it's called
Expand Down Expand Up @@ -256,7 +257,7 @@ private static Map<String, Object> invokeParser(ClassLoader cl, String[] args) t
* classpath of the context classloader
*/
public static Path getClassOrigin(Class<?> cls) throws IOException {
return getResourceOrigin(cls.getClassLoader(), cls.getName().replace('.', '/') + ".class");
return getResourceOrigin(cls.getClassLoader(), ClassloadHelper.fromClassNameToResourceName(cls.getName()));
}

public static Path getResourceOrigin(ClassLoader cl, final String name) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import io.fabric8.maven.Maven;
import io.fabric8.maven.XMLFormat;
import io.quarkus.commons.classloading.ClassloadHelper;

/**
* @author kameshs
Expand Down Expand Up @@ -319,7 +320,7 @@ public static String[] readGavFromSettingsGradle(ByteArrayInputStream buildFileI
* classpath of the context classloader
*/
public static Path getClassOrigin(Class<?> cls) throws IOException {
return getResourceOrigin(cls.getClassLoader(), cls.getName().replace('.', '/') + ".class");
return getResourceOrigin(cls.getClassLoader(), ClassloadHelper.fromClassNameToResourceName(cls.getName()));
}

public static Path getResourceOrigin(ClassLoader cl, final String name) throws IOException {
Expand Down

0 comments on commit 55496e0

Please sign in to comment.