File tree 1 file changed +3
-12
lines changed
presentation-compiler/test/dotty/tools/pc/utils
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,11 @@ package dotty.tools.pc.utils
3
3
object JRE :
4
4
5
5
def getJavaMajorVersion : Int =
6
- val javaVersion = sys.env.get(" java.version" ).filter(! _.isEmpty())
6
+ val javaVersion = sys.env.get(" java.specification. version" ).filter(! _.isEmpty())
7
7
8
8
javaVersion match
9
9
case Some (version) if version.startsWith(" 1.8" ) => 8
10
- case _ =>
11
- scala.util.Try :
12
- val versionMethod = classOf [Runtime ].getMethod(" version" )
13
- versionMethod.nn.setAccessible(true )
14
- val version = versionMethod.nn.invoke(null )
15
-
16
- val majorMethod = version.getClass().getMethod(" feature" )
17
- majorMethod.nn.setAccessible(true )
18
- val major = majorMethod.nn.invoke(version).asInstanceOf [Int ]
19
- major
20
- .getOrElse(8 ) // Minimal version supported by Scala
10
+ case Some (version) => version
11
+ case None => 8
21
12
22
13
You can’t perform that action at this time.
0 commit comments