Skip to content

Commit

Permalink
Merge pull request #30148 from gsmet/2.15.2-backports-1
Browse files Browse the repository at this point in the history
2.15.2 backports 1
  • Loading branch information
gsmet authored Jan 4, 2023
2 parents 4abf476 + 02774a4 commit f8f3444
Show file tree
Hide file tree
Showing 59 changed files with 1,353 additions and 264 deletions.
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
<junit.jupiter.version>5.9.1</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<testng.version>6.14.2</testng.version>
<infinispan.version>14.0.3.Final</infinispan.version>
<infinispan.protostream.version>4.5.0.Final</infinispan.protostream.version>
<infinispan.version>14.0.4.Final</infinispan.version>
<infinispan.protostream.version>4.5.1.Final</infinispan.protostream.version>
<caffeine.version>3.1.1</caffeine.version>
<netty.version>4.1.86.Final</netty.version>
<brotli4j.version>1.8.0</brotli4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Result get() {
.loadClass("org.testcontainers.utility.TestcontainersConfiguration");
Object configurationInstance = configurationClass.getMethod("getInstance").invoke(null);
String oldReusePropertyValue = (String) configurationClass
.getMethod("getUserProperty", String.class, String.class)
.getMethod("getEnvVarOrUserProperty", String.class, String.class)
.invoke(configurationInstance, "testcontainers.reuse.enable", "false"); // use the default provided in TestcontainersConfiguration#environmentSupportsReuse
Method updateUserConfigMethod = configurationClass.getMethod("updateUserConfig", String.class, String.class);
// this will ensure that testcontainers does not start ryuk - see https://github.com/quarkusio/quarkus/issues/25852 for why this is important
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jboss.jandex.ArrayType;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -102,6 +103,8 @@ public class MainClassBuildStep {
void.class);
public static final MethodDescriptor CONFIGURE_STEP_TIME_START = ofMethod(StepTiming.class.getName(), "configureStart",
void.class);
private static final DotName QUARKUS_APPLICATION = DotName.createSimple(QuarkusApplication.class.getName());
private static final DotName OBJECT = DotName.createSimple(Object.class.getName());

@BuildStep
void build(List<StaticBytecodeRecorderBuildItem> staticInitTasks,
Expand Down Expand Up @@ -335,7 +338,8 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
PackageConfig packageConfig) {
String mainClassName = MAIN_CLASS;
Map<String, String> quarkusMainAnnotations = new HashMap<>();
Collection<AnnotationInstance> quarkusMains = combinedIndexBuildItem.getIndex()
IndexView index = combinedIndexBuildItem.getIndex();
Collection<AnnotationInstance> quarkusMains = index
.getAnnotations(DotName.createSimple(QuarkusMain.class.getName()));
for (AnnotationInstance i : quarkusMains) {
AnnotationValue nameValue = i.value("name");
Expand All @@ -349,7 +353,7 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
"More than one @QuarkusMain method found with name '" + name + "': "
+ classInfo.name() + " and " + quarkusMainAnnotations.get(name));
}
quarkusMainAnnotations.put(name, sanitizeMainClassName(classInfo));
quarkusMainAnnotations.put(name, sanitizeMainClassName(classInfo, index));
}

