File tree 1 file changed +10
-3
lines changed
compiler/src/dotty/tools/dotc/config
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,16 @@ object PathResolver {
36
36
/** Values found solely by inspecting environment or property variables.
37
37
*/
38
38
object Environment {
39
- private def searchForBootClasspath = (
40
- systemProperties find (_._1 endsWith " .boot.class.path" ) map (_._2) getOrElse " "
41
- )
39
+ private def searchForBootClasspath = {
40
+ import scala .jdk .CollectionConverters .*
41
+ val props = System .getProperties
42
+ // This formulation should be immune to ConcurrentModificationExceptions when system properties
43
+ // we're unlucky enough to witness a partially published result of System.setProperty or direct
44
+ // mutation of the System property map. stringPropertyNames internally uses the Enumeration interface,
45
+ // rather than Iterator, and this disables the fail-fast ConcurrentModificationException.
46
+ val propNames = props.stringPropertyNames()
47
+ propNames.asScala collectFirst { case k if k endsWith " .boot.class.path" => props.getProperty(k) } getOrElse " "
48
+ }
42
49
43
50
/** Environment variables which java pays attention to so it
44
51
* seems we do as well.
You can’t perform that action at this time.
0 commit comments