Skip to content

Commit

Permalink
4.x: Upgrade Weld to 5.x #5815 (#5830)
Browse files Browse the repository at this point in the history
4.x: Upgrade Weld to 5.x #5815

Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos authored Feb 6, 2023
1 parent 7bf92a1 commit 34069f8
Show file tree
Hide file tree
Showing 45 changed files with 153 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,14 @@ private Optional<ConfigValue> findConfigValue(String propertyName) {
LOGGER.log(Level.TRACE, "Found property " + propertyName + " in source " + source.getName());
}
String rawValue = value;
return applyFilters(propertyName, value)
.map(it -> resolveReferences(propertyName, it))
.map(it -> new ConfigValueImpl(propertyName, it, rawValue, source.getName(), source.getOrdinal()));
try {
return applyFilters(propertyName, value)
.map(it -> resolveReferences(propertyName, it))
.map(it -> new ConfigValueImpl(propertyName, it, rawValue, source.getName(), source.getOrdinal()));
} catch (NoSuchElementException e) {
// Property expression does not resolve
return Optional.empty();
}
}

return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand All @@ -17,6 +17,7 @@
package io.helidon.config.mp;

import java.util.NoSuchElementException;
import java.util.Optional;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
Expand Down Expand Up @@ -66,6 +67,12 @@ void testMissingRefs() {
assertThrows(NoSuchElementException.class, () -> config.getValue( "referencing4-2", String.class));
}

@Test
void testOptionalMissingRefs() {
assertThat(config.getOptionalValue("referencing4-1", String.class), is(Optional.empty()));
assertThat(config.getOptionalValue("referencing4-2", String.class), is(Optional.empty()));
}

