Skip to content

Commit 6cc5581

Browse files
authored
Merge pull request #47965 from gsmet/3.23.0-backports-1
[3.23] 3.23.0 backports 1
2 parents 53a8789 + 2f482ae commit 6cc5581

File tree

62 files changed

+1170
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1170
-272
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ nb-configuration.xml
3939
.mvn/.develocity
4040
.mvn/.gradle-enterprise/
4141
.quarkus
42+
43+
.goosehints
44+
.goose

bom/application/pom.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
hibernate-search.version, antlr.version, bytebuddy.version, hibernate-commons-annotations.version -->
9999
<narayana.version>7.2.2.Final</narayana.version>
100100
<narayana-lra.version>1.0.0.Final</narayana-lra.version>
101-
<agroal.version>2.6</agroal.version>
101+
<agroal.version>2.7</agroal.version>
102102
<jboss-transaction-spi.version>8.0.0.Final</jboss-transaction-spi.version>
103103
<elasticsearch-opensource-components.version>8.18.1</elasticsearch-opensource-components.version>
104104
<rxjava.version>2.2.21</rxjava.version>
@@ -133,7 +133,7 @@
133133
<infinispan.version>15.0.14.Final</infinispan.version>
134134
<infinispan.protostream.version>5.0.13.Final</infinispan.protostream.version>
135135
<caffeine.version>3.2.0</caffeine.version>
136-
<netty.version>4.1.119.Final</netty.version>
136+
<netty.version>4.1.121.Final</netty.version>
137137
<brotli4j.version>1.16.0</brotli4j.version>
138138
<reactive-streams.version>1.0.4</reactive-streams.version>
139139
<jboss-logging.version>3.6.1.Final</jboss-logging.version>
@@ -151,7 +151,7 @@
151151
<cloudevents-api.version>3.0.0</cloudevents-api.version>
152152
<azure-functions-java-library.version>3.1.0</azure-functions-java-library.version>
153153
<azure-functions-java-spi.version>1.0.0</azure-functions-java-spi.version>
154-
<kotlin.version>2.1.20</kotlin.version>
154+
<kotlin.version>2.1.21</kotlin.version>
155155
<kotlin.coroutine.version>1.10.2</kotlin.coroutine.version>
156156
<kotlin-serialization.version>1.8.1</kotlin-serialization.version>
157157
<azure.toolkit-lib.version>0.27.0</azure.toolkit-lib.version>
@@ -398,6 +398,12 @@
398398
<scope>import</scope>
399399
<type>pom</type>
400400
</dependency>
401+
<dependency>
402+
<groupId>io.perfmark</groupId>
403+
<artifactId>perfmark-api</artifactId>
404+
<version>${perfmark.version}</version>
405+
</dependency>
406+
401407

402408
<!-- Micrometer Core and Registries, imported as BOM -->
403409
<dependency>

build-parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<!-- These properties are needed in order for them to be resolvable by the generated projects -->
2222
<compiler-plugin.version>${version.compiler.plugin}</compiler-plugin.version>
23-
<kotlin.version>2.1.20</kotlin.version>
23+
<kotlin.version>2.1.21</kotlin.version>
2424
<dokka.version>2.0.0</dokka.version>
2525
<scala.version>2.13.12</scala.version>
2626
<scala-maven-plugin.version>4.9.5</scala-maven-plugin.version>

core/deployment/src/main/java/io/quarkus/deployment/dev/ClassComparisonUtil.java

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
import java.util.stream.Collectors;
1212

1313
import org.jboss.jandex.AnnotationInstance;
14-
import org.jboss.jandex.AnnotationTarget;
1514
import org.jboss.jandex.AnnotationValue;
1615
import org.jboss.jandex.ClassInfo;
1716
import org.jboss.jandex.DotName;
1817
import org.jboss.jandex.FieldInfo;
1918
import org.jboss.jandex.MethodInfo;
2019
import org.jboss.jandex.Type;
20+
import org.jboss.jandex.TypeTarget;
2121

