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.

Also fix the logger name in `IndexWrapper`.
  • Loading branch information
Ladicek committed Dec 1, 2023
1 parent b748934 commit 52b4807
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@
import org.jboss.jandex.Type;
import org.jboss.logging.Logger;

import io.quarkus.deployment.steps.CombinedIndexBuildStep;

/**
* This wrapper is used to index JDK classes on demand.
*/
public class IndexWrapper implements IndexView {

private static final Logger LOGGER = Logger.getLogger(CombinedIndexBuildStep.class);
private static final Logger LOGGER = Logger.getLogger(IndexWrapper.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;
Expand Down Expand Up @@ -300,6 +308,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 52b4807

Please sign in to comment.