diff --git a/.github/workflows/jdk-early-access-build.yml b/.github/workflows/jdk-early-access-build.yml index 08ba9312fab02..a2b361afc8670 100644 --- a/.github/workflows/jdk-early-access-build.yml +++ b/.github/workflows/jdk-early-access-build.yml @@ -72,9 +72,8 @@ jobs: # -fae to try to gather as many failures as possible # (but not maven.test.failure.ignore because test report generation is buggy) # Gradle bits are excluded due to https://github.com/gradle/gradle/issues/13481 - # descriptor-tests (integration-tests/maven) are disabled due to https://github.com/quarkusio/quarkus/issues/16862 (and/or 16806) run: | - ./mvnw $JVM_TEST_MAVEN_OPTS -Dtcks install -fae -pl '!devtools/gradle' -pl '!integration-tests/gradle' -Dno-descriptor-tests + ./mvnw $JVM_TEST_MAVEN_OPTS -Dtcks install -fae -pl '!devtools/gradle' -pl '!integration-tests/gradle' # Test reports disabled due to: https://github.com/ScaCap/action-surefire-report/issues/39 #- name: Publish Test Report # if: always() diff --git a/.mvn/jvm.config b/.mvn/jvm.config index fb54b397cc9f0..30323fcfa5cf6 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1,5 +1,4 @@ -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.retryHandler.count=10 --Dkotlin.environment.keepalive=true -Xmx5g \ No newline at end of file diff --git a/bom/application/pom.xml b/bom/application/pom.xml index a1b9c545d6c24..c466065333de9 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -148,8 +148,8 @@ 2.16.92 2.39.0 1.4.2 - 1.4.32 - 1.4.3 + 1.5.20 + 1.5.0 2.2.2 0.10.0 3.0.1 diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 5dc80a26b6116..1721113d7ce73 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -20,8 +20,8 @@ 3.8.1 + 1.5.20 1.4.32 - 1.4.32 2.12.13 4.4.0 diff --git a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/ByteCodeType.java b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/ByteCodeType.java index 86e3a37814c86..021f0fe104c13 100644 --- a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/ByteCodeType.java +++ b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/ByteCodeType.java @@ -53,6 +53,10 @@ public String internalName() { return type.getInternalName(); } + public boolean isPrimitive() { + return type().getSort() <= Type.DOUBLE; + } + private Type toAsm(PrimitiveType primitive) { switch (primitive.name().toString()) { case "byte": diff --git a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java index 738f73c7d0422..77d86cdd539a9 100644 --- a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java +++ b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java @@ -240,10 +240,9 @@ private String desc(String name) { } private void descriptors(MethodInfo method, StringJoiner joiner) { + ByteCodeType id = typeArguments.get("Id"); for (Type parameter : method.parameters()) { - if (parameter.kind() == Type.Kind.TYPE_VARIABLE - || method.name().endsWith("ById") - && parameter.name().equals(typeArguments.get("Id").dotName())) { + if (!id.isPrimitive() && parameter.name().equals(id.dotName())) { joiner.add(OBJECT.descriptor()); } else { joiner.add(mapType(parameter)); @@ -360,13 +359,7 @@ private void emitLocalVariablesTable(MethodVisitor mv, MethodInfo method) { } } - private void generateBridge(MethodInfo method) { - // get a bounds-erased descriptor - String descriptor = bridgeMethodDescriptor(method, type -> { - ByteCodeType mapped = typeArguments.get(type); - return mapped != null ? mapped.descriptor() : type; - }); - // make sure we need a bridge + private void generateBridge(MethodInfo method, String descriptor) { MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_BRIDGE, method.name(), descriptor, @@ -407,6 +400,31 @@ private void generateBridge(MethodInfo method) { } + private void generatePrimitiveBridge(MethodInfo method, String descriptor) { + String substring = descriptor.substring(0, descriptor.lastIndexOf(')') + 1); + String descriptor1 = substring + OBJECT.descriptor(); + MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_BRIDGE, + method.name(), + descriptor1, + null, + null); + AsmUtil.copyParameterNames(mv, method); + mv.visitCode(); + // this + mv.visitIntInsn(Opcodes.ALOAD, 0); + mv.visitIntInsn(typeArguments.get("Id").type().getOpcode(ILOAD), 1); + String targetDescriptor = getDescriptor(method, name -> typeArguments.get(name).descriptor()); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, + classInfo.name().toString().replace('.', '/'), + method.name(), + targetDescriptor, false); + String targetReturnTypeDescriptor = targetDescriptor.substring(targetDescriptor.indexOf(')') + 1); + mv.visitInsn(AsmUtil.getReturnInstruction(targetReturnTypeDescriptor)); + mv.visitMaxs(0, 0); + mv.visitEnd(); + + } + private void invokeOperation(MethodVisitor mv, MethodInfo method) { String operationDescriptor; @@ -538,7 +556,16 @@ public void visitEnd() { return mapped != null ? mapped.descriptor() : type; }); if (!definedMethods.containsKey(method.name() + bridgeDescriptor)) { - generateBridge(method); + generateBridge(method, bridgeDescriptor); + } + + AnnotationValue targetReturnTypeErased = bridge.value("targetReturnTypeErased"); + if (typeArguments.get("Id").isPrimitive() && targetReturnTypeErased != null + && targetReturnTypeErased.asBoolean()) { + if (method.parameters().size() == 1 + && method.parameters().get(0).asTypeVariable().identifier().equals("Id")) { + generatePrimitiveBridge(method, descriptor); + } } } } diff --git a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java index 5140ccd763cc7..539530a13aac3 100644 --- a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java +++ b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java @@ -27,6 +27,7 @@ import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; import org.jboss.logging.Logger; +import org.objectweb.asm.Opcodes; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.AnnotationsTransformerBuildItem; @@ -164,6 +165,9 @@ void collectComponents(BeanDiscoveryFinishedBuildItem beanDiscoveryFinished, validationErrors.produce(new ValidationErrorBuildItem( new DeploymentException("Empty @Outgoing annotation on method " + method))); } + if (isSynthetic(method.flags())) { + continue; + } // TODO: validate method params and return type? mediatorMethods.produce(new MediatorBuildItem(bean, method)); LOGGER.debugf("Found mediator business method %s declared on %s", method, bean); @@ -236,6 +240,10 @@ void collectComponents(BeanDiscoveryFinishedBuildItem beanDiscoveryFinished, } + private boolean isSynthetic(int mod) { + return (mod & Opcodes.ACC_SYNTHETIC) != 0; + } + private Optional getAnnotation(TransformedAnnotationsBuildItem transformedAnnotations, InjectionPointInfo injectionPoint, DotName annotationName) { diff --git a/extensions/smallrye-reactive-messaging/kotlin/pom.xml b/extensions/smallrye-reactive-messaging/kotlin/pom.xml index 9a342085fa42a..b2a4e0d337652 100644 --- a/extensions/smallrye-reactive-messaging/kotlin/pom.xml +++ b/extensions/smallrye-reactive-messaging/kotlin/pom.xml @@ -112,7 +112,7 @@ org.jetbrains.dokka dokka-maven-plugin - 1.4.32 + ${dokka.version} javadoc diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java index 5d020e15f6a88..39439ca7d6474 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java @@ -92,6 +92,7 @@ import org.jboss.resteasy.reactive.common.util.ReflectionBeanFactoryCreator; import org.jboss.resteasy.reactive.common.util.URLUtils; import org.jboss.resteasy.reactive.spi.BeanFactory; +import org.objectweb.asm.Opcodes; public abstract class EndpointIndexer, PARAM extends IndexedParameter, METHOD extends ResourceMethod> { @@ -364,19 +365,28 @@ private void validateHttpAnnotations(MethodInfo info) { } private boolean hasProperModifiers(MethodInfo info) { + if (isSynthetic(info.flags())) { + log.debug("Method '" + info.name() + " of Resource class '" + info.declaringClass().name() + + "' is a synthetic method and will therefore be ignored"); + return false; + } if ((info.flags() & Modifier.PUBLIC) == 0) { log.warn("Method '" + info.name() + " of Resource class '" + info.declaringClass().name() - + "' it not public and will therefore be ignored"); + + "' is not public and will therefore be ignored"); return false; } if ((info.flags() & Modifier.STATIC) != 0) { log.warn("Method '" + info.name() + " of Resource class '" + info.declaringClass().name() - + "' it static and will therefore be ignored"); + + "' is static and will therefore be ignored"); return false; } return true; } + private boolean isSynthetic(int mod) { + return (mod & Opcodes.ACC_SYNTHETIC) != 0; + } + private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInfo actualEndpointInfo, String[] classProduces, String[] classConsumes, Set classNameBindings, DotName httpMethod, MethodInfo currentMethodInfo, diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java index 62979929aea30..589a5ab72e54c 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java @@ -57,7 +57,6 @@ public void testRunTogetherCodestartsJava() throws Exception { } @Test - @org.junit.jupiter.api.Tag("failsOnJDK16") public void testRunTogetherCodestartsKotlin() throws Exception { generateProjectRunTests("maven", "kotlin", getExtensionCodestarts()); } @@ -91,7 +90,6 @@ public void testRunAloneCodestartsJava(String codestart) throws Exception { @ParameterizedTest @MethodSource("provideRunAloneCodestarts") - @org.junit.jupiter.api.Tag("failsOnJDK16") public void testRunAloneCodestartsKotlin(String codestart) throws Exception { generateProjectRunTests("maven", "kotlin", singletonList(codestart)); } diff --git a/integration-tests/gradle/src/test/resources/bean-in-testsources-project/build.gradle b/integration-tests/gradle/src/test/resources/bean-in-testsources-project/build.gradle index 4dc476b537728..bd5a3de73de5e 100644 --- a/integration-tests/gradle/src/test/resources/bean-in-testsources-project/build.gradle +++ b/integration-tests/gradle/src/test/resources/bean-in-testsources-project/build.gradle @@ -1,8 +1,8 @@ plugins { id 'java' id 'io.quarkus' - id 'org.jetbrains.kotlin.jvm' version "1.4.32" - id "org.jetbrains.kotlin.plugin.allopen" version "1.4.32" + id 'org.jetbrains.kotlin.jvm' version "1.5.20" + id "org.jetbrains.kotlin.plugin.allopen" version "1.5.20" } repositories { diff --git a/integration-tests/gradle/src/test/resources/kotlin-grpc-project/build.gradle b/integration-tests/gradle/src/test/resources/kotlin-grpc-project/build.gradle index 2ea1d518e2c32..06e5ca1e6d1e9 100644 --- a/integration-tests/gradle/src/test/resources/kotlin-grpc-project/build.gradle +++ b/integration-tests/gradle/src/test/resources/kotlin-grpc-project/build.gradle @@ -1,6 +1,6 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version "1.4.32" - id "org.jetbrains.kotlin.plugin.allopen" version "1.4.32" + id 'org.jetbrains.kotlin.jvm' version "1.5.20" + id "org.jetbrains.kotlin.plugin.allopen" version "1.5.20" id 'io.quarkus' } diff --git a/integration-tests/gradle/src/test/resources/multi-module-kotlin-project/gradle.properties b/integration-tests/gradle/src/test/resources/multi-module-kotlin-project/gradle.properties index 84258023fa3ec..c4c96ab0cb343 100644 --- a/integration-tests/gradle/src/test/resources/multi-module-kotlin-project/gradle.properties +++ b/integration-tests/gradle/src/test/resources/multi-module-kotlin-project/gradle.properties @@ -3,5 +3,5 @@ quarkusPlatformArtifactId=quarkus-bom quarkusPlatformGroupId=io.quarkus -kotlinVersion=1.4.32 +kotlinVersion=1.5.20 diff --git a/integration-tests/gradle/src/test/resources/multi-source-project/build.gradle b/integration-tests/gradle/src/test/resources/multi-source-project/build.gradle index 9613862160c6e..45c53b5ca1fe1 100644 --- a/integration-tests/gradle/src/test/resources/multi-source-project/build.gradle +++ b/integration-tests/gradle/src/test/resources/multi-source-project/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' - id 'org.jetbrains.kotlin.jvm' version "1.4.32" - id "org.jetbrains.kotlin.plugin.allopen" version "1.4.32" + id 'org.jetbrains.kotlin.jvm' version "1.5.20" + id "org.jetbrains.kotlin.plugin.allopen" version "1.5.20" id 'io.quarkus' } diff --git a/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinDevModeIT.java b/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinDevModeIT.java index e86b85c457dde..88d512707b798 100644 --- a/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinDevModeIT.java +++ b/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinDevModeIT.java @@ -19,7 +19,6 @@ public class KotlinDevModeIT extends RunAndCheckMojoTestBase { @Test - @Tag("failsOnJDK16") public void testThatTheApplicationIsReloadedOnKotlinChange() throws MavenInvocationException, IOException { testDir = initProject("projects/classic-kotlin", "projects/project-classic-run-kotlin-change"); runAndCheck(false); diff --git a/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinRemoteDevModeIT.java b/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinRemoteDevModeIT.java index 9ba328faad15a..abfefe1398438 100644 --- a/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinRemoteDevModeIT.java +++ b/integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinRemoteDevModeIT.java @@ -8,7 +8,6 @@ import java.util.concurrent.TimeUnit; import org.apache.maven.shared.invoker.MavenInvocationException; -import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import com.google.common.collect.ImmutableMap; @@ -19,7 +18,6 @@ public class KotlinRemoteDevModeIT extends RunAndCheckWithAgentMojoTestBase { @Test - @Tag("failsOnJDK16") public void testThatTheApplicationIsReloadedOnKotlinChange() throws MavenInvocationException, IOException, InterruptedException { testDir = initProject("projects/classic-kotlin", "projects/project-classic-run-kotlin-change-remote"); diff --git a/integration-tests/kotlin/src/test/resources/projects/classic-kotlin/pom.xml b/integration-tests/kotlin/src/test/resources/projects/classic-kotlin/pom.xml index 559f2bc1b640b..6e444009e1ee9 100644 --- a/integration-tests/kotlin/src/test/resources/projects/classic-kotlin/pom.xml +++ b/integration-tests/kotlin/src/test/resources/projects/classic-kotlin/pom.xml @@ -12,7 +12,7 @@ 11 UTF-8 11 - 1.4.32 + 1.5.20 diff --git a/integration-tests/kotlin/src/test/resources/projects/kotlin-compiler-args/pom.xml b/integration-tests/kotlin/src/test/resources/projects/kotlin-compiler-args/pom.xml index 687ef0797efb8..16e5a94b0eec7 100644 --- a/integration-tests/kotlin/src/test/resources/projects/kotlin-compiler-args/pom.xml +++ b/integration-tests/kotlin/src/test/resources/projects/kotlin-compiler-args/pom.xml @@ -12,7 +12,7 @@ 11 UTF-8 11 - 1.4.32 + 1.5.20