Merge branch '4.0.0-M3' - part 1
diff --git a/Jenkinsfile b/Jenkinsfile index f03d528..c733888 100644 --- a/Jenkinsfile +++ b/Jenkinsfile
@@ -19,13 +19,13 @@ agent any options { // keep at most 50 builds - buildDiscarder(logRotator(numToKeepStr: '50')) + buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '2')) // abort pipeline if previous stage is unstable skipStagesAfterUnstable() // show timestamps in logs timestamps() // global timeout - timeout(time: 20, unit: 'MINUTES') + timeout(time: 120, unit: 'MINUTES') } stages { stage('build') {
diff --git a/LICENSE.md b/LICENSE.md old mode 100755 new mode 100644
diff --git a/README.md b/README.md old mode 100755 new mode 100644
diff --git a/bom/pom.xml b/bom/pom.xml index 7506ba2..9a106a9 100644 --- a/bom/pom.xml +++ b/bom/pom.xml
@@ -31,7 +31,7 @@ <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-bom</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <packaging>pom</packaging> <name>HK2 Bom Pom</name> @@ -42,7 +42,7 @@ </scm> <properties> - <asm.version>9.7</asm.version> + <asm.version>9.9.1</asm.version> <jakarta-inject.version>2.0.1</jakarta-inject.version> <jakarta-annotation.version>2.1.1</jakarta-annotation.version> <project.build.outputTimestamp>2023-04-09T08:38:05Z</project.build.outputTimestamp> @@ -124,7 +124,7 @@ <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-resource-locator</artifactId> <!-- Unfortunately we use the same coordinates as old Oracle, but versioning started from 1.0.0 --> - <version>1.0.3</version> + <version>1.0.4</version> </dependency> <dependency> <groupId>org.glassfish.hk2</groupId>
diff --git a/class-model/pom.xml b/class-model/pom.xml index b1e6601..abb0fa8 100644 --- a/class-model/pom.xml +++ b/class-model/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/examples/caching/pom.xml b/examples/caching/pom.xml index 15a108b..0f97c8b 100644 --- a/examples/caching/pom.xml +++ b/examples/caching/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>caching-aop-example</artifactId>
diff --git a/examples/caching/runner/pom.xml b/examples/caching/runner/pom.xml index 2be0719..81e4489 100644 --- a/examples/caching/runner/pom.xml +++ b/examples/caching/runner/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>caching-aop-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>caching-aop-example-runner</artifactId>
diff --git a/examples/caching/system/pom.xml b/examples/caching/system/pom.xml index 697d037..e4902c4 100644 --- a/examples/caching/system/pom.xml +++ b/examples/caching/system/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>caching-aop-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>caching-aop-example-system</artifactId>
diff --git a/examples/configuration/pom.xml b/examples/configuration/pom.xml index bc766a0..dec6419 100644 --- a/examples/configuration/pom.xml +++ b/examples/configuration/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>configuration-examples</artifactId>
diff --git a/examples/configuration/webserver/pom.xml b/examples/configuration/webserver/pom.xml index 97682db..1d012a6 100644 --- a/examples/configuration/webserver/pom.xml +++ b/examples/configuration/webserver/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>configuration-examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>webserver-configuration-example</artifactId>
diff --git a/examples/configuration/xml/pom.xml b/examples/configuration/xml/pom.xml index e3ba210..9010d0a 100644 --- a/examples/configuration/xml/pom.xml +++ b/examples/configuration/xml/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>configuration-examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>xml-configuration-example</artifactId>
diff --git a/examples/custom-resolver/pom.xml b/examples/custom-resolver/pom.xml index cc703c0..c08468c 100644 --- a/examples/custom-resolver/pom.xml +++ b/examples/custom-resolver/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>custom-resolver-example</artifactId>
diff --git a/examples/events/pom.xml b/examples/events/pom.xml index faf0784..fab1201 100644 --- a/examples/events/pom.xml +++ b/examples/events/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>event-examples</artifactId>
diff --git a/examples/events/threaded/pom.xml b/examples/events/threaded/pom.xml index a14e62b..c4dd5b5 100644 --- a/examples/events/threaded/pom.xml +++ b/examples/events/threaded/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>event-examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>threading-event-example</artifactId>
diff --git a/examples/operations/pom.xml b/examples/operations/pom.xml index 760339a..0d6a7be 100644 --- a/examples/operations/pom.xml +++ b/examples/operations/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>operations-example</artifactId>
diff --git a/examples/pom.xml b/examples/pom.xml index 8584384..dadf83b 100644 --- a/examples/pom.xml +++ b/examples/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>examples</artifactId>
diff --git a/examples/security-lockdown/alice/pom.xml b/examples/security-lockdown/alice/pom.xml index 6b27d82..eb8febc 100644 --- a/examples/security-lockdown/alice/pom.xml +++ b/examples/security-lockdown/alice/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>security-lockdown-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>security-lockdown-example-alice</artifactId>
diff --git a/examples/security-lockdown/mallory/pom.xml b/examples/security-lockdown/mallory/pom.xml index 6a90413..4cf5126 100644 --- a/examples/security-lockdown/mallory/pom.xml +++ b/examples/security-lockdown/mallory/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>security-lockdown-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>security-lockdown-example-mallory</artifactId>
diff --git a/examples/security-lockdown/pom.xml b/examples/security-lockdown/pom.xml index 9447b19..85a6e1f 100644 --- a/examples/security-lockdown/pom.xml +++ b/examples/security-lockdown/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>examples</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>security-lockdown-example</artifactId>
diff --git a/examples/security-lockdown/runner/pom.xml b/examples/security-lockdown/runner/pom.xml index 72882d5..301fc68 100644 --- a/examples/security-lockdown/runner/pom.xml +++ b/examples/security-lockdown/runner/pom.xml
@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- + Copyright (c) 2025 Contributors to Eclipse Foundation. Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the @@ -23,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>security-lockdown-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>security-lockdown-example-runner</artifactId> @@ -87,7 +88,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/policy.txt @{surefireArgLineExtra}</argLine> + <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} ${activate.securitymanager} -Djava.security.policy=${project.build.directory}/test-classes/policy.txt @{surefireArgLineExtra}</argLine> <!-- -Djava.security.debug=access,failure,domain --> </configuration> </plugin>
diff --git a/examples/security-lockdown/runner/src/test/java/org/glassfish/securitylockdown/test/SecurityLockdownTest.java b/examples/security-lockdown/runner/src/test/java/org/glassfish/securitylockdown/test/SecurityLockdownTest.java index 8130993..ba09d05 100755 --- a/examples/security-lockdown/runner/src/test/java/org/glassfish/securitylockdown/test/SecurityLockdownTest.java +++ b/examples/security-lockdown/runner/src/test/java/org/glassfish/securitylockdown/test/SecurityLockdownTest.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2025 Contributors to Eclipse Foundation. * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 Payara Services Ltd. * @@ -17,22 +18,30 @@ package org.glassfish.securitylockdown.test; -import org.junit.Assert; - -import org.glassfish.hk2.api.MultiException; -import org.junit.Test; -import org.jvnet.hk2.testing.junit.HK2Runner; - import com.alice.application.AliceApp; import com.mallory.application.MalloryApp; +import org.glassfish.hk2.api.MultiException; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.jvnet.hk2.testing.junit.HK2Runner; + +import static org.junit.Assume.assumeTrue; + /** - * + * * @author jwells * */ public class SecurityLockdownTest extends HK2Runner { - + + @Before + public void beforeMethod() { + // Security Manager tests using "AccessController.checkPermission(p);" don't work in JDK24+ + assumeTrue(System.getProperty("java.vm.specification.version").compareTo("24") < 0); + } + /** * Tests that we can do a lookup of AliceApp */ @@ -41,7 +50,7 @@ AliceApp aa = testLocator.getService(AliceApp.class); Assert.assertNotNull(aa); } - + /** * Tests that we can do a lookup of AliceApp */ @@ -50,7 +59,7 @@ MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); } - + /** * Tests that we can have Alice perform an operation on Mallory's behalf */ @@ -58,10 +67,10 @@ public void testMalloryCanLegallyHaveAliceDoAnOperation() { MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); - + ma.doAnApprovedOperation(); } - + /** * Tests that we can have Alice perform an operation on Mallory's behalf */ @@ -69,7 +78,7 @@ public void testMalloryCannotGetTheAuditServiceHimself() { MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); - + try { ma.tryToGetTheAuditServiceMyself(); Assert.fail("Mallory should not be able to get the audit service himself"); @@ -78,7 +87,7 @@ // Good, should have failed for him! } } - + /** * Tests that Mallory cannot advertise a service */ @@ -86,7 +95,7 @@ public void testMalloryCannotAdvertiseAService() { MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); - + try { ma.tryToAdvertiseAService(); Assert.fail("Mallory should not be able to advertise a service himself"); @@ -95,7 +104,7 @@ // Good, should have failed for him! } } - + /** * Tests that Mallory cannot advertise a service */ @@ -103,7 +112,7 @@ public void testMalloryCannotUnAdvertiseAService() { MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); - + try { ma.tryToUnAdvertiseAService(); Assert.fail("Mallory should not be able to unadvertise a service"); @@ -112,7 +121,7 @@ // Good, should have failed for him! } } - + /** * Tests that Mallory cannot have a service that injects something it cannot */ @@ -120,13 +129,13 @@ public void testMalloryCannotInjectAnUnAuthorizedThing() { MalloryApp ma = testLocator.getService(MalloryApp.class); Assert.assertNotNull(ma); - + try { ma.tryToInstantiateAServiceWithABadInjectionPoint(); Assert.fail("Mallory should not be able to inject a service it has no rights to"); } catch (MultiException multi) { - Assert.assertTrue(multi.getMessage(), multi.getMessage().contains("There was no object available in " + SecurityLockdownTest.class.getCanonicalName() + Assert.assertTrue(multi.getMessage(), multi.getMessage().contains("There was no object available in " + SecurityLockdownTest.class.getCanonicalName() + " for injection at SystemInjecteeImpl")); } }
diff --git a/examples/security-lockdown/system/pom.xml b/examples/security-lockdown/system/pom.xml index 0475739..7efbb5d 100644 --- a/examples/security-lockdown/system/pom.xml +++ b/examples/security-lockdown/system/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>security-lockdown-example</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>security-lockdown-example-system</artifactId>
diff --git a/external/aopalliance/pom.xml b/external/aopalliance/pom.xml index 5c958c0..b7d1682 100644 --- a/external/aopalliance/pom.xml +++ b/external/aopalliance/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>external</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2.external</groupId>
diff --git a/external/pom.xml b/external/pom.xml index 53ec194..31e4b66 100644 --- a/external/pom.xml +++ b/external/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>external</artifactId>
diff --git a/guice-bridge/pom.xml b/guice-bridge/pom.xml index a94b493..09a91c5 100644 --- a/guice-bridge/pom.xml +++ b/guice-bridge/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2-api/pom.xml b/hk2-api/pom.xml index 4f9e930..e236e6b 100644 --- a/hk2-api/pom.xml +++ b/hk2-api/pom.xml
@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- + Copyright (c) 2025 Contributors to Eclipse Foundation. Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2019, 2020 Payara Services Ltd. @@ -24,7 +25,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId> @@ -83,7 +84,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/policy.txt @{surefireArgLineExtra}</argLine> + <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} ${activate.securitymanager} -Djava.security.policy=${project.build.directory}/test-classes/policy.txt @{surefireArgLineExtra}</argLine> <!-- -Djava.security.debug=access,failure,domain --> </configuration> </plugin>
diff --git a/hk2-api/src/main/java/org/glassfish/hk2/internal/InheritableThreadContext.java b/hk2-api/src/main/java/org/glassfish/hk2/internal/InheritableThreadContext.java index 1d35d7d..c95c902 100755 --- a/hk2-api/src/main/java/org/glassfish/hk2/internal/InheritableThreadContext.java +++ b/hk2-api/src/main/java/org/glassfish/hk2/internal/InheritableThreadContext.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2025 Contributors to Eclipse Foundation. * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 Payara Foundation and/or its affiliates. All rights reserved. * @@ -22,6 +23,8 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; +import java.util.Map; + import jakarta.inject.Singleton; import org.glassfish.hk2.api.ActiveDescriptor; import org.glassfish.hk2.api.Context; @@ -117,34 +120,53 @@ private static class InheritableContextThreadWrapper { - private final HashMap<ActiveDescriptor<?>, Object> instances = new HashMap<>(); - private final long id = Thread.currentThread().getId(); + private final CleanableContext context = new CleanableContext(); public InheritableContextThreadWrapper() { registerStopEvent(); } - public boolean has(ActiveDescriptor<?> d) { - return instances.containsKey(d); + public boolean has(ActiveDescriptor<?> descriptor) { + return context.has(descriptor); } - public Object get(ActiveDescriptor<?> d) { - return instances.get(d); + public Object get(ActiveDescriptor<?> descriptor) { + return context.get(descriptor); } - public void put(ActiveDescriptor<?> d, Object v) { - instances.put(d, v); + public void put(ActiveDescriptor<?> descriptor, Object value) { + context.put(descriptor, value); } public final void registerStopEvent() { - CleanerFactory.create().register(this, () -> { - instances.clear(); + CleanerFactory.create().register(this, context); + } + } - if (LOG_THREAD_DESTRUCTION) { - Logger.getLogger().debug("Removing PerThreadContext data for thread " + id); - } - }); + private static final class CleanableContext implements Runnable { + + private final Map<ActiveDescriptor<?>, Object> instances = new HashMap<>(); + private final long id = Thread.currentThread().getId(); + + public boolean has(ActiveDescriptor<?> descriptor) { + return instances.containsKey(descriptor); } + public Object get(ActiveDescriptor<?> descriptor) { + return instances.get(descriptor); + } + + public void put(ActiveDescriptor<?> descriptor, Object value) { + instances.put(descriptor, value); + } + + @Override + public void run() { + instances.clear(); + + if (LOG_THREAD_DESTRUCTION) { + Logger.getLogger().debug("Removing PerThreadContext data for thread " + id); + } + } } }
diff --git a/hk2-configuration/hk2-integration/pom.xml b/hk2-configuration/hk2-integration/pom.xml index 26ffe23..981b488 100644 --- a/hk2-configuration/hk2-integration/pom.xml +++ b/hk2-configuration/hk2-integration/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-configuration</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-configuration-integration</artifactId>
diff --git a/hk2-configuration/manager/pom.xml b/hk2-configuration/manager/pom.xml index dbfb144..03e0052 100644 --- a/hk2-configuration/manager/pom.xml +++ b/hk2-configuration/manager/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-configuration</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-configuration-hub</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/hk2-json/pom.xml b/hk2-configuration/persistence/hk2-xml/hk2-json/pom.xml index 68a5333..cf57256 100644 --- a/hk2-configuration/persistence/hk2-xml/hk2-json/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/hk2-json/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-json</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/hk2-pbuf/pom.xml b/hk2-configuration/persistence/hk2-xml/hk2-pbuf/pom.xml index 08ef968..9a8fbe9 100644 --- a/hk2-configuration/persistence/hk2-xml/hk2-pbuf/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/hk2-pbuf/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-pbuf</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/integration-test/pom.xml b/hk2-configuration/persistence/hk2-xml/integration-test/pom.xml index 1c8d2bc..b57caa7 100644 --- a/hk2-configuration/persistence/hk2-xml/integration-test/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/integration-test/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-xml-integration-test</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/main/pom.xml b/hk2-configuration/persistence/hk2-xml/main/pom.xml index 64ff14b..c469b19 100644 --- a/hk2-configuration/persistence/hk2-xml/main/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/main/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-xml</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/main/src/test/java/org/glassfish/hk2/xml/test/dynamic/marshall/MarshallTest.java b/hk2-configuration/persistence/hk2-xml/main/src/test/java/org/glassfish/hk2/xml/test/dynamic/marshall/MarshallTest.java index 9493c7c..7a704e7 100755 --- a/hk2-configuration/persistence/hk2-xml/main/src/test/java/org/glassfish/hk2/xml/test/dynamic/marshall/MarshallTest.java +++ b/hk2-configuration/persistence/hk2-xml/main/src/test/java/org/glassfish/hk2/xml/test/dynamic/marshall/MarshallTest.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2025 Contributors to Eclipse Foundation. * Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -52,11 +53,11 @@ private final static File OUTPUT_FILE = new File("output.xml"); private final static String LOOK_FOR_ME = "0.255.255.255"; public final static String REFEREES1_FILE = "Referees1.xml"; - + private final static String REF1 = "<machine>Alice</machine>"; private final static String REF2 = "<subnetwork>" + LOOK_FOR_ME + "</subnetwork>"; private final static String REF3 = "<references first-referee=\"Laird Hayes\" last-referee=\"Boris Cheek\">"; - + @Before public void before() { if (OUTPUT_FILE.exists()) { @@ -64,14 +65,14 @@ Assert.assertTrue(didDelete); } } - + @After public void after() { if (OUTPUT_FILE.exists()) { OUTPUT_FILE.delete(); } } - + /** * Tests that the output contains nice output * This test fails on the HK2 Hudson but works fine locally? @@ -82,16 +83,16 @@ ServiceLocator locator = Utilities.createLocator(); XmlService xmlService = locator.getService(XmlService.class); Hub hub = locator.getService(Hub.class); - + URL url = getClass().getClassLoader().getResource(MergeTest.DOMAIN1_FILE); - + XmlRootHandle<DomainBean> rootHandle = xmlService.unmarshal(url.toURI(), DomainBean.class); - + MergeTest.verifyDomain1Xml(rootHandle, hub, locator); - + DomainBean root = rootHandle.getRoot(); root.setSubnetwork(LOOK_FOR_ME); - + FileOutputStream fos = new FileOutputStream(OUTPUT_FILE); try { rootHandle.marshal(fos); @@ -99,19 +100,19 @@ finally { fos.close(); } - + checkFile(REF1, REF2); } - + private void checkFile(String... strings) throws Exception { Map<String, Boolean> foundAll = new HashMap<String, Boolean>(); for (String string : strings) { foundAll.put(string, false); } - + FileReader reader = new FileReader(OUTPUT_FILE); BufferedReader buffered = new BufferedReader(reader); - + try { String line; while ((line = buffered.readLine()) != null) { @@ -126,15 +127,15 @@ buffered.close(); reader.close(); } - + for (Map.Entry<String, Boolean> entry : foundAll.entrySet()) { String lookingFor = entry.getKey(); boolean found = entry.getValue(); - + Assert.assertTrue("Did not find the string " + lookingFor, found); } } - + /** * Tests that the output contains nice output */ @@ -144,16 +145,16 @@ ServiceLocator locator = Utilities.createDomLocator(); XmlService xmlService = locator.getService(XmlService.class); Hub hub = locator.getService(Hub.class); - + URL url = getClass().getClassLoader().getResource(MergeTest.DOMAIN1_FILE); - + XmlRootHandle<DomainBean> rootHandle = xmlService.unmarshal(url.toURI(), DomainBean.class); - + MergeTest.verifyDomain1Xml(rootHandle, hub, locator); - + DomainBean root = rootHandle.getRoot(); root.setSubnetwork(LOOK_FOR_ME); - + FileOutputStream fos = new FileOutputStream(OUTPUT_FILE); try { rootHandle.marshal(fos); @@ -161,35 +162,35 @@ finally { fos.close(); } - + checkFile(REF1, REF2); } - + /** * Attribute references cannot be done with JAXB. So this * file is kept separately for this purpose */ @Test - // @org.junit.Ignore + @org.junit.Ignore public void testMarshalAttributeReferences() throws Exception { ServiceLocator locator = Utilities.createDomLocator(); XmlService xmlService = locator.getService(XmlService.class); - + URL url = getClass().getClassLoader().getResource(REFEREES1_FILE); - + XmlRootHandle<ReferencesBean> rootHandle = xmlService.unmarshal(url.toURI(), ReferencesBean.class, false, false); - + ReferencesBean references = rootHandle.getRoot(); - + RefereeBean hayes = references.getReferees().get(0); RefereeBean cheek = references.getReferees().get(1); - + Assert.assertNotNull(hayes); Assert.assertNotNull(cheek); - + Assert.assertEquals(hayes, references.getFirstReferee()); Assert.assertEquals(cheek, references.getLastReferee()); - + FileOutputStream fos = new FileOutputStream(OUTPUT_FILE); try { rootHandle.marshal(fos); @@ -197,35 +198,35 @@ finally { fos.close(); } - + checkFile(REF3); } - + /** * Attribute references cannot be done with JAXB. So this * file is kept separately for this purpose */ @Test - // @org.junit.Ignore + @org.junit.Ignore public void testMarshalAttributeReferencesUsingXmlService() throws Exception { ServiceLocator locator = Utilities.createDomLocator(); XmlService xmlService = locator.getService(XmlService.class); - + URL url = getClass().getClassLoader().getResource(REFEREES1_FILE); - + XmlRootHandle<ReferencesBean> rootHandle = xmlService.unmarshal(url.toURI(), ReferencesBean.class, false, false); - + ReferencesBean references = rootHandle.getRoot(); - + RefereeBean hayes = references.getReferees().get(0); RefereeBean cheek = references.getReferees().get(1); - + Assert.assertNotNull(hayes); Assert.assertNotNull(cheek); - + Assert.assertEquals(hayes, references.getFirstReferee()); Assert.assertEquals(cheek, references.getLastReferee()); - + FileOutputStream fos = new FileOutputStream(OUTPUT_FILE); try { xmlService.marshal(fos, rootHandle); @@ -233,10 +234,10 @@ finally { fos.close(); } - + checkFile(REF3); } - + private final static String A = "A"; private final static String B = "B"; private final static String C = "C"; @@ -248,41 +249,41 @@ private final static String I = "I"; private final static String J = "J"; private final static String K = "K"; - + private static void fillInKeyedLeafBean(KeyedLeafBean klb) { klb.setPropertyI(I); klb.setPropertyH(H); } - + private static void fillInUnkeyedLeafBean(UnkeyedLeafBean ulb) { ulb.setPropertyJ(J); ulb.setPropertyK(K); } - + private static void fillInRootBean(OrderingRootBean orb, XmlService xmlService) { KeyedLeafBean propA = orb.addPropertyA(H); fillInKeyedLeafBean(propA); - + UnkeyedLeafBean propB = orb.addPropertyB(); fillInUnkeyedLeafBean(propB); - + UnkeyedLeafBean propC = orb.addPropertyC(); fillInUnkeyedLeafBean(propC); - + KeyedLeafBean propD = orb.addPropertyD(H); fillInKeyedLeafBean(propD); - + KeyedLeafBean propE = xmlService.createBean(KeyedLeafBean.class); fillInKeyedLeafBean(propE); orb.setPropertyE(propE); - + UnkeyedLeafBean propF = xmlService.createBean(UnkeyedLeafBean.class); fillInUnkeyedLeafBean(propF); orb.setPropertyF(propF); - + orb.setPropertyG(G); } - + /** * Attribute references cannot be done with JAXB. So this * file is kept separately for this purpose @@ -291,10 +292,10 @@ // @org.junit.Ignore public void testOrderingSpecifiedWithXmlType() throws Exception { ServiceLocator locator = Utilities.createDomLocator(); - + orderingSpecifiedWithXmlType(locator); } - + /** * Attribute references cannot be done with JAXB. So this * file is kept separately for this purpose @@ -303,43 +304,43 @@ // @org.junit.Ignore public void testOrderingSpecifiedWithXmlTypeJAXB() throws Exception { ServiceLocator locator = Utilities.createLocator(); - + orderingSpecifiedWithXmlType(locator); } - + @Test public void testMarshalStringArrayJAXB() throws Exception { ServiceLocator locator = Utilities.createLocator(); - + XmlService jaxbXmlService = locator.getService(XmlService.class, XmlServiceParser.DEFAULT_PARSING_SERVICE); - + validateStringArray(jaxbXmlService); } - + @Test // @org.junit.Ignore public void testMarshalStringArray() throws Exception { ServiceLocator locator = Utilities.createDomLocator(); - + XmlService streamXmlService = locator.getService(XmlService.class, XmlServiceParser.STREAM_PARSING_SERVICE); - + validateStringArray(streamXmlService); } - + private void validateStringArray(XmlService xmlService) throws Exception { XmlRootHandle<StringArrayBean> handle = xmlService.createEmptyHandle(StringArrayBean.class, false, false); handle.addRoot(); - + StringArrayBean root = handle.getRoot(); - + String datum[] = new String[] { "foo" , "bar" , "baz" }; - + root.setData(datum); - + ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { handle.marshal(baos); @@ -347,23 +348,23 @@ finally { baos.close(); } - + byte asBytes[] = baos.toByteArray(); String asString = new String(asBytes); - + Assert.assertTrue(asString, asString.contains("<data>foo</data>")); Assert.assertTrue(asString, asString.contains("<data>bar</data>")); Assert.assertTrue(asString, asString.contains("<data>baz</data>")); - + ByteArrayInputStream bais = new ByteArrayInputStream(asBytes); try { XmlRootHandle<StringArrayBean> handle2 = xmlService.unmarshal(bais, StringArrayBean.class, false, false); StringArrayBean root2 = handle2.getRoot(); - + String data2[] = root2.getData(); - + Assert.assertEquals(Arrays.toString(data2), 3, data2.length); - + Assert.assertEquals("foo", data2[0]); Assert.assertEquals("bar", data2[1]); Assert.assertEquals("baz", data2[2]); @@ -372,21 +373,21 @@ bais.close(); } } - + /** * Attribute references cannot be done with JAXB. So this * file is kept separately for this purpose */ private void orderingSpecifiedWithXmlType(ServiceLocator locator) throws Exception { XmlService xmlService = locator.getService(XmlService.class); - + XmlRootHandle<OrderingRootBean> rootHandle = xmlService.createEmptyHandle(OrderingRootBean.class); - + rootHandle.addRoot(); OrderingRootBean root = rootHandle.getRoot(); - + fillInRootBean(root, xmlService); - + ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { rootHandle.marshal(baos); @@ -394,9 +395,9 @@ finally { baos.close(); } - + LinkedHashMap<Integer, String> lines = new LinkedHashMap<Integer, String>(); - + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); BufferedReader br = new BufferedReader(new InputStreamReader(bais)); try { @@ -406,14 +407,14 @@ lines.put(lcv, line); lcv++; } - + } finally { br.close(); } - + String failureDocument = baos.toString(); - + boolean foundF = false; boolean foundG = false; boolean foundE = false; @@ -424,7 +425,7 @@ for (Map.Entry<Integer, String> lineEntry : lines.entrySet()) { String line = lineEntry.getValue(); int lineNumber = lineEntry.getKey(); - + if (line.contains("<f>")) { Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -432,10 +433,10 @@ Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundA); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundF = true; } - + if (line.contains("<g>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -444,10 +445,10 @@ Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundG = true; } - + if (line.contains("<e>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -456,10 +457,10 @@ Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundE = true; } - + if (line.contains("<a>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -468,10 +469,10 @@ Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundA = true; } - + if (line.contains("<c>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -480,10 +481,10 @@ Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundC = true; } - + if (line.contains("<b>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -492,10 +493,10 @@ Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundB = true; } - + if (line.contains("<d>")) { Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundF); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundG); @@ -504,11 +505,11 @@ Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundC); Assert.assertTrue("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundB); Assert.assertFalse("Order wrong on line " + lineNumber + " of\n" + failureDocument, foundD); - + foundD = true; } } - + Assert.assertTrue(foundD); }
diff --git a/hk2-configuration/persistence/hk2-xml/pom.xml b/hk2-configuration/persistence/hk2-xml/pom.xml index 34c7104..84448db 100644 --- a/hk2-configuration/persistence/hk2-xml/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-configuration-persistence</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-xml-parent</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/schema/pom.xml b/hk2-configuration/persistence/hk2-xml/schema/pom.xml index 58392ac..38a864b 100644 --- a/hk2-configuration/persistence/hk2-xml/schema/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/schema/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-xml-schema</artifactId>
diff --git a/hk2-configuration/persistence/hk2-xml/test1/pom.xml b/hk2-configuration/persistence/hk2-xml/test1/pom.xml index c6ee736..c1b35b9 100644 --- a/hk2-configuration/persistence/hk2-xml/test1/pom.xml +++ b/hk2-configuration/persistence/hk2-xml/test1/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-xml-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-xml-test</artifactId>
diff --git a/hk2-configuration/persistence/pom.xml b/hk2-configuration/persistence/pom.xml index a8fc9e4..1ca69e2 100644 --- a/hk2-configuration/persistence/pom.xml +++ b/hk2-configuration/persistence/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-configuration</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-configuration-persistence</artifactId>
diff --git a/hk2-configuration/persistence/property-file/pom.xml b/hk2-configuration/persistence/property-file/pom.xml index 71492d6..0736985 100644 --- a/hk2-configuration/persistence/property-file/pom.xml +++ b/hk2-configuration/persistence/property-file/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-configuration-persistence</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-property-file</artifactId>
diff --git a/hk2-configuration/pom.xml b/hk2-configuration/pom.xml index 5d40ffa..07a302e 100644 --- a/hk2-configuration/pom.xml +++ b/hk2-configuration/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-configuration</artifactId>
diff --git a/hk2-core/pom.xml b/hk2-core/pom.xml index d85f31a..d45a239 100644 --- a/hk2-core/pom.xml +++ b/hk2-core/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-core</artifactId>
diff --git a/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderFacade.java b/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderFacade.java index 4dcb573..4bdda2a 100755 --- a/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderFacade.java +++ b/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderFacade.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2025 Contributors to Eclipse Foundation. * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 Payara Foundation and/or its affiliates. All rights reserved. * @@ -50,10 +51,7 @@ } public final void registerStopEvent() { - CleanerFactory.create().register(this, () -> { - LogHelper.getDefaultLogger().log(Level.FINE, "Facade ClassLoader killed {0}", privateLoader.getOwner().getModuleDefinition().getName()); - privateLoader.stop(); - }); + CleanerFactory.create().register(this, new FacadeCleaner(privateLoader)); } public void setPublicPkgs(String[] publicPkgs) { @@ -175,4 +173,19 @@ return super.toString() + " Facade for " + privateLoader.toString(); } + private static final class FacadeCleaner implements Runnable { + + private final ModuleClassLoader moduleClassLoader; + + FacadeCleaner(ModuleClassLoader moduleClassLoader) { + this.moduleClassLoader = moduleClassLoader; + } + + @Override + public void run() { + LogHelper.getDefaultLogger().log(Level.FINE, "Facade ClassLoader killed {0}", + moduleClassLoader.getOwner().getModuleDefinition().getName()); + moduleClassLoader.stop(); + } + } }
diff --git a/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderProxy.java b/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderProxy.java index ae8cc78..09b8abe 100755 --- a/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderProxy.java +++ b/hk2-core/src/main/java/com/sun/enterprise/module/impl/ClassLoaderProxy.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2025 Contributors to Eclipse Foundation. * Copyright (c) 2007, 2024 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 Payara Foundation and/or its affiliates. All rights reserved. * @@ -19,6 +20,7 @@ import com.sun.enterprise.module.common_impl.FlattenEnumeration; +import java.lang.ref.Cleaner; import java.net.URLClassLoader; import java.net.URL; import java.util.*; @@ -37,11 +39,12 @@ private final ReentrantLock lock = new ReentrantLock(); private final List<ClassLoader> surrogates = new CopyOnWriteArrayList<ClassLoader>(); private final List<ClassLoaderFacade> facadeSurrogates = new CopyOnWriteArrayList<ClassLoaderFacade>(); + private final Cleaner.Cleanable cleanable; /** Creates a new instance of ClassLoader */ public ClassLoaderProxy(URL[] shared, ClassLoader parent) { super(shared, parent); - registerStopEvent(); + this.cleanable = registerStopEvent(); } protected Class<?> loadClass(String name, boolean resolve, boolean followImports) @@ -206,15 +209,12 @@ * called by the facade class loader when it is garbage collected. * this is a good time to see if this module should be unloaded. */ - public final void registerStopEvent() { - CleanerFactory.create().register(this, () -> { - stop(); - }); + public final Cleaner.Cleanable registerStopEvent() { + return CleanerFactory.create().register(this, new DelegateCleaner(surrogates, facadeSurrogates)); } public void stop() { - surrogates.clear(); - facadeSurrogates.clear(); + cleanable.clean(); } @Override @@ -241,4 +241,21 @@ public void addURL(URL url) { super.addURL(url); } + + private static final class DelegateCleaner implements Runnable { + + private final List<ClassLoader> surrogates; + private final List<ClassLoaderFacade> facadeSurrogates; + + DelegateCleaner(List<ClassLoader> surrogates, List<ClassLoaderFacade> facadeSurrogates) { + this.surrogates = surrogates; + this.facadeSurrogates = facadeSurrogates; + } + + @Override + public void run() { + surrogates.clear(); + facadeSurrogates.clear(); + } + } }
diff --git a/hk2-extras/pom.xml b/hk2-extras/pom.xml index e47fab0..bd4043e 100644 --- a/hk2-extras/pom.xml +++ b/hk2-extras/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2-jmx/pom.xml b/hk2-jmx/pom.xml index 49a5c2c..9029593 100644 --- a/hk2-jmx/pom.xml +++ b/hk2-jmx/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2-locator/pom.xml b/hk2-locator/pom.xml index 5e8d926..fd492dc 100644 --- a/hk2-locator/pom.xml +++ b/hk2-locator/pom.xml
@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- + Copyright (c) 2025 Contributors to Eclipse Foundation. Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2019, 2020 Payara Services Ltd. @@ -24,7 +25,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-locator</artifactId> @@ -93,7 +94,7 @@ <!-- Turns on security manager and turns off the soft cache in order to increase code coverage --> - <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/policy.txt -Dorg.jvnet.hk2.properties.useSoftReference=false @{surefireArgLineExtra}</argLine> + <argLine>-Dlocal.repo=${settings.localRepository} -Dbuild.dir=${project.build.directory} ${activate.securitymanager} -Djava.security.policy=${project.build.directory}/test-classes/policy.txt -Dorg.jvnet.hk2.properties.useSoftReference=false @{surefireArgLineExtra}</argLine> <trimStackTrace>false</trimStackTrace> <!-- -Djava.security.debug=access,failure,domain --> </configuration>
diff --git a/hk2-locator/src/main/java/org/jvnet/hk2/internal/SingletonContext.java b/hk2-locator/src/main/java/org/jvnet/hk2/internal/SingletonContext.java index 5908dec..d2644fa 100755 --- a/hk2-locator/src/main/java/org/jvnet/hk2/internal/SingletonContext.java +++ b/hk2-locator/src/main/java/org/jvnet/hk2/internal/SingletonContext.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2026 Contributors to Eclipse Foundation. * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -50,21 +51,27 @@ @Override public Object compute(ContextualInput<Object> a) { - final ActiveDescriptor<Object> activeDescriptor = a.getDescriptor(); - final Object cachedVal = activeDescriptor.getCache(); + Object cachedVal = activeDescriptor.getCache(); if (cachedVal != null) { return cachedVal; } + // Synchronize on the descriptor to prevent race conditions + synchronized (activeDescriptor) { + cachedVal = activeDescriptor.getCache(); + if (cachedVal != null) { + return cachedVal; + } - final Object createdVal = activeDescriptor.create(a.getRoot()); - activeDescriptor.setCache(createdVal); - if (activeDescriptor instanceof SystemDescriptor) { - ((SystemDescriptor<?>) activeDescriptor).setSingletonGeneration(generationNumber++); + final Object createdVal = activeDescriptor.create(a.getRoot()); + activeDescriptor.setCache(createdVal); + if (activeDescriptor instanceof SystemDescriptor) { + ((SystemDescriptor<?>) activeDescriptor).setSingletonGeneration(generationNumber++); + } + + return createdVal; } - - return createdVal; } }, new Cache.CycleHandler<ContextualInput<Object>>(){
diff --git a/hk2-locator/src/test/java/org/glassfish/hk2/tests/locator/servicelocatorutilities/Hk2SingletonCreationTest.java b/hk2-locator/src/test/java/org/glassfish/hk2/tests/locator/servicelocatorutilities/Hk2SingletonCreationTest.java new file mode 100644 index 0000000..1fe2a4b --- /dev/null +++ b/hk2-locator/src/test/java/org/glassfish/hk2/tests/locator/servicelocatorutilities/Hk2SingletonCreationTest.java
@@ -0,0 +1,115 @@ +/* + * Copyright (c) 2026 Contributors to Eclipse Foundation. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.hk2.tests.locator.servicelocatorutilities; + +import org.glassfish.hk2.api.ServiceLocator; +import org.glassfish.hk2.utilities.ServiceLocatorUtilities; +import org.glassfish.hk2.utilities.binding.AbstractBinder; +import org.junit.Assert; +import org.junit.Test; + +import jakarta.annotation.PostConstruct; +import jakarta.inject.Singleton; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; + +import org.glassfish.hk2.api.MultiException; +import org.glassfish.hk2.api.ServiceLocatorFactory; +import org.junit.Before; + +public class Hk2SingletonCreationTest { + + private static CompletableFuture<Void> firstReferenceCreationStarted; + private static CompletableFuture<Void> firstReferenceCreated; + + static class ConcurrentlyCreatedService { + + ConcurrentlyCreatedService() throws Exception { + firstReferenceCreationStarted.complete(null); + firstReferenceCreated.join(); + Thread.sleep(100); + } + } + + static class ConcurrentlyInitializedService { + + @PostConstruct + public void init() throws Exception { + firstReferenceCreationStarted.complete(null); + firstReferenceCreated.join(); + Thread.sleep(100); + } + } + + private ServiceLocator createServiceLocator() { + return ServiceLocatorUtilities + .bind("test-locator", new AbstractBinder() { + @Override + protected void configure() { + bind(ConcurrentlyCreatedService.class) + .to(ConcurrentlyCreatedService.class) + .in(Singleton.class) + .proxy(false); + bind(ConcurrentlyInitializedService.class) + .to(ConcurrentlyInitializedService.class) + .in(Singleton.class) + .proxy(false); + } + }); + } + + @Before + public void initTest() { + firstReferenceCreationStarted = new CompletableFuture<>(); + firstReferenceCreated = new CompletableFuture<>(); + } + + @Test + public void testSingletonsCreatedConcurrently() throws Exception { + testConcurrentSingletonRetrieval(ConcurrentlyCreatedService.class); + } + + @Test + public void testSingletonsInitializedConcurrently() throws Exception { + testConcurrentSingletonRetrieval(ConcurrentlyInitializedService.class); + } + private <SERVICE_CLASS> void testConcurrentSingletonRetrieval(Class<SERVICE_CLASS> serviceClass) throws MultiException, InterruptedException { + ServiceLocator parentLocator = createServiceLocator(); + ServiceLocator childLocator = ServiceLocatorFactory.getInstance() + .create("child-test-locator", parentLocator); + + AtomicReference<SERVICE_CLASS> firstReference = new AtomicReference<>(); + + Thread thread = new Thread(() -> firstReference.set(parentLocator + .getService(serviceClass))); + + thread.start(); + + firstReferenceCreationStarted.join(); + firstReferenceCreated.complete(null); + + System.out.println("Before second getService"); + + SERVICE_CLASS secondInstance = childLocator + .getService(serviceClass); + + thread.join(); // first instance created + + Assert.assertSame(firstReference.get(), secondInstance); // this fails but is shouldn't + } + +}
diff --git a/hk2-metadata-generator/main/pom.xml b/hk2-metadata-generator/main/pom.xml index 68ba85a..f04c802 100644 --- a/hk2-metadata-generator/main/pom.xml +++ b/hk2-metadata-generator/main/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-metadata-generator-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2-metadata-generator/pom.xml b/hk2-metadata-generator/pom.xml index a0b10e6..e35c3f7 100644 --- a/hk2-metadata-generator/pom.xml +++ b/hk2-metadata-generator/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-metadata-generator-parent</artifactId>
diff --git a/hk2-metadata-generator/test1/pom.xml b/hk2-metadata-generator/test1/pom.xml index 683be62..0570c19 100644 --- a/hk2-metadata-generator/test1/pom.xml +++ b/hk2-metadata-generator/test1/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-metadata-generator-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2-runlevel/pom.xml b/hk2-runlevel/pom.xml index 9a88730..cb028f4 100644 --- a/hk2-runlevel/pom.xml +++ b/hk2-runlevel/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-runlevel</artifactId>
diff --git a/hk2-testing/ant/pom.xml b/hk2-testing/ant/pom.xml index 7387b56..5b69364 100644 --- a/hk2-testing/ant/pom.xml +++ b/hk2-testing/ant/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/collections/pom.xml b/hk2-testing/collections/pom.xml index f5907e5..f8a1cd6 100644 --- a/hk2-testing/collections/pom.xml +++ b/hk2-testing/collections/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-testing</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-collections-tests</artifactId>
diff --git a/hk2-testing/di-tck/pom.xml b/hk2-testing/di-tck/pom.xml index a43e053..f90ddae 100644 --- a/hk2-testing/di-tck/pom.xml +++ b/hk2-testing/di-tck/pom.xml
@@ -22,7 +22,11 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-testing</artifactId> +<<<<<<< HEAD + <version>3.1.1</version> +======= <version>4.0.0-M3</version> +>>>>>>> refs/heads/4.0.0-M3 </parent> <artifactId>hk2-di-tck-runner</artifactId>
diff --git a/hk2-testing/hk2-junitrunner/pom.xml b/hk2-testing/hk2-junitrunner/pom.xml index 5e05c49..fe3791a 100644 --- a/hk2-testing/hk2-junitrunner/pom.xml +++ b/hk2-testing/hk2-junitrunner/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/hk2-locator-extras/pom.xml b/hk2-testing/hk2-locator-extras/pom.xml index d23b435..6917064 100644 --- a/hk2-testing/hk2-locator-extras/pom.xml +++ b/hk2-testing/hk2-locator-extras/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/hk2-locator-no-proxies/pom.xml b/hk2-testing/hk2-locator-no-proxies/pom.xml index dc9188b..e664ef2 100644 --- a/hk2-testing/hk2-locator-no-proxies/pom.xml +++ b/hk2-testing/hk2-locator-no-proxies/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/hk2-locator-no-proxies2/pom.xml b/hk2-testing/hk2-locator-no-proxies2/pom.xml index f604426..7de7a37 100644 --- a/hk2-testing/hk2-locator-no-proxies2/pom.xml +++ b/hk2-testing/hk2-locator-no-proxies2/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/hk2-mockito/pom.xml b/hk2-testing/hk2-mockito/pom.xml index 58e1326..b2c3dfc 100644 --- a/hk2-testing/hk2-mockito/pom.xml +++ b/hk2-testing/hk2-mockito/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-testing</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-mockito</artifactId> @@ -90,7 +90,7 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>5.12.0</version> + <version>5.22.0</version> <scope>provided</scope> </dependency> </dependencies>
diff --git a/hk2-testing/hk2-runlevel-extras/pom.xml b/hk2-testing/hk2-runlevel-extras/pom.xml index 149851d..31f248d 100644 --- a/hk2-testing/hk2-runlevel-extras/pom.xml +++ b/hk2-testing/hk2-runlevel-extras/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/hk2-testng/pom.xml b/hk2-testing/hk2-testng/pom.xml index 5f47e77..748be54 100644 --- a/hk2-testing/hk2-testng/pom.xml +++ b/hk2-testing/hk2-testng/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/interceptor-events/pom.xml b/hk2-testing/interceptor-events/pom.xml index 0555ef5..fd2b971 100644 --- a/hk2-testing/interceptor-events/pom.xml +++ b/hk2-testing/interceptor-events/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-testing</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>interceptor-events</artifactId>
diff --git a/hk2-testing/jersey/jersey-guice/form-param/pom.xml b/hk2-testing/jersey/jersey-guice/form-param/pom.xml index 43c0c3b..2d99edc 100644 --- a/hk2-testing/jersey/jersey-guice/form-param/pom.xml +++ b/hk2-testing/jersey/jersey-guice/form-param/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/jersey/jersey-guice/pom.xml b/hk2-testing/jersey/jersey-guice/pom.xml index 773e470..05ae42d 100644 --- a/hk2-testing/jersey/jersey-guice/pom.xml +++ b/hk2-testing/jersey/jersey-guice/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/jersey/pom.xml b/hk2-testing/jersey/pom.xml index 9bb9aee..6941770 100644 --- a/hk2-testing/jersey/pom.xml +++ b/hk2-testing/jersey/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/hk2-testing/pom.xml b/hk2-testing/pom.xml index b6edea6..914e913 100644 --- a/hk2-testing/pom.xml +++ b/hk2-testing/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-testing</artifactId>
diff --git a/hk2-utils/pom.xml b/hk2-utils/pom.xml index 3c4270f..eb1d2f5 100644 --- a/hk2-utils/pom.xml +++ b/hk2-utils/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/hk2/pom.xml b/hk2/pom.xml index c0c08df..fe51a28 100644 --- a/hk2/pom.xml +++ b/hk2/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2</artifactId>
diff --git a/javadocs/pom.xml b/javadocs/pom.xml index eb4799e..b7de4fc 100644 --- a/javadocs/pom.xml +++ b/javadocs/pom.xml
@@ -22,7 +22,11 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> +<<<<<<< HEAD + <version>3.1.1</version> +======= <version>4.0.0-M3</version> +>>>>>>> refs/heads/4.0.0-M3 </parent> <artifactId>hk2-javadocs</artifactId> <name>HK2 Javadocs</name>
diff --git a/maven-plugins/consolidatedbundle-maven-plugin/pom.xml b/maven-plugins/consolidatedbundle-maven-plugin/pom.xml index 6128123..e10d585 100644 --- a/maven-plugins/consolidatedbundle-maven-plugin/pom.xml +++ b/maven-plugins/consolidatedbundle-maven-plugin/pom.xml
@@ -25,7 +25,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>maven-plugins</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>consolidatedbundle-maven-plugin</artifactId>
diff --git a/maven-plugins/hk2-inhabitant-generator/pom.xml b/maven-plugins/hk2-inhabitant-generator/pom.xml index b37ce09..6f59db8 100644 --- a/maven-plugins/hk2-inhabitant-generator/pom.xml +++ b/maven-plugins/hk2-inhabitant-generator/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>maven-plugins</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>hk2-inhabitant-generator</artifactId>
diff --git a/maven-plugins/osgiversion-maven-plugin/pom.xml b/maven-plugins/osgiversion-maven-plugin/pom.xml index 96af82d..775838f 100644 --- a/maven-plugins/osgiversion-maven-plugin/pom.xml +++ b/maven-plugins/osgiversion-maven-plugin/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>maven-plugins</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>osgiversion-maven-plugin</artifactId>
diff --git a/maven-plugins/pom.xml b/maven-plugins/pom.xml index d00e9d8..85daf05 100644 --- a/maven-plugins/pom.xml +++ b/maven-plugins/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>maven-plugins</artifactId> @@ -53,7 +53,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> - <version>3.1.0</version> + <version>3.3.1</version> <configuration> <tagNameFormat>maven-plugins-@{project.version}</tagNameFormat> </configuration> @@ -61,7 +61,7 @@ <dependency> <groupId>org.apache.maven.scm</groupId> <artifactId>maven-scm-provider-gitexe</artifactId> - <version>2.1.0</version> + <version>2.2.1</version> </dependency> </dependencies> </plugin>
diff --git a/osgi/adapter-tests/contract-bundle/pom.xml b/osgi/adapter-tests/contract-bundle/pom.xml index d23615e..e5cf314 100644 --- a/osgi/adapter-tests/contract-bundle/pom.xml +++ b/osgi/adapter-tests/contract-bundle/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>contract-bundle</artifactId>
diff --git a/osgi/adapter-tests/faux-sdp-bundle/pom.xml b/osgi/adapter-tests/faux-sdp-bundle/pom.xml index 114cdcf..345db37 100644 --- a/osgi/adapter-tests/faux-sdp-bundle/pom.xml +++ b/osgi/adapter-tests/faux-sdp-bundle/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>faux-sdp-bundle</artifactId>
diff --git a/osgi/adapter-tests/no-hk2-bundle/pom.xml b/osgi/adapter-tests/no-hk2-bundle/pom.xml index a79bc55..0a41f0a 100644 --- a/osgi/adapter-tests/no-hk2-bundle/pom.xml +++ b/osgi/adapter-tests/no-hk2-bundle/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>no-hk2-bundle</artifactId>
diff --git a/osgi/adapter-tests/osgi-adapter-test/pom.xml b/osgi/adapter-tests/osgi-adapter-test/pom.xml index 1ebe01a..f23f45e 100644 --- a/osgi/adapter-tests/osgi-adapter-test/pom.xml +++ b/osgi/adapter-tests/osgi-adapter-test/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-test</artifactId>
diff --git a/osgi/adapter-tests/pom.xml b/osgi/adapter-tests/pom.xml index e4cbd24..07c7244 100644 --- a/osgi/adapter-tests/pom.xml +++ b/osgi/adapter-tests/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>
diff --git a/osgi/adapter-tests/sdp-management-bundle/pom.xml b/osgi/adapter-tests/sdp-management-bundle/pom.xml index 978d244..7561014 100644 --- a/osgi/adapter-tests/sdp-management-bundle/pom.xml +++ b/osgi/adapter-tests/sdp-management-bundle/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>sdp-management-bundle</artifactId>
diff --git a/osgi/adapter-tests/test-module-startup/pom.xml b/osgi/adapter-tests/test-module-startup/pom.xml index e986e0b..afeb065 100644 --- a/osgi/adapter-tests/test-module-startup/pom.xml +++ b/osgi/adapter-tests/test-module-startup/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-adapter-tests-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>test-module-startup</artifactId>
diff --git a/osgi/adapter/pom.xml b/osgi/adapter/pom.xml index 83adef1..90017f0 100644 --- a/osgi/adapter/pom.xml +++ b/osgi/adapter/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>osgi</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>osgi-adapter</artifactId>
diff --git a/osgi/pom.xml b/osgi/pom.xml index ae41048..7f40aa9 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml
@@ -23,7 +23,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <artifactId>osgi</artifactId>
diff --git a/pom.xml b/pom.xml index acf43c1..3676d11 100644 --- a/pom.xml +++ b/pom.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2022, 2026 Contributors to Eclipse Foundation. All rights reserved. + Copyright (c) 2022, 2026 Contributors to Eclipse Foundation. Copyright (c) 2020, 2021 Payara Services Ltd. Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. @@ -144,7 +144,7 @@ <mvn.version>3.2.5</mvn.version> <project.build.outputTimestamp>2023-10-04T08:38:05Z</project.build.outputTimestamp> - <jakarta.activation.version>2.1.3</jakarta.activation.version> + <jakarta.activation.version>2.1.4</jakarta.activation.version> <jakarta.annotation.version>3.0.0-M1</jakarta.annotation.version> <jakarta.enterprise.cdi-api.version>4.1.0</jakarta.enterprise.cdi-api.version> <jakarta.servlet.version>6.1.0</jakarta.servlet.version> @@ -153,32 +153,32 @@ <jakarta.ws.rs.version>4.0.0</jakarta.ws.rs.version> <jakarta.el.version>6.0.0</jakarta.el.version> - <parsson.version>1.1.6</parsson.version> - <jaxb-api.version>4.0.2</jaxb-api.version> - <jaxb-runtime.version>4.0.5</jaxb-runtime.version> - <hibernate-validator.version>8.0.1.Final</hibernate-validator.version> + <parsson.version>1.1.7</parsson.version> + <jaxb-api.version>4.0.5</jaxb-api.version> + <jaxb-runtime.version>4.0.6</jaxb-runtime.version> + <hibernate-validator.version>8.0.3.Final</hibernate-validator.version> <glassfish.jakarta.el.version>4.0.2</glassfish.jakarta.el.version> <jtype.version>0.1.3</jtype.version> <javassist.version>3.30.2-GA</javassist.version> <junit.version>4.13.2</junit.version> - <asm.version>9.7</asm.version> + <asm.version>9.9.1</asm.version> <woodstox.version>4.1.2</woodstox.version> <stax-api.version>1.0-2</stax-api.version> <aopalliance.version>1.0</aopalliance.version> - <testng.version>7.10.2</testng.version> - <assertj.version>3.26.0</assertj.version> - <pax-exam-version>4.13.5</pax-exam-version> + <testng.version>7.12.2</testng.version> + <assertj.version>3.27.7</assertj.version> + <pax-exam-version>4.14.0</pax-exam-version> <jakarta-inject.version>2.0.1</jakarta-inject.version> - <org.jboss.logging.version>3.6.0.Final</org.jboss.logging.version> - <jersey.version>3.1.7</jersey.version> + <org.jboss.logging.version>3.6.2.Final</org.jboss.logging.version> + <jersey.version>3.1.11</jersey.version> <grizzly.version>4.0.2</grizzly.version> <hamcrest.version>1.3</hamcrest.version> - <classmate.version>1.7.0</classmate.version> + <classmate.version>1.7.3</classmate.version> <springcontext.version>6.1.10</springcontext.version> <guice.version>7.0.0</guice.version> - <protobuf.version>3.25.3</protobuf.version> + <protobuf.version>3.25.8</protobuf.version> <legal.doc.source>${maven.multiModuleProjectDirectory}/</legal.doc.source> @@ -235,13 +235,13 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> - <version>3.9.8</version> + <version>3.9.12</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> - <version>3.9.8</version> + <version>3.9.12</version> <scope>provided</scope> </dependency> <dependency> @@ -280,22 +280,22 @@ <groupId>org.glassfish.hk2</groupId> <artifactId>osgi-resource-locator</artifactId> <!-- Unfortunately we use the same coordinates as old Oracle, but versioning started from 1.0.0 --> - <version>1.0.3</version> + <version>1.0.4</version> </dependency> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> - <version>1.10.14</version> + <version>1.10.15</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> - <version>3.9.8</version> + <version>3.9.12</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-archiver</artifactId> - <version>3.6.2</version> + <version>3.6.6</version> </dependency> <dependency> <groupId>org.testng</groupId> @@ -382,7 +382,7 @@ <dependency> <groupId>org.ops4j.pax.url</groupId> <artifactId>pax-url-aether</artifactId> - <version>2.6.14</version> + <version>2.6.17</version> </dependency> <dependency> <groupId>org.apache.felix</groupId> @@ -398,7 +398,7 @@ <groupId>org.ops4j.pax.logging</groupId> <artifactId>pax-logging-api</artifactId> <!-- Newer versions are broken, please try osgi-adapter-test before upgrade! --> - <version>1.11.17</version> + <version>1.12.15</version> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -468,7 +468,7 @@ <dependency> <groupId>org.easymock</groupId> <artifactId>easymock</artifactId> - <version>5.3.0</version> + <version>5.6.0</version> </dependency> <dependency> <groupId>jakarta.validation</groupId> @@ -493,7 +493,7 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.14.0</version> + <version>3.20.0</version> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> @@ -577,7 +577,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.7.0</version> + <version>3.12.0</version> <configuration> <doclint>none</doclint> </configuration> @@ -585,7 +585,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> - <version>3.5.0</version> + <version>3.6.2</version> </plugin> <plugin> <groupId>com.googlecode.maven-download-plugin</groupId> @@ -600,7 +600,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.3.0</version> + <version>3.5.5</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -610,17 +610,17 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.13.0</version> + <version>3.15.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.4.2</version> + <version>3.5.0</version> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> - <version>5.1.9</version> + <version>6.0.2</version> <configuration> <instructions> <niceManifest>true</niceManifest> @@ -631,12 +631,12 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> - <version>3.13.1</version> + <version>3.15.2</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> - <version>3.6.0</version> + <version>3.6.1</version> </plugin> <plugin> <groupId>org.glassfish.hk2</groupId> @@ -649,12 +649,12 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> - <version>3.1.0</version> + <version>3.2.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.7.1</version> + <version>3.10.0</version> </plugin> <plugin> <groupId>org.glassfish.hk2</groupId> @@ -677,12 +677,12 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <version>3.6.0</version> + <version>3.6.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> - <version>3.1.2</version> + <version>3.1.4</version> <configuration> <retryFailedDeploymentCount>10</retryFailedDeploymentCount> </configuration> @@ -690,7 +690,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> - <version>3.3.1</version> + <version>3.4.0</version> <configuration> <includePom>true</includePom> </configuration> @@ -698,7 +698,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> - <version>3.12.1</version> + <version>3.21.0</version> <configuration> <skip>true</skip> <skipDeploy>true</skipDeploy> @@ -707,7 +707,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> - <version>3.1.0</version> + <version>3.3.1</version> <configuration> <mavenExecutorId>forked-path</mavenExecutorId> <useReleaseProfile>false</useReleaseProfile> @@ -720,7 +720,7 @@ <dependency> <groupId>org.apache.maven.scm</groupId> <artifactId>maven-scm-provider-gitexe</artifactId> - <version>2.1.0</version> + <version>2.2.1</version> </dependency> </dependencies> </plugin> @@ -759,7 +759,7 @@ </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> - <version>3.1.2</version> + <version>3.1.4</version> </plugin> </plugins> </pluginManagement> @@ -777,6 +777,7 @@ <artifactId>maven-compiler-plugin</artifactId> <configuration> <release>11</release> + <compilerArgument>-proc:full</compilerArgument> </configuration> </plugin> <plugin> @@ -876,6 +877,16 @@ <profiles> <profile> + <id>securitymanager</id> + <activation> + <jdk>(,23]</jdk> + </activation> + <properties> + <activate.securitymanager>-Djava.security.manager</activate.securitymanager> + </properties> + </profile> + + <profile> <id>jacoco</id> <build> <plugins> @@ -896,14 +907,14 @@ <dependency> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.12</version> + <version>0.8.14</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.12</version> + <version>0.8.14</version> <executions> <!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when Maven the Surefire plugin is executed. --> @@ -940,4 +951,4 @@ </build> </profile> </profiles> -</project> +</project> \ No newline at end of file
diff --git a/spring-bridge/pom.xml b/spring-bridge/pom.xml index 855d557..4322f82 100644 --- a/spring-bridge/pom.xml +++ b/spring-bridge/pom.xml
@@ -24,7 +24,7 @@ <parent> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>3.1.2-SNAPSHOT</version> </parent> <groupId>org.glassfish.hk2</groupId>