Skip to content

Commit

Permalink
Merge pull request #37456 from Ladicek/index-wrapper-skip-primitives-…
Browse files Browse the repository at this point in the history
…arrays

Core: ignore attempts to on-demand index primitive types and arrays
  • Loading branch information
gsmet authored Dec 2, 2023
2 parents 9b6f5f0 + 52b4807 commit cf8a2fd
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 cf8a2fd

Please sign in to comment.