diff options
author | Lex Spoon <lex@lexspoon.org> | 2006-08-24 13:39:26 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2006-08-24 13:39:26 +0000 |
commit | 8a4c664b3306fabf349e0daac1c8845574ff1a21 (patch) | |
tree | 08492f62280390e73f98559c26d7bcf595ef3e46 | |
parent | 30da384983c321d42be95d7770a24d8e21f04a74 (diff) | |
download | scala-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
-rw-r--r-- | src/compiler/scala/tools/nsc/ObjectRunner.scala | 2 |
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) } |