Skip to content

Commit f322a22

Browse files
authored
Merge pull request #13174 from SethTisue/jdk17
get some compiler code to compile on JDK 17
2 parents 03c3a0b + b2c93d1 commit f322a22

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

compiler/src/dotty/tools/dotc/config/WrappedProperties.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package config
44

5-
import java.security.AccessControlException
6-
75
/** For placing a wrapper function around property functions.
86
* Motivated by places like google app engine throwing exceptions
97
* on property lookups.
@@ -29,6 +27,14 @@ trait WrappedProperties extends PropertiesTrait {
2927

3028
object WrappedProperties {
3129
object AccessControl extends WrappedProperties {
32-
def wrap[T](body: => T): Option[T] = try Some(body) catch { case _: AccessControlException => None }
30+
def wrap[T](body: => T): Option[T] =
31+
try Some(body)
32+
catch {
33+
// the actual exception we are concerned with is AccessControlException,
34+
// but that's deprecated on JDK 17, so catching its superclass is a convenient
35+
// way to avoid a deprecation warning
36+
case _: SecurityException =>
37+
None
38+
}
3339
}
3440
}

0 commit comments

Comments
 (0)