2222
public class ClassComparisonUtil {
2323
private static final Set<DotName> IGNORED_ANNOTATIONS = Set.of(
@@ -130,10 +130,12 @@ static boolean compareMethodAnnotations(Collection<AnnotationInstance> a, Collec
130130
}
131131
List<AnnotationInstance> method1 = new ArrayList<>();
132132
Map<Integer, List<AnnotationInstance>> params1 = new HashMap<>();
133-
methodMap(a, method1, params1);
133+
Map<Integer, List<AnnotationInstance>> paramTypes1 = new HashMap<>();
134+
methodMap(a, method1, params1, paramTypes1);
134135
List<AnnotationInstance> method2 = new ArrayList<>();
135136
Map<Integer, List<AnnotationInstance>> params2 = new HashMap<>();
136-
methodMap(b, method2, params2);
137+
Map<Integer, List<AnnotationInstance>> paramTypes2 = new HashMap<>();
138+
methodMap(b, method2, params2, paramTypes2);
137139
if (!compareAnnotations(method1, method2)) {
138140
return false;
139141
}
@@ -146,21 +148,38 @@ static boolean compareMethodAnnotations(Collection<AnnotationInstance> a, Collec
146148
return false;
147149
}
148150
}
151+
for (Map.Entry<Integer, List<AnnotationInstance>> entry : paramTypes1.entrySet()) {
152+
List<AnnotationInstance> other = paramTypes2.get(entry.getKey());
153+
if (!compareAnnotations(other, entry.getValue())) {
154+
return false;
155+
}
156+
}
149157
return true;
150158
}
151159

