Skip to content

Commit b536780

Browse files
committed
Enable boot delegation in OSGi reflection tests
This allows them to run under JDK10. The specific problem was resolving the `@jdk.internal.HotSpotInstrinsicCandidate` annotation on `Object.hashCode`, which happens when runtime reflection loads the class symbol for Object. Related docs: https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/pages/54263890/Configuration+Options#ConfigurationOptions-bootDelegationPackages https://ops4j1.jira.com/wiki/spaces/paxrunner/pages/11665431/Boot+delegation+packages
1 parent 64ec656 commit b536780

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def osgiTestProject(p: Project, framework: ModuleID) = p
645645
)
646646
},
647647
Keys.test in Test := (Keys.test in Test).dependsOn(packageBin in Compile).value,
648+
Keys.testOnly in Test := (Keys.testOnly in Test).dependsOn(packageBin in Compile).evaluated,
648649
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
649650
unmanagedSourceDirectories in Test := List((baseDirectory in ThisBuild).value / "test" / "osgi" / "src"),
650651
unmanagedResourceDirectories in Compile := (unmanagedSourceDirectories in Test).value,

test/osgi/src/ScalaOsgiHelper.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ trait ScalaOsgiHelper {
2020

2121
def standardOptions: Array[exam.Option] = {
2222
val bundles = (allBundleFiles map makeBundle)
23-
bundles ++ Array[exam.Option](junitBundles())
23+
bundles ++ Array[exam.Option](junitBundles(), bootDelegationPackages(
24+
"sun.*",
25+
"com.sun.*",
26+
"jdk.*"
27+
))
2428
// to change the local repo used (for some operations, but not all -- which is why I didn't bother):
2529
// systemProperty("org.ops4j.pax.url.mvn.localRepository").value(sys.props("maven.repo.local")))
2630
}

0 commit comments

Comments
 (0)