Skip to content

Commit fbb7794

Browse files
committed
fix t2318 on JDK 17
backports one piece of scala#9677 fixes scala/scala-dev#790
1 parent 29b30fd commit fbb7794

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/files/run/t2318.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import java.security._
44

55
import scala.language.reflectiveCalls
66

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

12+
@deprecated
1013
object Mgr extends SecurityManager {
1114
override def checkPermission(perm: Permission) = perm match {
1215
case _: java.lang.RuntimePermission => ()
@@ -24,6 +27,7 @@ object Test {
2427
def doDestroy( obj : Destroyable ) : Unit = obj.destroy();
2528
doDestroy( p );
2629
}
30+
@deprecated
2731
def t2() = {
2832
System.setSecurityManager(Mgr)
2933

@@ -34,11 +38,11 @@ object Test {
3438
structural.bar
3539
}
3640

37-
def main(args: Array[String]) {
41+
def main(args: Array[String]): Unit = {
3842
// figuring this will otherwise break on windows
3943
try t1()
4044
catch { case _: java.io.IOException => () }
4145

42-
t2()
46+
t2(): @annotation.nowarn("cat=deprecation")
4347
}
4448
}

0 commit comments

Comments
 (0)