Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 4bfd3cc
Merge: 76744d6 cfcd5a3
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Wed Apr 24 14:31:22 2024 +0200

    Merge branch 'quarkusio:main' into grpc-transcoding

commit 76744d6
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Wed Apr 24 14:17:07 2024 +0200

    chore(transcoding): moved some generic methods to util classes

commit cfcd5a3
Merge: 4945eaa 288a54d
Author: Guillaume Smet <guillaume.smet@gmail.com>
Date:   Wed Apr 24 13:31:10 2024 +0200

    Merge pull request quarkusio#40218 from gastaldi/bump_http

    Bump Quarkus HTTP to 5.2.2.Final

commit 4945eaa
Merge: ea41b08 7d56d5d
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Date:   Wed Apr 24 12:28:39 2024 +0100

    Merge pull request quarkusio#40211 from sberyozkin/bc_fips_test

    Add another BouncyCastle FIPS test

commit ea41b08
Merge: fae267b d3db508
Author: Yoann Rodière <yoann@hibernate.org>
Date:   Wed Apr 24 13:13:49 2024 +0200

    Merge pull request quarkusio#40238 from gsmet/run-if-wip

    Run CI when title starts with WIP

commit 82bde60
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Wed Apr 24 12:47:33 2024 +0200

    feat(transcoding): added http method check and code refactor

commit 44ac07c
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Wed Apr 24 12:01:25 2024 +0200

    feat(transcoding): added support for path parameter and query parameters

commit fae267b
Merge: 20ed823 618fbbd
Author: Yoann Rodière <yoann@hibernate.org>
Date:   Wed Apr 24 11:49:06 2024 +0200

    Merge pull request quarkusio#40235 from yrodiere/image-metrics-return

    When verifying image metrics, return all failures instead of just the first one

commit 3fe1e11
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Wed Apr 24 11:48:34 2024 +0200

    feat(transcoding): added support for path parameter and query parameters

commit 20ed823
Merge: fb4963a 6625d56
Author: Martin Kouba <mkouba@redhat.com>
Date:   Wed Apr 24 10:04:40 2024 +0200

    Merge pull request quarkusio#39233 from radcortez/mp-config-3.1

    Update MicroProfile Config to 3.1

commit d3db508
Author: Guillaume Smet <guillaume.smet@gmail.com>
Date:   Tue Apr 23 16:26:16 2024 +0200

    Run CI when title starts with WIP

    We introduced this check when draft PRs weren't a thing but nowadays,
    it's nice to be able to convey the fact that we don't want the PR to get
    merged but still want main CI to run.

commit 618fbbd
Author: Yoann Rodière <yoann@hibernate.org>
Date:   Wed Apr 24 08:58:41 2024 +0200

    When verifying image metrics, return all failures instead of just the first one

    Building a native image takes a lot of time, so it's quite frustrating to iterate on this and solve errors one by one. Better have all the information upfront.

commit fb4963a
Merge: eddc31b 4411438
Author: Yoann Rodière <yoann@hibernate.org>
Date:   Wed Apr 24 08:41:13 2024 +0200

    Merge pull request quarkusio#40230 from quarkusio/dependabot/maven/hibernate-orm.version-6.4.5.Final

    Bump hibernate-orm.version from 6.4.4.Final to 6.4.5.Final

commit eddc31b
Merge: 648de87 2a2bb84
Author: Clement Escoffier <clement@apache.org>
Date:   Wed Apr 24 08:32:59 2024 +0200

    Merge pull request quarkusio#40173 from cescoffier/grpc-concurrent-blocking-call

    Allow concurrent invocation of blocking gRPC services by removing global ordering

commit 648de87
Merge: 0efd81a c97b545
Author: Phillip Krüger <phillip.kruger@gmail.com>
Date:   Wed Apr 24 11:34:33 2024 +1000

    Merge pull request quarkusio#40228 from dgf/main

    Fixed order for default OpenAPI security responses

