Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qute - Ignore classes defined in the unnamed package in BeanArchives.index #26531

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ static boolean index(Indexer indexer, String className, ClassLoader classLoader)
// Ignore primitives and arrays
return false;
}
if (isInUnnamedPackage(className)) {
LOGGER.debugf("Class %s is defined in an unnamed package; skipping indexing", className);
return false;
}
try (InputStream stream = classLoader
.getResourceAsStream(className.replace('.', '/') + ".class")) {
if (stream != null) {
Expand All @@ -292,4 +296,8 @@ static boolean index(Indexer indexer, String className, ClassLoader classLoader)
}
return result;
}

private static boolean isInUnnamedPackage(String className) {
return !className.contains(".");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.arc.processor;

import org.jboss.jandex.Indexer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class BeanArchivesTest {

@Test
public void testIndex() {
final Indexer indexer = new Indexer();
Assertions.assertFalse(BeanArchives.index(indexer, "String"));
Assertions.assertTrue(BeanArchives.index(indexer, String.class.getName()));
}

}