Skip to content

Commit

Permalink
Core: ignore attempts to on-demand index primitive types and arrays
Browse files Browse the repository at this point in the history
This is to avoid a warning log message in cases that cannot possibly
succeed; there are no class files for primitive types and arrays.
  • Loading branch information
Ladicek committed Dec 1, 2023
1 parent b748934 commit 22b2e7a
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public class IndexWrapper implements IndexView {

private static final Logger LOGGER = Logger.getLogger(CombinedIndexBuildStep.class);

private static final Set<String> PRIMITIVE_TYPES = Set.of(
"boolean",
"byte",
"short",
"int",
"long",
"float",
"double",
"char");

private final IndexView index;
private final ClassLoader deploymentClassLoader;
final Map<DotName, Optional<ClassInfo>> additionalClasses;
Expand Down Expand Up @@ -300,6 +310,10 @@ private Optional<ClassInfo> computeAdditional(DotName className) {

static boolean index(Indexer indexer, String className, ClassLoader classLoader) {
boolean result = false;
if (PRIMITIVE_TYPES.contains(className) || className.startsWith("[")) {
// Ignore primitives and arrays
return false;
}
try (InputStream stream = classLoader
.getResourceAsStream(className.replace('.', '/') + ".class")) {
if (stream != null) {
Expand Down

0 comments on commit 22b2e7a

Please sign in to comment.