commit 4411438
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Apr 23 21:40:24 2024 +0000

    Bump hibernate-orm.version from 6.4.4.Final to 6.4.5.Final

    Bumps `hibernate-orm.version` from 6.4.4.Final to 6.4.5.Final.

    Updates `org.hibernate.orm:hibernate-core` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    Updates `org.hibernate.orm:hibernate-graalvm` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    Updates `org.hibernate.orm:hibernate-envers` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    Updates `org.hibernate.orm:hibernate-jpamodelgen` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    Updates `org.hibernate:hibernate-jpamodelgen` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    Updates `org.hibernate.orm:hibernate-community-dialects` from 6.4.4.Final to 6.4.5.Final
    - [Release notes](https://github.com/hibernate/hibernate-orm/releases)
    - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.4.5/changelog.txt)
    - [Commits](hibernate/hibernate-orm@6.4.4...6.4.5)

    ---
    updated-dependencies:
    - dependency-name: org.hibernate.orm:hibernate-core
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.hibernate.orm:hibernate-graalvm
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.hibernate.orm:hibernate-envers
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.hibernate.orm:hibernate-jpamodelgen
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.hibernate:hibernate-jpamodelgen
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.hibernate.orm:hibernate-community-dialects
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

commit c97b545
Author: Danny Gräf <deep@dagnu.de>
Date:   Tue Apr 23 13:00:05 2024 +0100

    Fixed order for default OpenAPI security responses

commit 6625d56
Author: Roberto Cortez <radcortez@yahoo.com>
Date:   Wed Mar 6 16:53:16 2024 +0000

    Update MicroProfile Config to 3.1

commit 7d56d5d
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Date:   Tue Apr 23 11:18:23 2024 +0100

    Add another BouncyCastle FIPS test

commit 288a54d
Author: George Gastaldi <gegastaldi@gmail.com>
Date:   Tue Apr 23 11:06:25 2024 -0300

    Bump Quarkus HTTP to 5.2.2.Final

commit 0efd81a
Merge: b09853f 8d8dc6e
Author: Yoann Rodière <yoann@hibernate.org>
Date:   Tue Apr 23 18:27:22 2024 +0200

    Merge pull request quarkusio#40214 from zakkak/2024-04-23-fix-webjar-locator-it

    Use new webjars-locator name in integration test

commit b09853f
Merge: af955bd 9e05bd9
Author: George Gastaldi <gegastaldi@gmail.com>
Date:   Tue Apr 23 12:48:55 2024 -0300

    Merge pull request quarkusio#40157 from Dairdevil/feature/fabric8-split-package-resolved

    Remove explicitly ignored split packages

commit 320a63f
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Tue Apr 23 14:30:51 2024 +0200

    feat(transcoding): initial version of complex paths

commit af955bd
Merge: a3d1568 469fd3a
Author: Sanne Grinovero <sanne@hibernate.org>
Date:   Tue Apr 23 13:16:39 2024 +0100

    Merge pull request quarkusio#40203 from stuartwdouglas/eager-classes

    Deprecate 'eager transformers'

commit 8d8dc6e
Author: Foivos Zakkak <fzakkak@redhat.com>
Date:   Tue Apr 23 14:33:39 2024 +0300

    Use new webjars-locator name in integration test

    Closes quarkusio#40213

commit f77df97
Merge: 2af788d a3d1568
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Tue Apr 23 12:49:53 2024 +0200

    Merge branch 'quarkusio:main' into grpc-transcoding

commit 469fd3a
Author: Stuart Douglas <stuart.w.douglas@gmail.com>
Date:   Tue Apr 23 17:29:37 2024 +1000

    Deprecate 'eager transformers'

    They have not done anything for a while and no longer make sense.

commit 2af788d
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Sun Apr 21 22:42:11 2024 +0200

    feat(transcoding): removed unnecessary code

commit 2a2bb84
Author: Clement Escoffier <clement.escoffier@gmail.com>
Date:   Sun Apr 21 16:17:25 2024 +0200

    Allow concurrent invocation of blocking gRPC services by removing global ordering

    Fix quarkusio#40155

    Previously, the code utilized `executeBlocking` with `ordered=true` to maintain event order. However, this approach enforced global order instead of per-call order. This commit corrects the behavior, ensuring per-call order preservation using the BlockingExecutionHandler lock.

commit 3e9ce41
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Sat Apr 20 12:56:40 2024 +0200

    feat(transcoding): removed unnecessary encoding

commit 817d9a0
Merge: 89fdbd5 914ae38
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Sat Apr 20 12:16:22 2024 +0200

    Merge branch 'refs/heads/main' into grpc-transcoding

commit 9e05bd9
Author: Alasdair Preston <apreston@redhat.com>
Date:   Fri Apr 19 14:35:59 2024 +0100

    Remove split package ignored list as no entries remain

