Merge pull request #1166 from OndroMih/ondromih-fix-resolveContext-with-parent
Search for scope first in parent locator
diff --git a/bom/pom.xml b/bom/pom.xml
index 69d4f3d..ef27b6c 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -41,7 +41,7 @@
</scm>
<properties>
- <asm.version>9.7.1</asm.version>
+ <asm.version>9.8</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>
@@ -123,7 +123,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/examples/security-lockdown/runner/pom.xml b/examples/security-lockdown/runner/pom.xml
index c91aeb9..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
@@ -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/hk2-api/pom.xml b/hk2-api/pom.xml
index ce23fb0..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.
@@ -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-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-locator/pom.xml b/hk2-locator/pom.xml
index fd377a7..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.
@@ -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-testing/hk2-mockito/pom.xml b/hk2-testing/hk2-mockito/pom.xml
index 9341cb1..61ef414 100644
--- a/hk2-testing/hk2-mockito/pom.xml
+++ b/hk2-testing/hk2-mockito/pom.xml
@@ -90,7 +90,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>5.15.2</version>
+ <version>5.17.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/pom.xml b/pom.xml
index cca1474..6cbcaab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2022, 2024 Contributors to Eclipse Foundation. All rights reserved.
+ Copyright (c) 2022, 2025 Contributors to Eclipse Foundation.
Copyright (c) 2020, 2021 Payara Services Ltd.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
@@ -159,11 +159,11 @@
<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.1</asm.version>
+ <asm.version>9.8</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>
+ <testng.version>7.11.0</testng.version>
<assertj.version>3.27.3</assertj.version>
<pax-exam-version>4.14.0</pax-exam-version>
<jakarta-inject.version>2.0.1</jakarta-inject.version>
@@ -186,6 +186,8 @@
<release.arguments />
<manifest.location>target/classes/META-INF/MANIFEST.MF</manifest.location>
+
+ <activate.securitymanager></activate.securitymanager>
</properties>
<dependencyManagement>
@@ -278,7 +280,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.apache.ant</groupId>
@@ -598,7 +600,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.5.2</version>
+ <version>3.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -608,7 +610,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.13.0</version>
+ <version>3.14.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -680,7 +682,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>3.1.3</version>
+ <version>3.1.4</version>
<configuration>
<retryFailedDeploymentCount>10</retryFailedDeploymentCount>
</configuration>
@@ -696,7 +698,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.20.0</version>
+ <version>3.21.0</version>
<configuration>
<skip>true</skip>
<skipDeploy>true</skipDeploy>
@@ -757,7 +759,7 @@
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
- <version>3.1.3</version>
+ <version>3.1.4</version>
</plugin>
</plugins>
</pluginManagement>
@@ -775,6 +777,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>11</release>
+ <compilerArgument>-proc:full</compilerArgument>
</configuration>
</plugin>
<plugin>
@@ -783,6 +786,7 @@
<configuration>
<systemPropertyVariables>
<java.util.logging.config.file>logging.properties</java.util.logging.config.file>
+ <net.bytebuddy.experimental>true</net.bytebuddy.experimental>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -872,6 +876,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>
@@ -892,14 +906,14 @@
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.12</version>
+ <version>0.8.13</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.12</version>
+ <version>0.8.13</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed. -->