Skip to content

get some compiler code to compile on JDK 17 #13174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions compiler/src/dotty/tools/dotc/config/WrappedProperties.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package dotty.tools
package dotc
package config

import java.security.AccessControlException

/** For placing a wrapper function around property functions.
* Motivated by places like google app engine throwing exceptions
* on property lookups.
Expand All @@ -29,6 +27,14 @@ trait WrappedProperties extends PropertiesTrait {

object WrappedProperties {
object AccessControl extends WrappedProperties {
def wrap[T](body: => T): Option[T] = try Some(body) catch { case _: AccessControlException => None }
def wrap[T](body: => T): Option[T] =
try Some(body)
catch {
// the actual exception we are concerned with is AccessControlException,
// but that's deprecated on JDK 17, so catching its superclass is a convenient
// way to avoid a deprecation warning
case _: SecurityException =>
None
}
}
}