commit 89fdbd5
Author: Daniel Fiala <danfiala23@gmail.com>
Date:   Fri Apr 19 09:48:15 2024 +0200

    chore(transcoding): cleanup
  • Loading branch information
zZHorizonZz committed Apr 24, 2024
1 parent 483ebc1 commit f789168
Show file tree
Hide file tree
Showing 74 changed files with 1,063 additions and 505 deletions.
2 changes: 1 addition & 1 deletion .github/native-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
{
"category": "Misc4",
"timeout": 130,
"test-modules": "picocli-native, gradle, micrometer-mp-metrics, micrometer-prometheus, logging-json, jaxp, jaxb, opentelemetry, opentelemetry-jdbc-instrumentation, opentelemetry-redis-instrumentation, webjars-locator",
"test-modules": "picocli-native, gradle, micrometer-mp-metrics, micrometer-prometheus, logging-json, jaxp, jaxb, opentelemetry, opentelemetry-jdbc-instrumentation, opentelemetry-redis-instrumentation, web-dependency-locator",
"os-name": "ubuntu-latest"
},
{
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,12 @@ jobs:
name: "Initial JDK 17 Build"
runs-on: ubuntu-latest
# Skip main in forks
# Skip draft PRs and those with WIP in the subject, rerun as soon as its removed
# Skip draft PRs, rerun as soon as its removed
if: "(github.repository == 'quarkusio/quarkus' || !endsWith(github.ref, '/main')) && ( \
github.event_name != 'pull_request' || ( \
github.event.pull_request.draft == false && \
github.event.pull_request.state != 'closed' && \
contains(github.event.pull_request.title, 'wip ') == false && \
contains(github.event.pull_request.title, '[wip]') == false && \
(
github.event.action != 'edited' || \
contains(github.event.changes.title.from, 'wip ') || \
contains(github.event.changes.title.from, '[wip]') \
) \
github.event.action != 'edited' \
) \
)"
outputs:
Expand Down
6 changes: 3 additions & 3 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
<opentelemetry.version>1.32.0</opentelemetry.version>
<opentelemetry-alpha.version>1.32.0-alpha</opentelemetry-alpha.version>
<opentelemetry-semconv.version>1.21.0-alpha</opentelemetry-semconv.version> <!-- keep in sync with opentelemetry-java-instrumentation in the alpha bom-->
<quarkus-http.version>5.2.1.Final</quarkus-http.version>
<quarkus-http.version>5.2.2.Final</quarkus-http.version>
<micrometer.version>1.12.4</micrometer.version><!-- keep in sync with hdrhistogram -->
<hdrhistogram.version>2.1.12</hdrhistogram.version><!-- keep in sync with micrometer -->
<google-auth.version>0.22.0</google-auth.version>
<graphql-java.version>21.3</graphql-java.version> <!-- keep in sync with smallrye-graphql -->
<microprofile-config-api.version>3.0.3</microprofile-config-api.version>
<microprofile-config-api.version>3.1</microprofile-config-api.version>
<microprofile-health-api.version>4.0.1</microprofile-health-api.version>
<microprofile-metrics-api.version>4.0.1</microprofile-metrics-api.version>
<microprofile-context-propagation.version>1.3</microprofile-context-propagation.version>
Expand Down Expand Up @@ -101,7 +101,7 @@
bytebuddy.version (just below), hibernate-orm.version-for-documentation (in docs/pom.xml)
and both hibernate-orm.version and antlr.version in build-parent/pom.xml
WARNING again for diffs that don't provide enough context: when updating, see above -->
<hibernate-orm.version>6.4.4.Final</hibernate-orm.version>
<hibernate-orm.version>6.4.5.Final</hibernate-orm.version>
<bytebuddy.version>1.14.11</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>6.0.6.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<hibernate-reactive.version>2.2.2.Final</hibernate-reactive.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@

