summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-06-22 22:46:37 +0000
committerPaul Phillips <paulp@improving.org>2011-06-22 22:46:37 +0000
commit781726bf7532b48de19c31c3359ab39d8f30899a (patch)
tree4eeea4d61da05ea069357b860af6b4926ccfa413 /src
parent066ab070e6715abd5fcec5acd54ffa35c26c8467 (diff)
downloadscala-781726bf7532b48de19c31c3359ab39d8f30899a.tar.gz
scala-781726bf7532b48de19c31c3359ab39d8f30899a.tar.bz2
scala-781726bf7532b48de19c31c3359ab39d8f30899a.zip
New theory: fails running on java 1.5.
truth of theory. No review.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Properties.scala3
-rw-r--r--src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
3 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
}