152160
private static void methodMap(Collection<AnnotationInstance> b, List<AnnotationInstance> method2,
153-
Map<Integer, List<AnnotationInstance>> params2) {
161+
Map<Integer, List<AnnotationInstance>> params2, Map<Integer, List<AnnotationInstance>> paramTypes2) {
154162
for (AnnotationInstance i : b) {
155-
if (i.target().kind() == AnnotationTarget.Kind.METHOD) {
156-
method2.add(i);
157-
} else {
158-
int index = i.target().asMethodParameter().position();
159-
List<AnnotationInstance> instances = params2.get(index);
160-
if (instances == null) {
161-
params2.put(index, instances = new ArrayList<>());
162-
}
163-
instances.add(i);
163+
int index;
164+
switch (i.target().kind()) {
165+
case METHOD:
166+
method2.add(i);
167+
break;
168+
case METHOD_PARAMETER:
169+
index = i.target().asMethodParameter().position();
170+
params2.computeIfAbsent(index, k -> new ArrayList<>()).add(i);
171+
break;
172+
case TYPE:
173+
TypeTarget.Usage usage = i.target().asType().usage();
174+
if (usage == TypeTarget.Usage.METHOD_PARAMETER) {
175+
index = i.target().asType().asMethodParameterType().position();
176+
paramTypes2.computeIfAbsent(index, k -> new ArrayList<>()).add(i);
177+
} else {
178+
throw new IllegalArgumentException("Unsupported type annotation usage: " + usage);
179+
}
180+
break;
181+
default:
182+
throw new IllegalArgumentException("Unsupported annotation target kind: " + i.target().kind());
164183
}
165184
}
166185
}

core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,18 @@ private void checkForClassFilesChangesInModule(DevModeContext.ModuleInfo module,
849849
.collect(Collectors.toSet());
850850

851851
for (Path classFilePath : classFilePaths) {
852-
final Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
853-
module, cuf, timestampSet);
854-
852+
Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
853+
module, cuf, timestampSet, false);
855854
if (sourceFilePath != null) {
855+
if (!sourceFilePath.toFile().exists()) {
856+
// We need to refresh this in case the source file has changed
857+
// This can happen if you rename a kotlin file, the same class will now be provided by a new file
858+
var updated = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
859+
module, cuf, timestampSet, true);
860+
if (updated != null) {
861+
sourceFilePath = updated;
862+
}
863+
}
856864
if (!sourceFilePath.toFile().exists()) {
857865
// Source file has been deleted. Delete class and restart
858866
cleanUpClassFile(classFilePath, timestampSet);
@@ -888,9 +896,9 @@ private void checkForClassFilesChangesInModule(DevModeContext.ModuleInfo module,
888896

889897
private Path retrieveSourceFilePathForClassFile(Path classFilePath, List<Path> moduleChangedSourceFiles,
890898
DevModeContext.ModuleInfo module, Function<DevModeContext.ModuleInfo, DevModeContext.CompilationUnit> cuf,
891-
TimestampSet timestampSet) {
899+
TimestampSet timestampSet, boolean forceRefresh) {
892900
Path sourceFilePath = timestampSet.classFilePathToSourceFilePath.get(classFilePath);
893-
if (sourceFilePath == null || moduleChangedSourceFiles.contains(sourceFilePath)) {
901+
if (sourceFilePath == null || moduleChangedSourceFiles.contains(sourceFilePath) || forceRefresh) {
894902
sourceFilePath = compiler.findSourcePath(classFilePath, cuf.apply(module).getSourcePaths(),
895903
cuf.apply(module).getClassesPath());
896904
}

core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public interface TestConfig {
160160
/**
161161
* The profile to use when testing using {@code @QuarkusIntegrationTest}
162162
*/
163-
@WithDefault("${quarkus.profile:prod}")
163+
@WithDefault("prod")
164164
String integrationTestProfile();
165165

166166
/**
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package io.quarkus.deployment.dev.testing;
2+
3+
import java.util.function.Function;
4+
5+
import io.quarkus.runtime.LaunchMode;
6+
import io.smallrye.config.ConfigSourceInterceptor;
7+
import io.smallrye.config.ConfigSourceInterceptorContext;
8+
import io.smallrye.config.ConfigSourceInterceptorFactory;
9+
import io.smallrye.config.FallbackConfigSourceInterceptor;
10+
import io.smallrye.config.SmallRyeConfigBuilder;
11+
import io.smallrye.config.SmallRyeConfigBuilderCustomizer;
12+
13+
public class TestConfigCustomizer implements SmallRyeConfigBuilderCustomizer {
14+
private final LaunchMode launchMode;
15+
16+
public TestConfigCustomizer(final LaunchMode launchMode) {
17+
this.launchMode = launchMode;
18+
}
19+
20+
@Override
21+
public void configBuilder(final SmallRyeConfigBuilder builder) {
22+
builder.withDefaultValue("quarkus.profile", launchMode.getDefaultProfile());
23+
builder.withMapping(TestConfig.class);
24+
builder.withInterceptorFactories(new ConfigSourceInterceptorFactory() {
25+
@Override
26+
public ConfigSourceInterceptor getInterceptor(final ConfigSourceInterceptorContext context) {
27+
return new FallbackConfigSourceInterceptor(new Function<String, String>() {
28+
@Override
29+
public String apply(final String name) {
30+
if (name.equals("quarkus.test.integration-test-profile")) {
31+
return "quarkus.profile";
32+
}
33+
return name;
34+
}
35+
});
36+
}
37+
});
38+
}
39+
40+
@Override
41+
public int priority() {
42+
return SmallRyeConfigBuilderCustomizer.super.priority();
43+
}
44+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package io.quarkus.deployment.dev;
2+
3+
import java.lang.annotation.Annotation;
4+
import java.lang.annotation.Documented;
5+
import java.lang.annotation.ElementType;
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
import java.lang.annotation.Target;
9+
import java.util.List;
10+
11+
import org.jboss.jandex.AnnotationInstance;
12+
import org.jboss.jandex.MethodParameterInfo;
13+
import org.junit.jupiter.api.Assertions;
14+
import org.junit.jupiter.api.Nested;
15+
import org.junit.jupiter.api.Test;
16+
17+
class ClassComparisonUtilTest {
18+
19+
@Nested
20+
class CompareMethodAnnotations {
21+
22+
@Test
23+
public void annotationsEqual() {
24+
AnnotationInstance instance1 = methodParameterAnnotation(AnnotationForTest1.class);
25+
AnnotationInstance instance2 = methodParameterAnnotation(AnnotationForTest1.class);
26+
27+
List<AnnotationInstance> instances1 = List.of(instance1);
28+
List<AnnotationInstance> instances2 = List.of(instance2);
29+
30+
Assertions.assertTrue(ClassComparisonUtil.compareMethodAnnotations(instances1, instances2));
31+
}
32+
33+
@Test
34+
public void annotationsNotEqual() {
35+
AnnotationInstance instance1 = methodParameterAnnotation(AnnotationForTest1.class);
36+
AnnotationInstance instance2 = methodParameterAnnotation(AnnotationForTest2.class);
37+
38+
List<AnnotationInstance> instances1 = List.of(instance1);
39+
List<AnnotationInstance> instances2 = List.of(instance2);
40+
41+
Assertions.assertFalse(ClassComparisonUtil.compareMethodAnnotations(instances1, instances2));
42+
}
43+
44+
@Test
45+
public void compareMethodAnnotationsSizeDiffer() {
46+
AnnotationInstance instance = methodParameterAnnotation(AnnotationForTest1.class);
47+
48+
List<AnnotationInstance> instances = List.of(instance);
49+
50+
Assertions.assertFalse(ClassComparisonUtil.compareMethodAnnotations(instances, List.of()));
51+
Assertions.assertFalse(ClassComparisonUtil.compareMethodAnnotations(List.of(), instances));
52+
}
53+
54+
@Test
55+
public void multipleAnnotationsAtSamePosition() {
56+
List<AnnotationInstance> instances1 = List.of(
57+
methodParameterAnnotation(AnnotationForTest1.class),
58+
methodParameterAnnotation(AnnotationForTest2.class));
59+
List<AnnotationInstance> instances2 = List.of(
60+
methodParameterAnnotation(AnnotationForTest2.class),
61+
methodParameterAnnotation(AnnotationForTest1.class));
62+
63+
Assertions.assertTrue(ClassComparisonUtil.compareMethodAnnotations(instances1, instances2));
64+
}
65+
66+
@Test
67+
public void multipleAnnotations() {
68+
List<AnnotationInstance> instances1 = List.of(
69+
methodParameterAnnotation(AnnotationForTest1.class, 1),
70+
methodParameterAnnotation(AnnotationForTest2.class, 2));
71+
72+
List<AnnotationInstance> instances2 = List.of(
73+
methodParameterAnnotation(AnnotationForTest1.class, 2),
74+
methodParameterAnnotation(AnnotationForTest2.class, 1));
75+
76+
Assertions.assertFalse(ClassComparisonUtil.compareMethodAnnotations(instances1, instances2));
77+
}
78+
79+
private static AnnotationInstance methodParameterAnnotation(
80+
Class<? extends Annotation> annotation) {
81+
return methodParameterAnnotation(annotation, 1);
82+
}
83+
84+
private static AnnotationInstance methodParameterAnnotation(
85+
Class<? extends Annotation> annotation, int position) {
86+
MethodParameterInfo target = MethodParameterInfo.create(null, (short) position);
87+
return AnnotationInstance.builder(annotation).buildWithTarget(target);
88+
}
89+
90+
@Target({ ElementType.PARAMETER, ElementType.TYPE_USE })
91+
@Retention(RetentionPolicy.RUNTIME)
92+
@Documented
93+
private @interface AnnotationForTest1 {
94+
}
95+
96+
@Target({ ElementType.PARAMETER, ElementType.TYPE_USE })
97+
@Retention(RetentionPolicy.RUNTIME)
98+
@Documented
99+
private @interface AnnotationForTest2 {
100+
}
101+
}
102+
103+
}

core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,22 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
3535
}
3636

3737
private void definePackage(String name) {
38-
final String pkgName = getPackageNameFromClassName(name);
39-
if ((pkgName != null) && getPackage(pkgName) == null) {
40-
synchronized (getClassLoadingLock(pkgName)) {
41-
if (getPackage(pkgName) == null) {
42-
// this could certainly be improved to use the actual manifest
43-
definePackage(pkgName, null, null, null, null, null, null, null);
44-
}
38+
var pkgName = getPackageNameFromClassName(name);
39+
if (pkgName == null) {
40+
return;
41+
}
42+
if (getDefinedPackage(pkgName) != null) {
43+
return;
44+
}
45+
try {
46+
// this could certainly be improved to use the actual manifest
47+
definePackage(pkgName, null, null, null, null, null, null, null);
48+
} catch (IllegalArgumentException e) {
49+
// retry, thrown by definePackage(), if a package for the same name is already defines by this class loader.
50+
if (getDefinedPackage(pkgName) != null) {
51+
return;
4552
}
53+
throw e;
4654
}
4755
}
4856

devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/QuarkusPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void shouldReturnMultipleOutputSourceDirectories() {
105105

106106
@Test
107107
public void shouldNotFailOnProjectDependenciesWithoutMain(@TempDir Path testProjectDir) throws IOException {
108-
var kotlinVersion = System.getProperty("kotlin_version", "2.1.20");
108+
var kotlinVersion = System.getProperty("kotlin_version", "2.1.21");
109109
var settingFile = testProjectDir.resolve("settings.gradle.kts");
110110
var mppProjectDir = testProjectDir.resolve("mpp");
111111
var quarkusProjectDir = testProjectDir.resolve("quarkus");

0 commit comments

Comments
 (0)