Skip to content

Commit 4ede583

Browse files
authored
Merge pull request scala#9677 from SethTisue/jdk17
2 parents 39c9d85 + 5d4b43e commit 4ede583

File tree

8 files changed

+23
-35
lines changed

8 files changed

+23
-35
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ templates: # this has no effect on travis, it's just a place to put our template
1212
pr-jdk8: &pr-jdk8
1313
if: type = pull_request OR repo != scala/scala
1414

15-
cron-jdk16: &cron-jdk16
15+
cron-jdk17: &cron-jdk17
1616
if: type = cron AND repo = scala/scala
17-
env: ADOPTOPENJDK=16
17+
env: ADOPTOPENJDK=17
1818

1919
build-for-testing: &build-for-testing
2020
# pull request validation (w/ bootstrap)
@@ -97,13 +97,13 @@ jobs:
9797
<<: *pr-jdk8
9898

9999
- <<: *build-for-testing
100-
<<: *cron-jdk16
100+
<<: *cron-jdk17
101101

102102
- <<: *test1
103-
<<: *cron-jdk16
103+
<<: *cron-jdk17
104104

105105
- <<: *test2
106-
<<: *cron-jdk16
106+
<<: *cron-jdk17
107107

108108
- stage: test
109109
name: build library with Scala 3

build.sbt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ lazy val fatalWarningsSettings = Seq(
232232
if (fatalWarnings.value) Seq("-Werror")
233233
else Nil
234234
},
235+
Compile / javacOptions ++= {
236+
if (fatalWarnings.value) Seq("-Werror")
237+
else Nil
238+
},
235239
Compile / doc / scalacOptions -= "-Werror", // there are too many doc errors to enable this right now
236240
)
237241

src/library/scala/runtime/ModuleSerializationProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
package scala.runtime;
1414

1515
import java.io.Serializable;
16-
import java.security.AccessController;
1716
import java.security.PrivilegedActionException;
1817
import java.security.PrivilegedExceptionAction;
1918
import java.util.HashSet;
@@ -25,9 +24,10 @@ public final class ModuleSerializationProxy implements Serializable {
2524
private final Class<?> moduleClass;
2625
private static final ClassValue<Object> instances = new ClassValue<Object>() {
2726
@Override
27+
@SuppressWarnings("removal") // JDK 17 deprecates AccessController
2828
protected Object computeValue(Class<?> type) {
2929
try {
30-
return AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () -> type.getField("MODULE$").get(null));
30+
return java.security.AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () -> type.getField("MODULE$").get(null));
3131
} catch (PrivilegedActionException e) {
3232
return rethrowRuntime(e.getCause());
3333
}

src/partest/scala/tools/partest/SecurityTest.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/partest/scala/tools/partest/nest/DelegatingSecurityManager.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.io.FileDescriptor
1616
import java.net.InetAddress
1717
import java.security.Permission
1818

19+
@deprecated("JDK 17 deprecates SecurityManager", since="2.13.7")
1920
class DelegatingSecurityManager(delegate: SecurityManager) extends SecurityManager {
2021
override def checkExit(status: Int): Unit = if (delegate ne null) delegate.checkExit(status)
2122
override def checkPermission(perm: Permission): Unit = if (delegate ne null) delegate.checkPermission(perm)

src/partest/scala/tools/partest/nest/Runner.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import java.lang.reflect.InvocationTargetException
1818
import java.nio.charset.Charset
1919
import java.nio.file.{Files, StandardOpenOption}
2020

21+
import scala.annotation.nowarn
2122
import scala.collection.mutable.ListBuffer
2223
import scala.concurrent.duration.Duration
2324
import scala.reflect.internal.FatalError
@@ -258,7 +259,10 @@ class Runner(val testInfo: TestInfo, val suiteRunner: AbstractRunner) {
258259

259260
pushTranscript(s"<in process execution of $testIdent> > ${logFile.getName}")
260261

261-
TrapExit(() => run()) match {
262+
@nowarn("cat=deprecation") // JDK 17 deprecates SecurityManager, so TrapExit is deprecated too
263+
val trapExit = TrapExit
264+
265+
trapExit(() => run()) match {
262266
case Left((status, throwable)) if status != 0 =>
263267
genFail("non-zero exit code")
264268
case _ =>

src/partest/scala/tools/partest/nest/TrapExit.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
package scala.tools.partest.nest
1414

15+
@deprecated("JDK 17 deprecates SecurityManager", since="2.13.7")
1516
object TrapExit {
1617

1718
private class TrapExitThrowable(val status: Int) extends Throwable {

test/files/run/t2318.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import java.security._
55

66
import scala.language.reflectiveCalls
77

8+
// SecurityManager is deprecated on JDK 17, so we sprinkle `@deprecated` around
9+
810
object Test {
911
trait Bar { def bar: Unit }
1012

13+
@deprecated
1114
object Mgr extends SecurityManager {
1215
def allowedProperty(name: String) =
1316
name == "sun.net.inetaddr.ttl" ||
@@ -29,6 +32,7 @@ object Test {
2932
def doDestroy( obj : Destroyable ) : Unit = obj.destroy();
3033
doDestroy( p );
3134
}
35+
@deprecated
3236
def t2() = {
3337
System.setSecurityManager(Mgr)
3438

@@ -44,6 +48,6 @@ object Test {
4448
try t1()
4549
catch { case _: java.io.IOException => () }
4650

47-
t2()
51+
t2(): @annotation.nowarn("cat=deprecation")
4852
}
4953
}

0 commit comments

Comments
 (0)