if (packageConfig.mainClass.isPresent()) {
Expand Down Expand Up @@ -380,9 +384,9 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
file.close();
}
} else {
Collection<ClassInfo> impls = combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(DotName.createSimple(QuarkusApplication.class.getName()));
ClassInfo classByName = combinedIndexBuildItem.getIndex().getClassByName(DotName.createSimple(mainClassName));
Collection<ClassInfo> impls = index
.getAllKnownImplementors(QUARKUS_APPLICATION);
ClassInfo classByName = index.getClassByName(DotName.createSimple(mainClassName));
MethodInfo mainClassMethod = null;
if (classByName != null) {
mainClassMethod = classByName
Expand All @@ -401,7 +405,7 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
generateMainForQuarkusApplication(mainClassName, generatedClass);
mainClassName = MAIN_CLASS;
} else {
ClassInfo classInfo = combinedIndexBuildItem.getIndex().getClassByName(DotName.createSimple(mainClassName));
ClassInfo classInfo = index.getClassByName(DotName.createSimple(mainClassName));
if (classInfo == null) {
throw new IllegalArgumentException("The supplied 'main-class' value of '" + mainClassName
+ "' does not correspond to either a fully qualified class name or a matching 'name' field of one of the '@QuarkusMain' annotations");
Expand All @@ -413,13 +417,28 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
return new MainClassBuildItem(mainClassName);
}

private static String sanitizeMainClassName(ClassInfo mainClass) {
private static String sanitizeMainClassName(ClassInfo mainClass, IndexView index) {
String className = mainClass.name().toString();
if (isKotlinClass(mainClass)) {
MethodInfo mainMethod = mainClass.method("main",
ArrayType.create(Type.create(DotName.createSimple(String.class.getName()), Type.Kind.CLASS), 1));
if (mainMethod == null) {
className += "Kt";
ClassInfo classToCheck = mainClass;
boolean hasQuarkusApplicationSuperClass = false;
while (classToCheck != null) {
DotName superName = classToCheck.superName();
if (superName.equals(QUARKUS_APPLICATION)) {
hasQuarkusApplicationSuperClass = true;
break;
}
if (superName.equals(OBJECT)) {
break;
}
classToCheck = index.getClassByName(superName);
}
if (!hasQuarkusApplicationSuperClass) {
className += "Kt";
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ public void write(String s, byte[] bytes) {
CatchBlockCreator cc = tc.addCatch(Throwable.class);
cc.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), cc.getCaughtException());
}
runtimeInitializedPackages.returnValue(packagesArray);

ResultHandle packages = overallCatch.invokeStaticMethod(runtimeInitializedPackages.getMethodDescriptor());
overallCatch.invokeStaticMethod(INITIALIZE_PACKAGES_AT_RUN_TIME, packages);
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/infinispan-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ This command adds the following dependency to your build file:
.build.gradle
----
implementation 'io.quarkus:quarkus-infinispan-client'
annotationProcessor 'org.infinispan.protostream:protostream-processor:4.5.0.Final' <1>
annotationProcessor 'org.infinispan.protostream:protostream-processor:4.5.1.Final' <1>
----
<1> Mandatory in the gradle build to enable the generation of the files in the annotation based serialization
<1> Mandatory in the Gradle build to enable the generation of the files in the annotation based serialization

== Configuring the Infinispan client

Expand Down
7 changes: 0 additions & 7 deletions docs/src/main/asciidoc/performance-measure.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@ all services it's able to find on the classpath.

We prefer listing services explicitly as it produces better optimised binaries. Disable it as well by setting `-H:-UseServiceLoaderFeature`.

=== Better default for Garbage Collection implementation

The default in GraalVM seems meant to optimise for short-lived processes.

Quarkus defaults to server applications, so we switch to a better default by setting
`-H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime`.

=== Others ...

This section is provided as high level guidance, but can't presume to be comprehensive as some flags are controlled
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/smallrye-health.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ public class LivenessAsync implements AsyncHealthCheck {
Some extension may provide default health checks, including the extension will automatically register its health checks.

For example, `quarkus-agroal` that is used to manage Quarkus datasource(s) automatically register a readiness health check
that will validate each datasources: xref:datasource.adoc#datasource-health-check[Datasource Health Check].
that will validate each datasource: xref:datasource.adoc#datasource-health-check[Datasource Health Check].

You can disable extension health check via the property `quarkus.health.extensions.enabled` so none will be automatically registered.
You can disable extension health checks via the property `quarkus.health.extensions.enabled` so none will be automatically registered.

[[ui]]
== Health UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ metadata:
guide: "https://quarkus.io/guides/cache"
categories:
- "data"
status: "preview"
status: "stable"
config:
- "quarkus.cache."
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
package io.quarkus.csrf.reactive;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.BooleanSupplier;

import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.MethodInfo;
import org.jboss.resteasy.reactive.server.model.FixedHandlersChainCustomizer;
import org.jboss.resteasy.reactive.server.model.HandlerChainCustomizer;
import org.jboss.resteasy.reactive.server.processor.scanning.MethodScanner;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.csrf.reactive.runtime.CsrfHandler;
import io.quarkus.csrf.reactive.runtime.CsrfReactiveConfig;
import io.quarkus.csrf.reactive.runtime.CsrfRecorder;
import io.quarkus.csrf.reactive.runtime.CsrfResponseFilter;
import io.quarkus.csrf.reactive.runtime.CsrfRequestResponseReactiveFilter;
import io.quarkus.csrf.reactive.runtime.CsrfTokenParameterProvider;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.BuildSteps;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.resteasy.reactive.server.spi.HandlerConfigurationProviderBuildItem;
import io.quarkus.resteasy.reactive.server.spi.MethodScannerBuildItem;

@BuildSteps(onlyIf = CsrfReactiveBuildStep.IsEnabled.class)
public class CsrfReactiveBuildStep {
Expand All @@ -34,33 +18,11 @@ public class CsrfReactiveBuildStep {
void registerProvider(BuildProducer<AdditionalBeanBuildItem> additionalBeans,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<AdditionalIndexedClassesBuildItem> additionalIndexedClassesBuildItem) {
additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(CsrfResponseFilter.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, CsrfResponseFilter.class));
additionalIndexedClassesBuildItem
.produce(new AdditionalIndexedClassesBuildItem(CsrfResponseFilter.class.getName()));

additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(CsrfRequestResponseReactiveFilter.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, CsrfRequestResponseReactiveFilter.class));
additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(CsrfTokenParameterProvider.class));
}

@BuildStep
public MethodScannerBuildItem configureHandler() {
return new MethodScannerBuildItem(new MethodScanner() {
@Override
public List<HandlerChainCustomizer> scan(MethodInfo method, ClassInfo actualEndpointClass,
Map<String, Object> methodContext) {
return Collections.singletonList(
new FixedHandlersChainCustomizer(
List.of(new CsrfHandler()),
HandlerChainCustomizer.Phase.BEFORE_METHOD_INVOKE));
}
});
}

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
public HandlerConfigurationProviderBuildItem applyRuntimeConfig(CsrfRecorder recorder,
CsrfReactiveConfig csrfReactiveConfig) {
return new HandlerConfigurationProviderBuildItem(CsrfReactiveConfig.class, recorder.configure(csrfReactiveConfig));
additionalIndexedClassesBuildItem
.produce(new AdditionalIndexedClassesBuildItem(CsrfRequestResponseReactiveFilter.class.getName()));
}

public static class IsEnabled implements BooleanSupplier {
Expand Down

This file was deleted.

Loading

0 comments on commit f8f3444

Please sign in to comment.