[Git][java-team/wildfly-common][upstream] New upstream version 1.7.0

Markus Koschany (@apo) gitlab at salsa.debian.org
Sat Dec 9 14:26:31 GMT 2023



Markus Koschany pushed to branch upstream at Debian Java Maintainers / wildfly-common


Commits:
8a4a9a80 by Markus Koschany at 2023-12-09T15:09:35+01:00
New upstream version 1.7.0
- - - - -


15 changed files:

- + .github/dependabot.yml
- + .github/workflows/maven.yml
- + CODE_OF_CONDUCT.md
- + README.adoc
- + SECURITY.md
- build-include-jdk-misc → build-release-11
- build-test-java10 → build-test-java17
- build-test-java8 → build-test-java21
- − build-test-java9
- pom.xml
- − src/main/java/org/wildfly/common/Substitutions.java
- src/main/java/org/wildfly/common/context/ContextManager.java
- src/main/java/org/wildfly/common/function/Functions.java
- − src/main/java/org/wildfly/common/lock/Substitutions.java
- src/main/java/org/wildfly/common/net/Substitutions.java


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,18 @@
+version: 2
+updates:
+  - package-ecosystem: "maven"
+    directory: "/" # Location of package manifests
+    schedule:
+      interval: "daily"
+    groups:
+      dependencies:
+        patterns:
+          - "*" # batch them all at once
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "daily"
+    groups:
+      dependencies:
+        patterns:
+          - "*" # batch them all at once


