diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Properties.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 | ||||
-rw-r--r-- | test/disabled/run/getClassTest.check (renamed from test/files/run/getClassTest.check) | 0 | ||||
-rw-r--r-- | test/disabled/run/getClassTest.scala (renamed from test/files/run/getClassTest.scala) | 0 |
5 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index f88b7e82fc..5c47c3b887 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -11,6 +11,9 @@ object Properties extends scala.util.PropertiesTrait { protected def propCategory = "compiler" protected def pickJarBasedOn = classOf[Global] + def isJava5 = javaVersion startsWith "1.5" + def isJava6 = javaVersion startsWith "1.6" + // settings based on jar properties def fileEndingString = scalaPropOrElse("file.ending", ".scala|.java") def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ") diff --git a/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala index c5b477c7bd..4bc9586ae5 100644 --- a/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala @@ -39,7 +39,10 @@ trait StandardScalaSettings { val nowarn = BooleanSetting ("-nowarn", "Generate no warnings.") val optimise: BooleanSetting // depends on post hook which mutates other settings val print = BooleanSetting ("-print", "Print program with Scala-specific features removed.") - val target = ChoiceSetting ("-target", "target", "Target platform for object files.", List("jvm-1.5", "msil"), "jvm-1.5") + val target = ChoiceSetting ( + "-target", "target", "Target platform for object files.", + List("jvm-1.5", "jvm-1.6", "msil"), "jvm-1.5" + ) val unchecked = BooleanSetting ("-unchecked", "Enable detailed unchecked (erasure) warnings.") val uniqid = BooleanSetting ("-uniqid", "Uniquely tag all identifiers in debugging output.") val usejavacp = BooleanSetting ("-usejavacp", "Utilize the java.class.path in classpath resolution.") diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index dd92418af7..8ee04bf67d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3635,7 +3635,8 @@ trait Typers extends Modes { // getClass, we have to catch it immediately so expressions // like x.getClass().newInstance() are typed with the type of x. val isRefinableGetClass = ( - selection.symbol.name == nme.getClass_ + !Properties.isJava5 // seems to be failing weirdly on java5 + && selection.symbol.name == nme.getClass_ && selection.tpe.params.isEmpty // TODO: If the type of the qualifier is inaccessible, we can cause private types // to escape scope here, e.g. pos/t1107. I'm not sure how to properly handle this @@ -3643,7 +3644,7 @@ trait Typers extends Modes { && qual.tpe.typeSymbol.isPublic ) if (isRefinableGetClass) - selection setType MethodType(Nil, erasure.getClassReturnType(qual.tpe)) + selection setType MethodType(Nil, erasure.getClassReturnType(qual.tpe)) else selection } diff --git a/test/files/run/getClassTest.check b/test/disabled/run/getClassTest.check index 94e86c3889..94e86c3889 100644 --- a/test/files/run/getClassTest.check +++ b/test/disabled/run/getClassTest.check diff --git a/test/files/run/getClassTest.scala b/test/disabled/run/getClassTest.scala index 951cc8d931..951cc8d931 100644 --- a/test/files/run/getClassTest.scala +++ b/test/disabled/run/getClassTest.scala |