private void test(String prefix, String value) {
test(prefix, "1", value);
test(prefix, "2", value + "-ref");
Expand Down
29 changes: 21 additions & 8 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
<!-- This is the BOM version for Jackson Databind 2.13.4.2 -->
<version.lib.jackson>2.13.4.20221013</version.lib.jackson>
<version.lib.jakarta.activation-api>2.0.1</version.lib.jakarta.activation-api>
<version.lib.jakarta.annotation-api>2.0.0</version.lib.jakarta.annotation-api>
<version.lib.jakarta.cdi-api>3.0.0</version.lib.jakarta.cdi-api>
<version.lib.jakarta.annotation-api>2.1.0</version.lib.jakarta.annotation-api>
<version.lib.jakarta.cdi-api>4.0.1</version.lib.jakarta.cdi-api>
<version.lib.jakarta.el-api>4.0.0</version.lib.jakarta.el-api>
<version.lib.jakarta.inject>2.0.0</version.lib.jakarta.inject>
<version.lib.jakarta.interceptor-api>2.0.0</version.lib.jakarta.interceptor-api>
<version.lib.jakarta.jaxrs-api>3.0.0</version.lib.jakarta.jaxrs-api>
<version.lib.jakarta.inject>2.0.1</version.lib.jakarta.inject>
<version.lib.jakarta.interceptor-api>2.1.0</version.lib.jakarta.interceptor-api>
<version.lib.jakarta.jaxrs-api>3.1.0</version.lib.jakarta.jaxrs-api>
<version.lib.jakarta.jms-api>3.0.0</version.lib.jakarta.jms-api>
<version.lib.jakarta.jsonb-api>2.0.0</version.lib.jakarta.jsonb-api>
<version.lib.jakarta.jsonp-api>2.0.1</version.lib.jakarta.jsonp-api>
Expand All @@ -91,7 +91,7 @@
<!-- Force upgrade version used by maven-jaxb2-plugin. Needed to support Java 16 -->
<version.lib.jaxb-runtime>3.0.2</version.lib.jaxb-runtime>
<version.lib.jedis>3.6.3</version.lib.jedis>
<version.lib.jersey>3.0.9</version.lib.jersey>
<version.lib.jersey>3.1.0</version.lib.jersey>
<version.lib.jgit>5.11.1.202105131744-r</version.lib.jgit>
<version.lib.junit>5.7.0</version.lib.junit>
<version.lib.kafka>2.8.1</version.lib.kafka>
Expand All @@ -103,7 +103,9 @@
<version.lib.micronaut>3.4.3</version.lib.micronaut>
<version.lib.micronaut.data>3.3.0</version.lib.micronaut.data>
<version.lib.micronaut.sql>4.4.0</version.lib.micronaut.sql>
<!-- FIXME upgrade to 3.1 when it is released in Maven -->
<version.lib.microprofile-config>3.0.1</version.lib.microprofile-config>
<!-- FIXME upgrade to 4.1 when it is released in Maven -->
<version.lib.microprofile-fault-tolerance-api>4.0</version.lib.microprofile-fault-tolerance-api>
<version.lib.microprofile-graphql>2.0</version.lib.microprofile-graphql>
<version.lib.microprofile-health>4.0</version.lib.microprofile-health>
Expand Down Expand Up @@ -144,8 +146,8 @@
<version.lib.snakeyaml>1.32</version.lib.snakeyaml>
<version.lib.typesafe-config>1.4.2</version.lib.typesafe-config>
<version.lib.tyrus>2.0.4</version.lib.tyrus>
<version.lib.weld-api>4.0.SP1</version.lib.weld-api>
<version.lib.weld>4.0.2.Final</version.lib.weld>
<version.lib.weld-api>5.0.SP3</version.lib.weld-api>
<version.lib.weld>5.1.0.Final</version.lib.weld>
<version.lib.yasson>2.0.4</version.lib.yasson>
<version.lib.zipkin.sender-urlconnection>2.12.0</version.lib.zipkin.sender-urlconnection>
<version.lib.zipkin>2.12.5</version.lib.zipkin>
Expand Down Expand Up @@ -899,6 +901,17 @@
<artifactId>weld-spi</artifactId>
<version>${version.lib.weld-api}</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-lite-extension-translator</artifactId>
<version>${version.lib.weld}</version>
<exclusions>
<exclusion>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.weld.module</groupId>
<artifactId>weld-jta</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions integrations/cdi/jedis-cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
<!-- Provided-scoped dependencies. -->
<dependency>
<groupId>jakarta.enterprise</groupId>
Expand Down
3 changes: 2 additions & 1 deletion integrations/cdi/jedis-cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand All @@ -21,6 +21,7 @@
*/
@SuppressWarnings({ "requires-automatic", "requires-transitive-automatic" })
module io.helidon.integrations.jedis.cdi {
requires transitive jakarta.annotation;
requires transitive java.desktop; // For java.beans
requires transitive jakarta.cdi;
requires jakarta.inject;
Expand Down
3 changes: 1 addition & 2 deletions integrations/cdi/jpa-cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -43,7 +43,6 @@
requires jakarta.xml.bind;

requires jakarta.inject; // automatic module
requires jakarta.interceptor.api; // automatic module

requires io.helidon.integrations.cdi.delegates;
requires io.helidon.integrations.cdi.referencecountedcontext;
Expand Down
3 changes: 1 addition & 2 deletions integrations/cdi/jta-cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -39,7 +39,6 @@
requires jakarta.annotation;
requires java.sql;
requires java.rmi;
requires jakarta.interceptor.api;
requires jakarta.inject;
requires jakarta.cdi;
requires narayana.jta.jakarta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 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.
Expand Down Expand Up @@ -53,11 +53,6 @@ public Set<InjectionPoint> getInjectionPoints() {
return Collections.emptySet();
}

@Override
public boolean isNullable() {
return false;
}

@Override
public Object create(CreationalContext<Object> creationalContext) {
throw new IllegalStateException("This bean should not be created");
Expand Down
1 change: 0 additions & 1 deletion integrations/micrometer/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
requires static jakarta.activation;
requires static jakarta.cdi;
requires static jakarta.inject;
requires static jakarta.interceptor.api;

requires io.helidon.common.http;
requires io.helidon.reactive.servicecommon;
Expand Down
3 changes: 1 addition & 2 deletions integrations/micronaut/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -27,7 +27,6 @@

requires jakarta.cdi;
requires jakarta.inject;
requires jakarta.interceptor.api;

requires microprofile.config.api;

Expand Down
3 changes: 1 addition & 2 deletions integrations/micronaut/data/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -34,7 +34,6 @@
requires java.sql;

requires jakarta.cdi;
requires jakarta.interceptor.api;

requires io.micronaut.inject;

Expand Down
3 changes: 1 addition & 2 deletions integrations/microstream/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 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.
Expand Down Expand Up @@ -41,7 +41,6 @@
requires io.helidon.integrations.microstream.cache;
requires transitive jakarta.cdi;
requires transitive jakarta.inject;
requires jakarta.interceptor.api;
requires jakarta.annotation;
requires microstream.base;
requires microstream.cache;
Expand Down
3 changes: 1 addition & 2 deletions integrations/neo4j/metrics/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 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.
Expand Down Expand Up @@ -40,7 +40,6 @@

requires static jakarta.cdi;
requires static jakarta.inject;
requires static jakarta.interceptor.api;
requires static jakarta.annotation;

exports io.helidon.integrations.neo4j.metrics;
Expand Down
3 changes: 1 addition & 2 deletions integrations/neo4j/neo4j/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 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.
Expand Down Expand Up @@ -34,7 +34,6 @@

requires static jakarta.cdi;
requires static jakarta.inject;
requires static jakarta.interceptor.api;
requires static io.helidon.config;
requires static io.helidon.config.mp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

requires oci.java.sdk.monitoring;

requires jakarta.interceptor.api;
provides jakarta.enterprise.inject.spi.Extension with io.helidon.integrations.oci.metrics.cdi.OciMetricsCdiExtension;

opens io.helidon.integrations.oci.metrics.cdi to weld.core.impl, io.helidon.microprofile.cdi;
Expand Down
5 changes: 5 additions & 0 deletions integrations/oci/sdk/cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions integrations/oci/sdk/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
requires java.logging;
requires transitive jakarta.cdi;
requires jakarta.inject;
requires jakarta.interceptor.api;
requires jakarta.ws.rs;
requires microprofile.config.api;
requires oci.java.sdk.common;
requires oci.java.sdk.common.httpclient;

exports io.helidon.integrations.oci.sdk.cdi;

provides jakarta.enterprise.inject.spi.Extension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 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.
Expand Down Expand Up @@ -65,11 +65,6 @@ public Set<InjectionPoint> getInjectionPoints() {
return Set.of();
}

@Override
public boolean isNullable() {
return false;
}

@Override
public T create(CreationalContext<T> creationalContext) {
return creator.get();
Expand Down
3 changes: 1 addition & 2 deletions microprofile/access-log/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
* Copyright (c) 2019, 2023 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.
Expand Down Expand Up @@ -32,7 +32,6 @@

requires io.helidon.microprofile.server;
requires io.helidon.nima.webserver.accesslog;
requires jakarta.interceptor.api;

exports io.helidon.microprofile.accesslog;

Expand Down
4 changes: 4 additions & 0 deletions microprofile/cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<groupId>org.jboss.classfilewriter</groupId>
<artifactId>jboss-classfilewriter</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-lite-extension-translator</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -47,26 +47,11 @@ class HelidonProxyServices implements ProxyServices {
this.myModule = HelidonProxyServices.class.getModule();
}

@Override
public ClassLoader getClassLoader(Class<?> proxiedBeanType) {
return wrapCl(proxiedBeanType.getClassLoader());
}

@Override
public Class<?> loadBeanClass(String className) {
return contextClassDefiningCl.doLoad(className);
}

@Override
public void cleanup() {
classLoaders.clear();
}

@Override
public boolean supportsClassDefining() {
return true;
}

@Override
public Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len)
throws ClassFormatError {
Expand Down
3 changes: 1 addition & 2 deletions microprofile/cors/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 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.
Expand Down Expand Up @@ -42,7 +42,6 @@
requires jersey.common;
requires microprofile.config.api;

requires jakarta.interceptor.api;
requires jakarta.cdi;

exports io.helidon.microprofile.cors;
Expand Down
Loading

0 comments on commit 34069f8

Please sign in to comment.