=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,32 @@
+name: Build WildFly Common
+
+on:
+  push:
+    branches: [ "main" ]
+  pull_request:
+    branches: [ "main" ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    steps:
+    - name: Check out project
+      uses: actions/checkout at v4
+      with:
+        path: wildfly-common
+
+    - name: Set up JDKs
+      uses: actions/setup-java at v3
+      with:
+        distribution: 'temurin'
+        cache: maven
+        java-version: |
+          11
+          17
+          21
+
+    - name: Build & Test with Maven
+      run: |
+        cd wildfly-common
+        mvn -B -ntp -N install --file pom.xml -Djava11.home="${{env.JAVA_HOME_11_X64}}" -Djava17.home="${{env.JAVA_HOME_17_X64}}"


=====================================
CODE_OF_CONDUCT.md
=====================================
@@ -0,0 +1,133 @@
+
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, caste, color, religion, or sexual
+identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+  and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+  community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or advances of
+  any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email address,
+  without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at 
+jmesnil at redhat.com.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+Community Impact Guidelines were inspired by
+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+
+For answers to common questions about this code of conduct, see the FAQ at
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
+[https://www.contributor-covenant.org/translations][translations].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
+[Mozilla CoC]: https://github.com/mozilla/diversity
+[FAQ]: https://www.contributor-covenant.org/faq
+[translations]: https://www.contributor-covenant.org/translations


=====================================
README.adoc
=====================================
@@ -0,0 +1,16 @@
+= WildFly Common
+
+Common utilities for WildFly projects.
+
+== Instructions
+
+Compile and test the project:
+
+[source,bash]
+----
+mvn verify
+----
+
+== Issue tracker
+
+https://issues.redhat.com/projects/WFCOM/summary


=====================================
SECURITY.md
=====================================
@@ -0,0 +1,11 @@
+# Security Policy
+ 
+## Security Contacts and Procedures
+ 
+The WildFly community takes security very seriously, and we aim to take immediate action to address serious security-related problems that involve our products or services.
+ 
+Please report any suspected security vulnerability in this project to Red Hat Product Security at secalert at redhat.com. You can use our GPG key to communicate with us securely.
+ 
+To report an issue in any Red Hat branded website or online service, please contact Red Hat Information Security at site-security at redhat.com.
+
+https://access.redhat.com/security/team/contact


=====================================
build-include-jdk-misc → build-release-11
=====================================


=====================================
build-test-java10 → build-test-java17
=====================================


=====================================
build-test-java8 → build-test-java21
=====================================


=====================================
build-test-java9 deleted
=====================================


=====================================
pom.xml
=====================================
@@ -25,12 +25,12 @@
 
     <groupId>org.wildfly.common</groupId>
     <artifactId>wildfly-common</artifactId>
-    <version>1.6.0.Final</version>
+    <version>1.7.0.Final</version>
 
     <parent>
         <groupId>org.jboss</groupId>
         <artifactId>jboss-parent</artifactId>
-        <version>39</version>
+        <version>40</version>
     </parent>
 
     <licenses>
@@ -41,26 +41,31 @@
         </license>
     </licenses>
 
+    <scm>
+        <connection>scm:git:git at github.com:wildfly/wildfly-common.git</connection>
+        <developerConnection>scm:git:git at github.com:wildfly/wildfly-common.git</developerConnection>
+        <url>https://github.com/wildfly/wildfly-common/</url>
+    </scm>
+
     <properties>
-        <version.org.jboss.logging.jboss-logging>3.4.0.Final</version.org.jboss.logging.jboss-logging>
-        <version.org.jboss.logging.jboss-logging-tools>2.2.0.Final</version.org.jboss.logging.jboss-logging-tools>
+        <version.org.jboss.logging.jboss-logging>3.5.3.Final</version.org.jboss.logging.jboss-logging>
+        <version.org.jboss.logging.jboss-logging-tools>2.2.1.Final</version.org.jboss.logging.jboss-logging-tools>
 
         <jdk.min.version>11</jdk.min.version>
-        <javadoc.additional.params>--release=8</javadoc.additional.params>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>org.graalvm.sdk</groupId>
             <artifactId>graal-sdk</artifactId>
-            <version>1.0.0-rc9</version>
+            <version>23.1.1</version>
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>com.oracle.substratevm</groupId>
             <artifactId>svm</artifactId>
-            <version>1.0.0-rc9</version>
+            <version>19.2.1</version>
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
@@ -87,13 +92,13 @@
             <!-- This dependency is just for javadoc -->
             <groupId>javax.annotation</groupId>
             <artifactId>javax.annotation-api</artifactId>
-            <version>1.3</version>
+            <version>1.3.2</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.12</version>
+            <version>4.13.2</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -120,18 +125,12 @@
                     <footer><![CDATA[WildFly Common ]]>${project.version}</footer>
                     <bottom><![CDATA[<i>Copyright © 2018 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
                     <doclint>none</doclint>
-                    <additionalDependencies>
-                        <additionalDependency>
-                            <groupId>org.jboss</groupId>
-                            <artifactId>jdk-misc</artifactId>
-                            <version>${version.jdk-misc}</version>
-                        </additionalDependency>
-                    </additionalDependencies>
                 </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
+                <version>5.1.9</version>
                 <configuration>
                     <instructions>
                         <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
@@ -153,26 +152,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <artifactId>maven-enforcer-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>enforce-java8-tests</id>
-                        <phase>deploy</phase>
-                        <goals>
-                            <goal>enforce</goal>
-                        </goals>
-                        <configuration>
-                            <rules>
-                                <requireProperty>
-                                    <property>java8.home</property>
-                                    <message>The "java8.home" property must be set on deploy to run tests under Java 8</message>
-                                </requireProperty>
-                            </rules>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
 </project>


=====================================
src/main/java/org/wildfly/common/Substitutions.java deleted
=====================================
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.wildfly.common;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.AlwaysInline;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-
-/**
- */
-final class Substitutions {
-    @TargetClass(Branch.class)
-    static final class Target_Branch {
-        @AlwaysInline("Straight call to GraalVM")
-        @Substitute
-        public static boolean veryLikely(boolean expr) {
-            return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.FASTPATH_PROBABILITY, expr);
-        }
-
-        @AlwaysInline("Straight call to GraalVM")
-        @Substitute
-        public static boolean veryUnlikely(boolean expr) {
-            return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.SLOWPATH_PROBABILITY, expr);
-        }
-
-        @AlwaysInline("Straight call to GraalVM")
-        @Substitute
-        public static boolean likely(boolean expr) {
-            return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.LIKELY_PROBABILITY, expr);
-        }
-
-        @AlwaysInline("Straight call to GraalVM")
-        @Substitute
-        public static boolean unlikely(boolean expr) {
-            return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.UNLIKELY_PROBABILITY, expr);
-        }
-
-        @AlwaysInline("Straight call to GraalVM")
-        @Substitute
-        public static boolean probability(float prob, boolean expr) {
-            return Target_GraalDirectives.injectBranchProbability(prob, expr);
-        }
-    }
-
-    @TargetClass(className = "org.graalvm.compiler.api.directives.GraalDirectives")
-    static final class Target_GraalDirectives {
-        @Alias
-        public static double LIKELY_PROBABILITY;
-        @Alias
-        public static double UNLIKELY_PROBABILITY;
-
-        @Alias
-        public static double SLOWPATH_PROBABILITY;
-        @Alias
-        public static double FASTPATH_PROBABILITY;
-
-        @Alias
-        public static boolean injectBranchProbability(double probability, boolean condition) {
-            assert probability >= 0.0 && probability <= 1.0;
-            return condition;
-        }
-    }
-}


