From dce701ac32a51805f7de2ddf3799ce23314392c7 Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Wed, 9 Oct 2024 15:11:01 +0200 Subject: [PATCH 1/5] Helidon 3.x build fails with GraalVM 21.0.4+8.1 #9024 Signed-off-by: Jorge Bescos Gascon --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 90c1f9ed4a2..c7932576887 100644 --- a/pom.xml +++ b/pom.xml @@ -465,6 +465,13 @@ org.jboss.jandex jandex-maven-plugin ${version.plugin.jandex} + + + org.jboss + jandex + 3.2.2 + + org.apache.maven.plugins From d248c30558c67996aba3a91e0877af67868393cb Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Wed, 9 Oct 2024 17:57:51 +0200 Subject: [PATCH 2/5] Adjust versions Signed-off-by: Jorge Bescos Gascon --- microprofile/graphql/server/pom.xml | 8 ++++++++ pom.xml | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/microprofile/graphql/server/pom.xml b/microprofile/graphql/server/pom.xml index 95b0c30d001..bc63e63a975 100644 --- a/microprofile/graphql/server/pom.xml +++ b/microprofile/graphql/server/pom.xml @@ -82,6 +82,14 @@ org.jboss.jandex jandex-maven-plugin + + + + org.jboss + jandex + 3.1.8 + + make-index diff --git a/pom.xml b/pom.xml index f64279a416f..683d5a2515c 100644 --- a/pom.xml +++ b/pom.xml @@ -465,13 +465,6 @@ org.jboss.jandex jandex-maven-plugin ${version.plugin.jandex} - - - org.jboss - jandex - 3.2.2 - - org.apache.maven.plugins From 40614a91bd11355894a953b21a8ead4e29bf2812 Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Thu, 10 Oct 2024 10:24:39 +0200 Subject: [PATCH 3/5] Working in general solution Signed-off-by: Jorge Bescos Gascon --- dependencies/pom.xml | 4 +-- microprofile/graphql/server/pom.xml | 8 ----- .../microprofile/lra/InspectionService.java | 5 +-- .../microprofile/lra/LraCdiExtension.java | 36 ++++++++++++++----- .../lra/ParticipantValidationModel.java | 5 ++- microprofile/tests/tck/tck-openapi/pom.xml | 16 --------- pom.xml | 7 ++++ 7 files changed, 41 insertions(+), 40 deletions(-) diff --git a/dependencies/pom.xml b/dependencies/pom.xml index 095d2a904c3..cd83e9b9d24 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 2.2 1.4.2 2.1.5 diff --git a/microprofile/graphql/server/pom.xml b/microprofile/graphql/server/pom.xml index bc63e63a975..95b0c30d001 100644 --- a/microprofile/graphql/server/pom.xml +++ b/microprofile/graphql/server/pom.xml @@ -82,14 +82,6 @@ org.jboss.jandex jandex-maven-plugin - - - - org.jboss - jandex - 3.1.8 - - make-index 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/pom.xml b/pom.xml index 683d5a2515c..10c4222f143 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 From af9db8a772ef2e1bc09f6c576edc3f21845565d5 Mon Sep 17 00:00:00 2001 From: Tim Quinn Date: Tue, 15 Oct 2024 10:54:32 -0500 Subject: [PATCH 4/5] Backport parsing enhancement from 4.x --- .../src/main/java/io/helidon/openapi/OpenAPISupport.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java index 401955c4c6e..4a1036fddbf 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java @@ -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); From 569ec9c5dcb7b8f8c16518dfac130cdaeee29b29 Mon Sep 17 00:00:00 2001 From: Tim Quinn Date: Tue, 15 Oct 2024 10:59:17 -0500 Subject: [PATCH 5/5] Copyright --- openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java index 4a1036fddbf..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.