diff --git a/dependencies/pom.xml b/dependencies/pom.xml index ebb995fa739..d079f620ffc 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -87,7 +87,7 @@ 2.1.1 3.0.1 - 2.4.3.Final + 3.0.8 3.0.2 3.0.2 1.2.5.Final @@ -148,7 +148,7 @@ 42.4.4 0.9.0 2.0.9 - 2.1.16 + 2.1.24 3.13.0 2.2 1.4.2 diff --git a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/InspectionService.java b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/InspectionService.java index 8c8803b11d9..e0ae1bb2612 100644 --- a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/InspectionService.java +++ b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/InspectionService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,11 +155,12 @@ Set lookUpLraAnnotations(Method method) { Set lookUpLraAnnotations(MethodInfo methodInfo) { Map annotations = new HashMap<>(); + Type[] types = methodInfo.parameters().stream().map(param -> param.type()).toArray(Type[]::new); deepScanLraMethod( methodInfo.declaringClass(), annotations, methodInfo.name(), - methodInfo.parameters().toArray(new Type[0]) + types ); HashSet result = new HashSet<>(annotations.values()); diff --git a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java index 34f389dc771..ef2d142963d 100644 --- a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java +++ b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -69,6 +70,7 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.CompositeIndex; import org.jboss.jandex.DotName; +import org.jboss.jandex.Index; import org.jboss.jandex.IndexReader; import org.jboss.jandex.IndexView; import org.jboss.jandex.Indexer; @@ -94,7 +96,8 @@ public class LraCdiExtension implements Extension { private final Set> beanTypesWithCdiLRAMethods = new HashSet<>(); private final Map, Bean> lraCdiBeanReferences = new HashMap<>(); - private final Indexer indexer; + // Do not clear indexes. #index requires a strong reference to these. + private final List indexes = new LinkedList<>(); private final ClassLoader classLoader; private IndexView index; @@ -103,7 +106,6 @@ public class LraCdiExtension implements Extension { * Initialize MicroProfile Long Running Actions CDI extension. */ public LraCdiExtension() { - indexer = new Indexer(); classLoader = Thread.currentThread().getContextClassLoader(); // Needs to be always indexed Set.of(LRA.class, @@ -119,7 +121,9 @@ public LraCdiExtension() { try { indexFiles = findIndexFiles("META-INF/jandex.idx"); if (!indexFiles.isEmpty()) { - index = CompositeIndex.create(indexer.complete(), existingIndexFileReader(indexFiles)); + indexes.add(existingIndexFileReader(indexFiles)); + index = CompositeIndex.create(indexes); + logIndexedClasses(index); } else { index = null; } @@ -137,7 +141,8 @@ private void index( LRA.class, AfterLRA.class, Compensate.class, Complete.class, Forget.class, Status.class }) ProcessAnnotatedType pat) { - // compile time bilt index + // compile time built index + // If META-INF/jandex.idx exists we don't explore more if (index != null) return; // create runtime index when pre-built index is not available runtimeIndex(DotName.createSimple(pat.getAnnotatedType().getJavaClass().getName())); @@ -227,7 +232,8 @@ private void ready( if (index == null) { // compile time built index - index = indexer.complete(); + index = CompositeIndex.create(indexes); + logIndexedClasses(index); } // ------------- Validate LRA participant methods ------------- @@ -255,13 +261,16 @@ Map, Bean> lraCdiBeanReferences() { void runtimeIndex(DotName fqdn) { if (fqdn == null) return; LOGGER.fine("Indexing " + fqdn); - ClassInfo classInfo; try { - classInfo = indexer.index(classLoader.getResourceAsStream(fqdn.toString().replace('.', '/') + ".class")); + Indexer newIndexer = new Indexer(); + newIndexer.index(classLoader.getResourceAsStream(fqdn.toString().replace('.', '/') + ".class")); + Index index = newIndexer.complete(); + indexes.add(index); + ClassInfo classInfo = index.getClassByName(fqdn); // look also for extended classes runtimeIndex(classInfo.superName()); // and implemented interfaces - classInfo.interfaceNames().forEach(this::runtimeIndex); + classInfo.interfaceNames().forEach(dotName -> runtimeIndex(dotName)); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Unable to index referenced class.", e); } @@ -313,4 +322,13 @@ static T lookup(Bean bean, BeanManager beanManager) { } return (T) instance; } + + private void logIndexedClasses(IndexView index) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.fine(index.getKnownClasses().size() + " indexed classes."); + index.getKnownClasses().forEach(classInfo -> { + LOGGER.fine("Indexed class - " + classInfo.name().toString()); + }); + } + } } diff --git a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/ParticipantValidationModel.java b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/ParticipantValidationModel.java index 6ce5637f939..788bed542a7 100644 --- a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/ParticipantValidationModel.java +++ b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/ParticipantValidationModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,6 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.MethodInfo; -import org.jboss.jandex.Type; class ParticipantValidationModel { @@ -155,7 +154,7 @@ private static class ParticipantMethod { String nameWithParams() { return methodInfo.name() + methodInfo.parameters().stream() - .map(Type::name) + .map(paramInfo -> paramInfo.type().name()) .map(DotName::toString) .collect(Collectors.joining()); } diff --git a/microprofile/tests/tck/tck-openapi/pom.xml b/microprofile/tests/tck/tck-openapi/pom.xml index 7882ec8ae96..bb381341129 100644 --- a/microprofile/tests/tck/tck-openapi/pom.xml +++ b/microprofile/tests/tck/tck-openapi/pom.xml @@ -30,22 +30,6 @@ tck-openapi Helidon Microprofile Tests TCK OpenAPI - - 1.32 - - - - - - - org.yaml - snakeyaml - ${selectedSnakeYamlVersion} - - - - io.helidon.microprofile.tests diff --git a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java index 401955c4c6e..9782dc197ee 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -591,6 +591,12 @@ public Object parseValue(String value) { try { JsonReader reader = JSON_READER_FACTORY.createReader(new StringReader(value)); JsonValue jsonValue = reader.readValue(); + // readValue will truncate the input to convert to a number if it can. Make sure the value is the same + // length as the original. + if (jsonValue.getValueType().equals(JsonValue.ValueType.NUMBER) + && value.length() != jsonValue.toString().length()) { + return value; + } return convertJsonValue(jsonValue); } catch (Exception ex) { LOGGER.log(Level.SEVERE, String.format("Error parsing value: %s", value), ex); diff --git a/pom.xml b/pom.xml index 6bbd3a48449..981d8819de5 100644 --- a/pom.xml +++ b/pom.xml @@ -465,6 +465,13 @@ org.jboss.jandex jandex-maven-plugin ${version.plugin.jandex} + + + org.jboss + jandex + 3.1.8 + + org.apache.maven.plugins