=====================================
src/main/java/org/wildfly/common/context/ContextManager.java
=====================================
@@ -81,6 +81,19 @@ public final class ContextManager<C extends Contextual<C>> implements Supplier<C
         return globalDefault == null ? null : globalDefault.get();
     }
 
+    /**
+     * Get the global default supplier instance.
+     *
+     * @return the global default supplier, or {@code null} if none is installed or available
+     */
+    public Supplier<C> getGlobalDefaultSupplier() {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ContextPermission(name, ContextPermission.STR_GET_GLOBAL_DEF));
+        }
+        return globalDefaultSupplierRef.get();
+    }
+
     /**
      * Set the global default instance supplier.  The supplier, if one is given, should have a reasonable policy such
      * that callers of {@link #getGlobalDefault()} will obtain results consistent with a general expectation of stability.
@@ -147,6 +160,23 @@ public final class ContextManager<C extends Contextual<C>> implements Supplier<C
         return supplier == null ? null : supplier.get();
     }
 
+    /**
+     * Get the class loader default supplier.\
+     *
+     * @param classLoader the class loader
+     * @return the global default, or {@code null} if none is installed or available
+     */
+    public Supplier<C> getClassLoaderDefaultSupplier(final ClassLoader classLoader) {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ContextPermission(name, ContextPermission.STR_GET_CLASSLOADER_DEF));
+        }
+        if (classLoader == null) {
+            return null;
+        }
+        return perClassLoaderDefault.get(classLoader);
+    }
+
     /**
      * Set the per-class loader default instance supplier.  The supplier, if one is given, should have a reasonable policy such
      * that callers of {@link #getClassLoaderDefault(ClassLoader)} will obtain results consistent with a general expectation of stability.
@@ -202,6 +232,19 @@ public final class ContextManager<C extends Contextual<C>> implements Supplier<C
         return defaultSupplier == null ? null : defaultSupplier.get();
     }
 
+    /**
+     * Get the per-thread default context instance.
+     *
+     * @return the per-thread default supplier, or {@code null} if none is installed or available
+     */
+    public Supplier<C> getThreadDefaultSupplier() {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ContextPermission(name, ContextPermission.STR_GET_THREAD_DEF));
+        }
+        return stateRef.get().defaultSupplier;
+    }
+
     /**
      * Set the per-thread default instance supplier.  The supplier, if one is given, should have a reasonable policy such
      * that callers of {@link #getThreadDefault()} will obtain results consistent with a general expectation of stability.


=====================================
src/main/java/org/wildfly/common/function/Functions.java
=====================================
@@ -20,10 +20,25 @@ package org.wildfly.common.function;
 
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
+import java.util.function.BiPredicate;
 import java.util.function.Consumer;
+import java.util.function.DoubleFunction;
 import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.LongFunction;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.ObjIntConsumer;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Predicate;
 import java.util.function.Supplier;
-
+import java.util.function.ToDoubleBiFunction;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntBiFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongBiFunction;
+import java.util.function.ToLongFunction;
+
+import org.jboss.logging.Logger;
 import org.wildfly.common.Assert;
 
 /**
@@ -32,6 +47,139 @@ import org.wildfly.common.Assert;
 public final class Functions {
     private Functions() {}
 
+    private static final Logger LOGGER = Logger.getLogger(Functions.class);
+
+    private static final Consumer<AutoCloseable> CLOSING_CONSUMER = quiet(AutoCloseable::close, exceptionLoggingConsumer());
+
+    /**
+     * Returns a consumer that quietly closes its argument, logging any exceptions.
+     * @return a closing consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T extends AutoCloseable> Consumer<T> closingConsumer() {
+        return (Consumer<T>) CLOSING_CONSUMER;
+    }
+
+    private static final Consumer<Exception> EXCEPTION_LOGGER = new Consumer<Exception>() {
+        @Override
+        public void accept(Exception e) {
+            LOGGER.warn(e.getLocalizedMessage(), e);
+        }
+    };
+
+    /**
+     * Returns a consumer that logs its exception parameter as a warning.
+     * @param <E> the exception type
+     * @return an exception consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <E extends Exception> Consumer<E> exceptionLoggingConsumer() {
+        return (Consumer<E>) EXCEPTION_LOGGER;
+    }
+
+    /**
+     * Returns a consumer that wraps and throws its exception parameter as a {@link RuntimeException}.
+     * @param <E> the exception type
+     * @return an exception consumer
+     */
+    public static <E extends Exception, RE extends RuntimeException> Consumer<E> runtimeExceptionThrowingConsumer(Function<E, RE> runtimeExceptionWrapper) {
+        return new Consumer<E>() {
+            @Override
+            public void accept(E exception) {
+                throw runtimeExceptionWrapper.apply(exception);
+            }
+        };
+    }
+
+    /**
+     * Converts an {@link ExceptionConsumer} to a standard {@link Consumer} using the specified exception handler.
+     * @param <T> the parameter type of the consumer
+     * @param <E> the exception type
+     * @param consumer an exception consumer
+     * @param exceptionHandler an exception handler
+     * @return a standard consumer
+     */
+    public static <T, E extends Exception> Consumer<T> quiet(ExceptionConsumer<T, E> consumer, Consumer<E> exceptionHandler) {
+        return new Consumer<T>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public void accept(T value) {
+                try {
+                    consumer.accept(value);
+                } catch (Exception e) {
+                    exceptionHandler.accept((E) e);
+                }
+            }
+        };
+    }
+
+    /**
+     * Converts an {@link ExceptionBiConsumer} to a standard {@link BiConsumer} using the specified exception handler.
+     * @param <T> the first parameter type of the consumer
+     * @param <U> the second parameter type of the consumer
+     * @param <E> the exception type
+     * @param consumer a binary exception consumer
+     * @param exceptionHandler an exception handler
+     * @return a standard binary consumer
+     */
+    public static <T, U, E extends Exception> BiConsumer<T, U> quiet(ExceptionBiConsumer<T, U, E> consumer, Consumer<E> exceptionHandler) {
+        return new BiConsumer<T, U>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public void accept(T value1, U value2) {
+                try {
+                    consumer.accept(value1, value2);
+                } catch (Exception e) {
+                    exceptionHandler.accept((E) e);
+                }
+            }
+        };
+    }
+
+    /**
+     * Converts an {@link ExceptionObjIntConsumer} to a standard {@link ObjIntConsumer} using the specified exception handler.
+     * @param <T> the first parameter type of the consumer
+     * @param <E> the exception type
+     * @param consumer an object/int exception consumer
+     * @param exceptionHandler an exception handler
+     * @return a standard object/int consumer
+     */
+    public static <T, E extends Exception> ObjIntConsumer<T> quiet(ExceptionObjIntConsumer<T, E> consumer, Consumer<E> exceptionHandler) {
+        return new ObjIntConsumer<T>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public void accept(T object, int i) {
+                try {
+                    consumer.accept(object, i);
+                } catch (Exception e) {
+                    exceptionHandler.accept((E) e);
+                }
+            }
+        };
+    }
+
+    /**
+     * Converts an {@link ExceptionObjLongConsumer} to a standard {@link ObjLongConsumer} using the specified exception handler.
+     * @param <T> the first parameter type of the consumer
+     * @param <E> the exception type
+     * @param consumer an object/long exception consumer
+     * @param exceptionHandler an exception handler
+     * @return a standard object/long consumer
+     */
+    public static <T, E extends Exception> ObjLongConsumer<T> quiet(ExceptionObjLongConsumer<T, E> consumer, Consumer<E> exceptionHandler) {
+        return new ObjLongConsumer<T>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public void accept(T object, long i) {
+                try {
+                    consumer.accept(object, i);
+                } catch (Exception e) {
+                    exceptionHandler.accept((E) e);
+                }
+            }
+        };
+    }
+
     /**
      * Get the singleton consumer which accepts and runs runnable instances.
      *
@@ -325,6 +473,474 @@ public final class Functions {
         return DiscardingBiConsumer.INSTANCE;
     }
 
+    /**
+     * Returns a {@link Consumer} with identical behavior to the specified {@link Consumer} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> Consumer<TT> cast(Consumer<T> consumer) {
+        return (Consumer<TT>) consumer;
+    }
+
+    /**
+     * Returns a {@link Predicate} with identical behavior to the specified {@link Predicate} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param predicate a predicate
+     * @return a functionally equivalent predicate
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> Predicate<TT> cast(Predicate<T> predicate) {
+        return (Predicate<TT>) predicate;
+    }
+
+    /**
+     * Returns a {@link Supplier} with identical behavior to the specified {@link Supplier} but with relaxed return type.
+     * @param <T> the return type
+     * @param <TT> the relaxed return type
+     * @param supplier a supplier
+     * @return a functionally equivalent supplier
+     */
+    @SuppressWarnings("unchecked")
+    public static <T extends TT, TT> Supplier<TT> cast(Supplier<T> supplier) {
+        return (Supplier<TT>) supplier;
+    }
+
+    /**
+     * Returns a {@link Function} with identical behavior to the specified {@link Function} but with restricted parameter type and relaxed return type.
+     * @param <T> the parameter type
+     * @param <R> the return type
+     * @param <TT> the restricted parameter type
+     * @param <RR> the relaxed return type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, R extends RR, TT extends T, RR> Function<TT, RR> cast(Function<T, R> function) {
+        return (Function<TT, RR>) function;
+    }
+
+    /**
+     * Returns a {@link DoubleFunction} with identical behavior to the specified {@link DoubleFunction} but with relaxed return type.
+     * @param <R> the return type
+     * @param <RR> the relaxed return type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends RR, RR> DoubleFunction<RR> cast(DoubleFunction<R> function) {
+        return (DoubleFunction<RR>) function;
+    }
+
+    /**
+     * Returns a {@link IntFunction} with identical behavior to the specified {@link IntFunction} but with relaxed return type.
+     * @param <R> the return type
+     * @param <RR> the relaxed return type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends RR, RR> IntFunction<RR> cast(IntFunction<R> function) {
+        return (IntFunction<RR>) function;
+    }
+
+    /**
+     * Returns a {@link LongFunction} with identical behavior to the specified {@link LongFunction} but with relaxed return type.
+     * @param <R> the return type
+     * @param <RR> the relaxed return type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends RR, RR> LongFunction<RR> cast(LongFunction<R> function) {
+        return (LongFunction<RR>) function;
+    }
+
+    /**
+     * Returns a {@link ToDoubleFunction} with identical behavior to the specified {@link ToDoubleFunction} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ToDoubleFunction<TT> cast(ToDoubleFunction<T> function) {
+        return (ToDoubleFunction<TT>) function;
+    }
+
+    /**
+     * Returns a {@link ToIntFunction} with identical behavior to the specified {@link ToIntFunction} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ToIntFunction<TT> cast(ToIntFunction<T> function) {
+        return (ToIntFunction<TT>) function;
+    }
+
+    /**
+     * Returns a {@link ToLongFunction} with identical behavior to the specified {@link ToLongFunction} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ToLongFunction<TT> cast(ToLongFunction<T> function) {
+        return (ToLongFunction<TT>) function;
+    }
+
+    /**
+     * Returns a {@link BiConsumer} with identical behavior to the specified {@link BiConsumer} but with restricted parameter types.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, TT extends T, UU extends U> BiConsumer<TT, UU> cast(BiConsumer<T, U> consumer) {
+        return (BiConsumer<TT, UU>) consumer;
+    }
+
+    /**
+     * Returns a {@link ObjDoubleConsumer} with identical behavior to the specified {@link ObjDoubleConsumer} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ObjDoubleConsumer<TT> cast(ObjDoubleConsumer<T> consumer) {
+        return (ObjDoubleConsumer<TT>) consumer;
+    }
+
+    /**
+     * Returns a {@link ObjIntConsumer} with identical behavior to the specified {@link ObjIntConsumer} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ObjIntConsumer<TT> cast(ObjIntConsumer<T> consumer) {
+        return (ObjIntConsumer<TT>) consumer;
+    }
+
+    /**
+     * Returns a {@link ObjLongConsumer} with identical behavior to the specified {@link ObjLongConsumer} but with restricted parameter type.
+     * @param <T> the parameter type
+     * @param <TT> the restricted parameter type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, TT extends T> ObjLongConsumer<TT> cast(ObjLongConsumer<T> consumer) {
+        return (ObjLongConsumer<TT>) consumer;
+    }
+
+    /**
+     * Returns a {@link BiPredicate} with identical behavior to the specified {@link BiPredicate} but with restricted parameter types.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param predicate a predicate
+     * @return a functionally equivalent predicate
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, TT extends T, UU extends U> BiPredicate<TT, UU> cast(BiPredicate<T, U> predicate) {
+        return (BiPredicate<TT, UU>) predicate;
+    }
+
+    /**
+     * Returns a {@link BiFunction} with identical behavior to the specified {@link BiFunction} but with restricted parameter types and relaxed return type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <R> the return type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <RR> the relaxed return type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, R extends RR, TT extends T, UU extends U, RR> BiFunction<TT, UU, RR> cast(BiFunction<T, U, R> function) {
+        return (BiFunction<TT, UU, RR>) function;
+    }
+
+    /**
+     * Returns a {@link ToDoubleBiFunction} with identical behavior to the specified {@link ToDoubleBiFunction} but with restricted parameter types.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, TT extends T, UU extends U> ToDoubleBiFunction<TT, UU> cast(ToDoubleBiFunction<T, U> function) {
+        return (ToDoubleBiFunction<TT, UU>) function;
+    }
+
+    /**
+     * Returns a {@link ToIntBiFunction} with identical behavior to the specified {@link ToIntBiFunction} but with restricted parameter types.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, TT extends T, UU extends U> ToIntBiFunction<TT, UU> cast(ToIntBiFunction<T, U> function) {
+        return (ToIntBiFunction<TT, UU>) function;
+    }
+
+    /**
+     * Returns a {@link ToLongBiFunction} with identical behavior to the specified {@link ToLongBiFunction} but with restricted parameter types.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, TT extends T, UU extends U> ToLongBiFunction<TT, UU> cast(ToLongBiFunction<T, U> function) {
+        return (ToLongBiFunction<TT, UU>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionConsumer} with identical behavior to the specified {@link ExceptionConsumer} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionConsumer<TT, EE> cast(ExceptionConsumer<T, E> consumer) {
+        return (ExceptionConsumer<TT, EE>) consumer;
+    }
+
+    /**
+     * Returns a {@link ExceptionPredicate} with identical behavior to the specified {@link ExceptionPredicate} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param predicate a predicate
+     * @return a functionally equivalent predicate
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionPredicate<TT, EE> cast(ExceptionPredicate<T, E> consumer) {
+        return (ExceptionPredicate<TT, EE>) consumer;
+    }
+
+    /**
+     * Returns a {@link ExceptionSupplier} with identical behavior to the specified {@link ExceptionSupplier} but with relaxed return type and relaxed exception type.
+     * @param <T> the return type
+     * @param <E> the exception type
+     * @param <TT> the relaxed return type
+     * @param <EE> the relaxed exception type
+     * @param supplier a supplier
+     * @return a functionally equivalent supplier
+     */
+    @SuppressWarnings("unchecked")
+    public static <T extends TT, E extends EE, TT, EE extends Exception> ExceptionSupplier<TT, EE> cast(ExceptionSupplier<T, E> supplier) {
+        return (ExceptionSupplier<TT, EE>) supplier;
+    }
+
+    /**
+     * Returns a {@link ExceptionFunction} with identical behavior to the specified {@link ExceptionFunction} but with restricted parameter type, relaxed return type, and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <R> the return type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <RR> the relaxed return type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, R extends RR, E extends EE, TT extends T, RR, EE extends Exception> ExceptionFunction<TT, RR, EE> cast(ExceptionFunction<T, R, E> function) {
+        return (ExceptionFunction<TT, RR, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionIntFunction} with identical behavior to the specified {@link ExceptionFunction} but with relaxed return type and relaxed exception type.
+     * @param <R> the return type
+     * @param <E> the exception type
+     * @param <RR> the relaxed return type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends RR, E extends EE, RR, EE extends Exception> ExceptionIntFunction<RR, EE> cast(ExceptionIntFunction<R, E> function) {
+        return (ExceptionIntFunction<RR, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionLongFunction} with identical behavior to the specified {@link ExceptionLongFunction} but with relaxed return type and relaxed exception type.
+     * @param <R> the return type
+     * @param <E> the exception type
+     * @param <RR> the relaxed return type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <R extends RR, E extends EE, RR, EE extends Exception> ExceptionLongFunction<RR, EE> cast(ExceptionLongFunction<R, E> function) {
+        return (ExceptionLongFunction<RR, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionToIntFunction} with identical behavior to the specified {@link ExceptionToIntFunction} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionToIntFunction<TT, EE> cast(ExceptionToIntFunction<T, E> function) {
+        return (ExceptionToIntFunction<TT, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionToLongFunction} with identical behavior to the specified {@link ExceptionToLongFunction} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionToLongFunction<TT, EE> cast(ExceptionToLongFunction<T, E> function) {
+        return (ExceptionToLongFunction<TT, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionBiConsumer} with identical behavior to the specified {@link ExceptionBiConsumer} but with restricted parameter types and relaxed exception type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <EE> the relaxed exception type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, U, UU extends U, EE extends Exception> ExceptionBiConsumer<TT, UU, EE> cast(ExceptionBiConsumer<T, U, E> consumer) {
+        return (ExceptionBiConsumer<TT, UU, EE>) consumer;
+    }
+
+    /**
+     * Returns a {@link ExceptionObjIntConsumer} with identical behavior to the specified {@link ExceptionObjIntConsumer} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionObjIntConsumer<TT, EE> cast(ExceptionObjIntConsumer<T, E> consumer) {
+        return (ExceptionObjIntConsumer<TT, EE>) consumer;
+    }
+
+    /**
+     * Returns a {@link ExceptionObjLongConsumer} with identical behavior to the specified {@link ExceptionObjLongConsumer} but with restricted parameter type and relaxed exception type.
+     * @param <T> the parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted parameter type
+     * @param <EE> the relaxed exception type
+     * @param consumer a consumer
+     * @return a functionally equivalent consumer
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, E extends EE, TT extends T, EE extends Exception> ExceptionObjLongConsumer<TT, EE> cast(ExceptionObjLongConsumer<T, E> consumer) {
+        return (ExceptionObjLongConsumer<TT, EE>) consumer;
+    }
+
+    /**
+     * Returns a {@link ExceptionBiPredicate} with identical behavior to the specified {@link ExceptionBiPredicate} but with restricted parameter types and relaxed exception type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <EE> the relaxed exception type
+     * @param predicate a predicate
+     * @return a functionally equivalent predicate
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, E extends EE, TT extends T, UU extends U, EE extends Exception> ExceptionBiPredicate<TT, UU, EE> cast(ExceptionBiPredicate<T, U, E> predicate) {
+        return (ExceptionBiPredicate<TT, UU, EE>) predicate;
+    }
+
+    /**
+     * Returns a {@link ExceptionBiFunction} with identical behavior to the specified {@link ExceptionBiFunction} but with restricted parameter types, relaxed return type, and relaxed exception type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <R> the return type
+     * @param <E> the exception type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <RR> the relaxed return type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, R extends RR, E extends EE, TT extends T, UU extends U, RR, EE extends Exception> ExceptionBiFunction<TT, UU, RR, EE> cast(ExceptionBiFunction<T, U, R, E> function) {
+        return (ExceptionBiFunction<TT, UU, RR, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionToIntBiFunction} with identical behavior to the specified {@link ExceptionToIntBiFunction} but with restricted parameter types and relaxed exception type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, E extends EE, TT extends T, UU extends U, EE extends Exception> ExceptionToIntBiFunction<TT, UU, EE> cast(ExceptionToIntBiFunction<T, U, E> function) {
+        return (ExceptionToIntBiFunction<TT, UU, EE>) function;
+    }
+
+    /**
+     * Returns a {@link ExceptionToLongBiFunction} with identical behavior to the specified {@link ExceptionToLongBiFunction} but with restricted parameter types and relaxed exception type.
+     * @param <T> the first parameter type
+     * @param <U> the second parameter type
+     * @param <E> the exception type
+     * @param <TT> the restricted first parameter type
+     * @param <UU> the restricted second parameter type
+     * @param <EE> the relaxed exception type
+     * @param function a function
+     * @return a functionally equivalent function
+     */
+    @SuppressWarnings("unchecked")
+    public static <T, U, E extends EE, TT extends T, UU extends U, EE extends Exception> ExceptionToLongBiFunction<TT, UU, EE> cast(ExceptionToLongBiFunction<T, U, E> function) {
+        return (ExceptionToLongBiFunction<TT, UU, EE>) function;
+    }
+
     static class RunnableConsumer implements Consumer<Runnable> {
         static final Consumer<Runnable> INSTANCE = new RunnableConsumer();
 


=====================================
src/main/java/org/wildfly/common/lock/Substitutions.java deleted
=====================================
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.wildfly.common.lock;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-
-final class Substitutions {
-    @TargetClass(JDKSpecific.class)
-    static final class Target_JDKSpecific {
-        @Substitute
-        static void onSpinWait() {
-            Target_PauseNode.pause();
-        }
-    }
-
-    @TargetClass(className = "org.graalvm.compiler.nodes.PauseNode")
-    static final class Target_PauseNode {
-        @Alias
-        public static native void pause();
-    }
-}


=====================================
src/main/java/org/wildfly/common/net/Substitutions.java
=====================================
@@ -113,6 +113,9 @@ final class Substitutions {
 
     static final class NativeInfoDirectives implements CContext.Directives {
         public List<String> getHeaderFiles() {
+            if (Platform.includedIn(Platform.WINDOWS.class)) {
+                return Collections.singletonList("<winsock.h>");
+            }
             return Collections.singletonList("<unistd.h>");
         }
     }



View it on GitLab: https://salsa.debian.org/java-team/wildfly-common/-/commit/8a4a9a8083ac2006f24d7573985a0bd1d73bf50a

-- 
View it on GitLab: https://salsa.debian.org/java-team/wildfly-common/-/commit/8a4a9a8083ac2006f24d7573985a0bd1d73bf50a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20231209/64bda54e/attachment.htm>


More information about the pkg-java-commits mailing list