summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ObjectRunner.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2006-08-24 13:39:26 +0000
committerLex Spoon <lex@lexspoon.org>2006-08-24 13:39:26 +0000
commit8a4c664b3306fabf349e0daac1c8845574ff1a21 (patch)
tree08492f62280390e73f98559c26d7bcf595ef3e46 /src/compiler/scala/tools/nsc/ObjectRunner.scala
parent30da384983c321d42be95d7770a24d8e21f04a74 (diff)
downloadscala-8a4c664b3306fabf349e0daac1c8845574ff1a21.tar.gz
scala-8a4c664b3306fabf349e0daac1c8845574ff1a21.tar.bz2
scala-8a4c664b3306fabf349e0daac1c8845574ff1a21.zip
test that the main method is static, and throw ...
test that the main method is static, and throw NoSuchMethodError if not
Diffstat (limited to 'src/compiler/scala/tools/nsc/ObjectRunner.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ObjectRunner.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala
index 6ff96fa74a..e1f02d1378 100644
--- a/src/compiler/scala/tools/nsc/ObjectRunner.scala
+++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala
@@ -49,6 +49,8 @@ object ObjectRunner {
}
val method = clsToRun.getMethod("main", List(classOf[Array[String]]).toArray)
+ if((method.getModifiers & Modifier.STATIC) == 0)
+ throw new NoSuchMethodException(objectName + ".main is not static")
method.invoke(null, List(arguments.toArray).toArray)
}