public final class BytecodeTransformerBuildItem extends MultiBuildItem {

/**
* If this is true it means the class should be loaded eagerly by a thread pool in dev mode
* on multithreaded systems.
* <p>
* Transformation is expensive, so doing it this way can speed up boot time.
*/
final boolean eager;
final String classToTransform;
final BiFunction<String, ClassVisitor, ClassVisitor> visitorFunction;

Expand Down Expand Up @@ -75,7 +68,6 @@ public BytecodeTransformerBuildItem(boolean eager, String classToTransform,
BiFunction<String, ClassVisitor, ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry,
boolean cacheable) {
Objects.requireNonNull(visitorFunction, "visitorFunction");
this.eager = eager;
this.classToTransform = classToTransform;
this.visitorFunction = visitorFunction;
this.requireConstPoolEntry = requireConstPoolEntry;
Expand All @@ -87,7 +79,6 @@ public BytecodeTransformerBuildItem(boolean eager, String classToTransform,
}

public BytecodeTransformerBuildItem(Builder builder) {
this.eager = builder.eager;
this.classToTransform = builder.classToTransform;
this.visitorFunction = builder.visitorFunction;
this.requireConstPoolEntry = builder.requireConstPoolEntry;
Expand All @@ -113,8 +104,9 @@ public Set<String> getRequireConstPoolEntry() {
return requireConstPoolEntry;
}

@Deprecated
public boolean isEager() {
return eager;
return false;
}

public boolean isCacheable() {
Expand Down Expand Up @@ -161,7 +153,6 @@ public static class Builder {
private String classToTransform;
private BiFunction<String, ClassVisitor, ClassVisitor> visitorFunction;
private Set<String> requireConstPoolEntry = null;
private boolean eager = false;
private boolean cacheable = false;
private int classReaderOptions = 0;
private int priority = 0;
Expand Down Expand Up @@ -191,8 +182,8 @@ public Builder setRequireConstPoolEntry(Set<String> requireConstPoolEntry) {
return this;
}

@Deprecated
public Builder setEager(boolean eager) {
this.eager = eager;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ public static class TransformedClass {
*/
private final byte[] data;
private final String fileName;
private final boolean eager;

@Deprecated
public TransformedClass(String className, byte[] data, String fileName, boolean eager) {
this.className = className;
this.data = data;
this.fileName = fileName;
this.eager = eager;
}

public TransformedClass(String className, byte[] data, String fileName) {
this.className = className;
this.data = data;
this.fileName = fileName;
}

public byte[] getData() {
Expand All @@ -67,8 +72,9 @@ public String getClassName() {
return className;
}

@Deprecated
public boolean isEager() {
return eager;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ TransformedClassesBuildItem handleClassTransformation(List<BytecodeTransformerBu
bytecodeTransformerBuildItems.size());
Set<String> noConstScanning = new HashSet<>();
Map<String, Set<String>> constScanning = new HashMap<>();
Set<String> eager = new HashSet<>();
Set<String> nonCacheable = new HashSet<>();
Map<String, Integer> classReaderOptions = new HashMap<>();
for (BytecodeTransformerBuildItem i : bytecodeTransformerBuildItems) {
Expand All @@ -106,9 +105,6 @@ TransformedClassesBuildItem handleClassTransformation(List<BytecodeTransformerBu
constScanning.computeIfAbsent(i.getClassToTransform(), (s) -> new HashSet<>())
.addAll(i.getRequireConstPoolEntry());
}
if (i.isEager()) {
eager.add(i.getClassToTransform());
}
if (!i.isCacheable()) {
nonCacheable.add(i.getClassToTransform());
}
Expand Down Expand Up @@ -164,7 +160,7 @@ public byte[] apply(String className, byte[] originalBytes) {
classReaderOptions.getOrDefault(className, 0));
TransformedClassesBuildItem.TransformedClass transformedClass = new TransformedClassesBuildItem.TransformedClass(
className, data,
classFileName, eager.contains(className));
classFileName);
return transformedClass.getData();
} else {
return originalBytes;
Expand Down Expand Up @@ -241,7 +237,7 @@ public TransformedClassesBuildItem.TransformedClass call() throws Exception {
classReaderOptions.getOrDefault(className, 0));
TransformedClassesBuildItem.TransformedClass transformedClass = new TransformedClassesBuildItem.TransformedClass(
className, data,
classFileName, eager.contains(className));
classFileName);
if (cacheable && launchModeBuildItem.getLaunchMode() == LaunchMode.DEVELOPMENT
&& classData != null) {
transformedClassesCache.put(className, transformedClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -60,8 +59,7 @@ public StartupActionImpl(CuratedApplication curatedApplication, BuildResult buil
this.devServicesProperties = extractDevServicesProperties(buildResult);
this.runtimeApplicationShutdownBuildItems = buildResult.consumeMulti(RuntimeApplicationShutdownBuildItem.class);

Set<String> eagerClasses = new HashSet<>();
Map<String, byte[]> transformedClasses = extractTransformers(buildResult, eagerClasses);
Map<String, byte[]> transformedClasses = extractTransformedClasses(buildResult);
QuarkusClassLoader baseClassLoader = curatedApplication.getBaseRuntimeClassLoader();
QuarkusClassLoader runtimeClassLoader;

Expand Down Expand Up @@ -347,16 +345,13 @@ private static Map<String, String> extractDevServicesProperties(BuildResult buil
return new HashMap<>(result.getConfig());
}

private static Map<String, byte[]> extractTransformers(BuildResult buildResult, Set<String> eagerClasses) {
private static Map<String, byte[]> extractTransformedClasses(BuildResult buildResult) {
Map<String, byte[]> ret = new HashMap<>();
TransformedClassesBuildItem transformers = buildResult.consume(TransformedClassesBuildItem.class);
for (Set<TransformedClassesBuildItem.TransformedClass> i : transformers.getTransformedClassesByJar().values()) {
for (TransformedClassesBuildItem.TransformedClass clazz : i) {
if (clazz.getData() != null) {
ret.put(clazz.getFileName(), clazz.getData());
if (clazz.isEager()) {
eagerClasses.add(clazz.getClassName());
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion devtools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<module>platform-properties</module>
<module>bom-descriptor-json</module>
<module>maven</module>
<!--module>gradle</module-->
<module>gradle</module>
<module>cli</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.quarkus.arc.processor.Annotations.getParameterAnnotations;
import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT;
import static io.quarkus.deployment.builditem.ConfigClassBuildItem.Kind.MAPPING;
import static io.quarkus.deployment.builditem.ConfigClassBuildItem.Kind.PROPERTIES;
import static io.quarkus.deployment.configuration.ConfigMappingUtils.CONFIG_MAPPING_NAME;
Expand Down Expand Up @@ -49,8 +50,10 @@
import io.quarkus.arc.processor.Annotations;
import io.quarkus.arc.processor.AnnotationsTransformer;
import io.quarkus.arc.processor.BeanConfigurator;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.arc.processor.InjectionPointInfo;
import io.quarkus.arc.processor.ObserverInfo;
import io.quarkus.arc.runtime.ConfigBeanCreator;
import io.quarkus.arc.runtime.ConfigMappingCreator;
import io.quarkus.arc.runtime.ConfigRecorder;
Expand Down Expand Up @@ -135,8 +138,23 @@ void registerCustomConfigBeanTypes(BeanDiscoveryFinishedBuildItem beanDiscovery,
}

@BuildStep
void validateConfigInjectionPoints(ValidationPhaseBuildItem validationPhase,
BuildProducer<ConfigPropertyBuildItem> configProperties) {
void configPropertyInjectionPoints(
ValidationPhaseBuildItem validationPhase,
BuildProducer<ConfigPropertyBuildItem> configProperties,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {

// @Observes @Initialized(ApplicationScoped.class) requires validation at static init
Set<MethodInfo> observerMethods = new HashSet<>();
for (ObserverInfo observer : validationPhase.getBeanProcessor().getBeanDeployment().getObservers()) {
if (observer.isSynthetic()) {
continue;
}
AnnotationInstance instance = Annotations.getParameterAnnotation(observer.getObserverMethod(),
DotNames.INITIALIZED);
if (instance != null && instance.value().asClass().name().equals(BuiltinScope.APPLICATION.getName())) {
observerMethods.add(observer.getObserverMethod());
}
}

for (InjectionPointInfo injectionPoint : validationPhase.getContext().getInjectionPoints()) {
if (injectionPoint.hasDefaultedQualifier()) {
Expand Down Expand Up @@ -185,47 +203,43 @@ void validateConfigInjectionPoints(ValidationPhaseBuildItem validationPhase,
propertyDefaultValue = defaultValue.asString();
}

configProperties.produce(new ConfigPropertyBuildItem(propertyName, injectedType, propertyDefaultValue));
if (injectionPoint.getTarget().kind().equals(METHOD)
&& observerMethods.contains(injectionPoint.getTarget().asMethod())) {
configProperties
.produce(ConfigPropertyBuildItem.staticInit(propertyName, injectedType, propertyDefaultValue));
}

configProperties.produce(ConfigPropertyBuildItem.runtimeInit(propertyName, injectedType, propertyDefaultValue));
}
}
}

@BuildStep
@Record(RUNTIME_INIT)
void validateConfigValues(ConfigRecorder recorder, List<ConfigPropertyBuildItem> configProperties,
BeanContainerBuildItem beanContainer, BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
// IMPL NOTE: we do depend on BeanContainerBuildItem to make sure that the BeanDeploymentValidator finished its processing

// the non-primitive types need to be registered for reflection since Class.forName is used at runtime to load the class
for (ConfigPropertyBuildItem item : configProperties) {
Type requiredType = item.getPropertyType();
String propertyType = requiredType.name().toString();
if (requiredType.kind() != Kind.PRIMITIVE) {
reflectiveClass.produce(ReflectiveClassBuildItem.builder(propertyType).build());
}
}
@Record(STATIC_INIT)
void validateStaticInitConfigProperty(
ConfigRecorder recorder,
List<ConfigPropertyBuildItem> configProperties,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {

Set<ConfigValidationMetadata> propertiesToValidate = new HashSet<>();
for (ConfigPropertyBuildItem configProperty : configProperties) {
String rawTypeName = configProperty.getPropertyType().name().toString();
List<String> actualTypeArgumentNames = Collections.emptyList();
if (configProperty.getPropertyType().kind() == Kind.PARAMETERIZED_TYPE) {
List<Type> argumentTypes = configProperty.getPropertyType().asParameterizedType().arguments();
actualTypeArgumentNames = new ArrayList<>(argumentTypes.size());
for (Type argumentType : argumentTypes) {
actualTypeArgumentNames.add(argumentType.name().toString());
if (argumentType.kind() != Kind.PRIMITIVE) {
reflectiveClass.produce(ReflectiveClassBuildItem.builder(argumentType.name().toString())
.build());
}
}
recorder.validateConfigProperties(
configProperties.stream()
.filter(ConfigPropertyBuildItem::isStaticInit)
.map(p -> configPropertyToConfigValidation(p, reflectiveClass))
.collect(toSet()));
}

}
propertiesToValidate.add(new ConfigValidationMetadata(configProperty.getPropertyName(),
rawTypeName, actualTypeArgumentNames, configProperty.getDefaultValue()));
}
@BuildStep
@Record(RUNTIME_INIT)
void validateRuntimeConfigProperty(
ConfigRecorder recorder,
List<ConfigPropertyBuildItem> configProperties,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {

recorder.validateConfigProperties(propertiesToValidate);
recorder.validateConfigProperties(
configProperties.stream()
.filter(ConfigPropertyBuildItem::isRuntimeInit)
.map(p -> configPropertyToConfigValidation(p, reflectiveClass))
.collect(toSet()));
}

@BuildStep
Expand Down Expand Up @@ -524,6 +538,30 @@ public static boolean isHandledByProducers(Type type) {
MP_CONFIG_VALUE_NAME.equals(type.name());
}

private static ConfigValidationMetadata configPropertyToConfigValidation(ConfigPropertyBuildItem configProperty,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
String typeName = configProperty.getPropertyType().name().toString();
List<String> typeArgumentNames = Collections.emptyList();

if (configProperty.getPropertyType().kind() != Kind.PRIMITIVE) {
reflectiveClass.produce(ReflectiveClassBuildItem.builder(typeName).build());
}

if (configProperty.getPropertyType().kind() == Kind.PARAMETERIZED_TYPE) {
List<Type> argumentTypes = configProperty.getPropertyType().asParameterizedType().arguments();
typeArgumentNames = new ArrayList<>(argumentTypes.size());
for (Type argumentType : argumentTypes) {
typeArgumentNames.add(argumentType.name().toString());
if (argumentType.kind() != Kind.PRIMITIVE) {
reflectiveClass.produce(ReflectiveClassBuildItem.builder(argumentType.name().toString()).build());
}
}
}

return new ConfigValidationMetadata(configProperty.getPropertyName(), typeName, typeArgumentNames,
configProperty.getDefaultValue());
}

private static Map<Type, ConfigClassBuildItem> configClassesToTypesMap(List<ConfigClassBuildItem> configClasses,
ConfigClassBuildItem.Kind kind) {
Map<Type, ConfigClassBuildItem> configClassesTypes = new HashMap<>();
Expand Down
Loading

0 comments on commit f789168

Please sign in to comment.