summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2012-10-08 03:45:26 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2012-10-12 17:18:42 +0200
commit18c6d58a5dc994ce19b0419c7c2dce460acecbdd (patch)
treeb2a909bdca9e376a636907aca821435d5b101f8b
parent3b73e0dd101aade6478517016df80975e6b996bd (diff)
downloadscala-18c6d58a5dc994ce19b0419c7c2dce460acecbdd.tar.gz
scala-18c6d58a5dc994ce19b0419c7c2dce460acecbdd.tar.bz2
scala-18c6d58a5dc994ce19b0419c7c2dce460acecbdd.zip
SI-6388 Remove Application
-rw-r--r--src/library/scala/Application.scala79
-rw-r--r--test/disabled/run/t4146.scala (renamed from test/files/run/t4146.scala)2
-rw-r--r--test/files/jvm/t1342/SI.scala2
-rw-r--r--test/files/jvm/t2163/t2163.java (renamed from test/files/jvm/ticket2163/ticket2163.java)4
-rw-r--r--test/files/jvm/t2163/t2163.scala5
-rw-r--r--test/files/jvm/t2570/Test.scala2
-rw-r--r--test/files/jvm/t3415/HelloWorld.scala2
-rw-r--r--test/files/jvm/t4283/AbstractFoo.java (renamed from test/files/jvm/ticket4283/AbstractFoo.java)0
-rw-r--r--test/files/jvm/t4283/ScalaBipp.scala (renamed from test/files/jvm/ticket4283/ScalaBipp.scala)0
-rw-r--r--test/files/jvm/t4283/Test.scala (renamed from test/files/jvm/ticket4283/Test.scala)0
-rw-r--r--test/files/jvm/ticket2163/ticket2163.scala5
-rw-r--r--test/files/pos/chang/Test.scala2
-rw-r--r--test/files/pos/liftcode_polymorphic.scala2
-rw-r--r--test/files/pos/t1230/S.scala2
-rw-r--r--test/files/pos/t1231/S.scala2
-rw-r--r--test/files/pos/t715/meredith_1.scala58
-rw-r--r--test/files/pos/t715/runner_2.scala2
-rw-r--r--test/files/run/collection-stacks.scala2
-rw-r--r--test/files/run/t4047.scala2
19 files changed, 47 insertions, 126 deletions
diff --git a/src/library/scala/Application.scala b/src/library/scala/Application.scala
deleted file mode 100644
index 5b1098bd72..0000000000
--- a/src/library/scala/Application.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala
-
-import scala.compat.Platform.currentTime
-
-/** The `Application` trait can be used to quickly turn objects
- * into executable programs, but is ''not recommended''.
- * Here is an example:
- * {{{
- * object Main extends Application {
- * Console.println("Hello World!")
- * }
- * }}}
- * Here, object `Main` inherits the `main` method of `Application`.
- * The body of the `Main` object defines the main program. This technique
- * does not work if the main program depends on command-line arguments
- * (which are not accessible with the technique presented here).
- *
- * It is possible to time the execution of objects that inherit from class
- * `Application` by setting the global `scala.time`
- * property. Here is an example for benchmarking object `Main`:
- * {{{
- * java -Dscala.time Main
- * }}}
- * In practice the `Application` trait has a number of serious pitfalls:
- *
- * - Threaded code that references the object will block until static
- * initialization is complete. However, because the entire execution
- * of an `object` extending `Application` takes place during
- * static initialization, concurrent code will ''always'' deadlock if
- * it must synchronize with the enclosing object.
- * - As described above, there is no way to obtain the
- * command-line arguments because all code in body of an `object`
- * extending `Application` is run as part of the static initialization
- * which occurs before `Application`'s `main` method
- * even begins execution.
- * - Static initializers are run only once during program execution, and
- * JVM authors usually assume their execution to be relatively short.
- * Therefore, certain JVM configurations may become confused, or simply
- * fail to optimize or JIT the code in the body of an `object` extending
- * `Application`. This can lead to a significant performance degradation.
- *
- * It is recommended to use the [[scala.App]] trait instead.
- * {{{
- * object Main {
- * def main(args: Array[String]) {
- * //..
- * }
- * }
- * }}}
- *
- * @author Matthias Zenger
- * @version 1.0, 10/09/2003
- */
-@deprecated("use App instead", "2.9.0")
-trait Application {
-
- /** The time when the execution of this program started,
- * in milliseconds since 1 January 1970 UTC. */
- val executionStart: Long = currentTime
-
- /** The default main method.
- *
- * @param args the arguments passed to the main method
- */
- def main(args: Array[String]) {
- if (util.Properties propIsSet "scala.time") {
- val total = currentTime - executionStart
- Console.println("[total " + total + "ms]")
- }
- }
-}
diff --git a/test/files/run/t4146.scala b/test/disabled/run/t4146.scala
index 93ce22b519..a17de50ee1 100644
--- a/test/files/run/t4146.scala
+++ b/test/disabled/run/t4146.scala
@@ -1,4 +1,4 @@
-object bob extends Application {
+object bob extends App {
var name = "Bob"
}
diff --git a/test/files/jvm/t1342/SI.scala b/test/files/jvm/t1342/SI.scala
index 8e3b753210..7c37d4bcd7 100644
--- a/test/files/jvm/t1342/SI.scala
+++ b/test/files/jvm/t1342/SI.scala
@@ -4,7 +4,7 @@ class SI extends JI {
}
}
-object Test extends Application {
+object Test extends App {
val x: JI = new SI
x.varArgsMethod("one", "two")
}
diff --git a/test/files/jvm/ticket2163/ticket2163.java b/test/files/jvm/t2163/t2163.java
index b6511d241c..83bd37d212 100644
--- a/test/files/jvm/ticket2163/ticket2163.java
+++ b/test/files/jvm/t2163/t2163.java
@@ -1,9 +1,9 @@
import java.util.*;
-public class ticket2163 {
+public class t2163 {
public void test() {
List<Integer> array = new ArrayList<Integer>();
- Ticket2163Scala<List> foo = new Ticket2163Scala<List>(array);
+ T2163Scala<List> foo = new T2163Scala<List>(array);
foo.bar(array);
}
}
diff --git a/test/files/jvm/t2163/t2163.scala b/test/files/jvm/t2163/t2163.scala
new file mode 100644
index 0000000000..f73b520cbe
--- /dev/null
+++ b/test/files/jvm/t2163/t2163.scala
@@ -0,0 +1,5 @@
+class T2163Scala[CC[X]](x: CC[Int]) {
+ def bar[DD[X]](meh: DD[Int]): CC[Int] = x
+}
+
+object Test extends App {}
diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala
index 7944aedae6..f1cba53546 100644
--- a/test/files/jvm/t2570/Test.scala
+++ b/test/files/jvm/t2570/Test.scala
@@ -1,3 +1,3 @@
class Test2 extends Test1[Test3[Test4]]
class Test4
-object Test extends Application {} \ No newline at end of file
+object Test extends App {} \ No newline at end of file
diff --git a/test/files/jvm/t3415/HelloWorld.scala b/test/files/jvm/t3415/HelloWorld.scala
index 53bf55e444..5ef012390e 100644
--- a/test/files/jvm/t3415/HelloWorld.scala
+++ b/test/files/jvm/t3415/HelloWorld.scala
@@ -1,4 +1,4 @@
-object Test extends Application {
+object Test extends App {
@Hello
def foo() { }
}
diff --git a/test/files/jvm/ticket4283/AbstractFoo.java b/test/files/jvm/t4283/AbstractFoo.java
index 74f3827fe3..74f3827fe3 100644
--- a/test/files/jvm/ticket4283/AbstractFoo.java
+++ b/test/files/jvm/t4283/AbstractFoo.java
diff --git a/test/files/jvm/ticket4283/ScalaBipp.scala b/test/files/jvm/t4283/ScalaBipp.scala
index 36dea9f4de..36dea9f4de 100644
--- a/test/files/jvm/ticket4283/ScalaBipp.scala
+++ b/test/files/jvm/t4283/ScalaBipp.scala
diff --git a/test/files/jvm/ticket4283/Test.scala b/test/files/jvm/t4283/Test.scala
index 9bbfaab928..9bbfaab928 100644
--- a/test/files/jvm/ticket4283/Test.scala
+++ b/test/files/jvm/t4283/Test.scala
diff --git a/test/files/jvm/ticket2163/ticket2163.scala b/test/files/jvm/ticket2163/ticket2163.scala
deleted file mode 100644
index d30bfe251b..0000000000
--- a/test/files/jvm/ticket2163/ticket2163.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-class Ticket2163Scala[CC[X]](x: CC[Int]) {
- def bar[DD[X]](meh: DD[Int]): CC[Int] = x
-}
-
-object Test extends Application {}
diff --git a/test/files/pos/chang/Test.scala b/test/files/pos/chang/Test.scala
index 9bb745e377..f74c6355b5 100644
--- a/test/files/pos/chang/Test.scala
+++ b/test/files/pos/chang/Test.scala
@@ -1,3 +1,3 @@
-object Test extends Application {
+object Test extends App {
new com.netgents.hello.Outer[String]
}
diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala
index 8f537d278a..249f5a0569 100644
--- a/test/files/pos/liftcode_polymorphic.scala
+++ b/test/files/pos/liftcode_polymorphic.scala
@@ -1,6 +1,6 @@
import scala.reflect.runtime.universe._
-object Append extends Application {
+object Append extends App {
def append[A](l1: List[A], l2: List[A]):List[A] =
l1 match {
diff --git a/test/files/pos/t1230/S.scala b/test/files/pos/t1230/S.scala
index f8a691b6de..530dd4b853 100644
--- a/test/files/pos/t1230/S.scala
+++ b/test/files/pos/t1230/S.scala
@@ -1 +1 @@
-object S extends Application { (new J).foo = 5 }
+object S extends App { (new J).foo = 5 }
diff --git a/test/files/pos/t1231/S.scala b/test/files/pos/t1231/S.scala
index ee08866e04..f14aa2561b 100644
--- a/test/files/pos/t1231/S.scala
+++ b/test/files/pos/t1231/S.scala
@@ -1 +1 @@
-object S extends Application { println(J.j1) }
+object S extends App { println(J.j1) }
diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala
index 8261b9881a..c28afb4a9b 100644
--- a/test/files/pos/t715/meredith_1.scala
+++ b/test/files/pos/t715/meredith_1.scala
@@ -3,7 +3,7 @@ package com.sap.dspace.model.othello;
import scala.xml._
trait XMLRenderer {
- type T <: Any {def getClass() : java.lang.Class[_]}
+ type T <: Any {def getClass(): java.lang.Class[_]}
val valueTypes =
List(
classOf[java.lang.Boolean],
@@ -14,21 +14,21 @@ trait XMLRenderer {
)
def value2XML(
- value : Object,
- field : java.lang.reflect.Field,
- pojo : T
- ) : Node = {
+ value: Object,
+ field: java.lang.reflect.Field,
+ pojo: T
+ ): Node = {
value match {
- case null => Text( "null" )
+ case null => Text("null")
case vUnmatched =>
if (value.isInstanceOf[java.lang.Boolean])
- Text( value.asInstanceOf[java.lang.Boolean].toString )
+ Text(value.asInstanceOf[java.lang.Boolean].toString)
else if (value.isInstanceOf[java.lang.Integer])
- Text( value.asInstanceOf[java.lang.Integer].toString )
+ Text(value.asInstanceOf[java.lang.Integer].toString)
else if (value.isInstanceOf[java.lang.Float])
- Text( value.asInstanceOf[java.lang.Float].toString )
+ Text(value.asInstanceOf[java.lang.Float].toString)
// else if (value.isInstanceOf[T])
- // pojo2XML( value.asInstanceOf[T] )
+ // pojo2XML(value.asInstanceOf[T])
else
<unmatchedType>
<theType>
@@ -42,16 +42,16 @@ trait XMLRenderer {
}
def field2XML(
- field : java.lang.reflect.Field,
- pojo : T
- ) : Elem = {
+ field: java.lang.reflect.Field,
+ pojo: T
+ ): Elem = {
- val accessible = field.isAccessible;
- field.setAccessible( true );
+ val accessible = field.isAccessible
+ field.setAccessible(true)
// BUGBUG lgm need to disambiguate on type and possibly make
// recursive call to pojo2XML
- val fldValXML = value2XML( field.get( pojo ), field, pojo );
- field.setAccessible( accessible );
+ val fldValXML = value2XML(field.get( pojo ), field, pojo)
+ field.setAccessible( accessible )
Elem(
null,
@@ -62,37 +62,37 @@ trait XMLRenderer {
)
}
- def pojo2XML( pojo : T ) : Elem = {
+ def pojo2XML(pojo: T): Elem = {
val progeny =
for (field <- pojo.getClass.getDeclaredFields)
- yield field2XML( field, pojo );
+ yield field2XML(field, pojo)
Elem(
null,
pojo.getClass.getName,
null,
TopScope,
- progeny.asInstanceOf[Array[scala.xml.Node]] : _*
+ progeny.asInstanceOf[Array[scala.xml.Node]]: _*
)
}
}
-case class POJO2XMLRenderer( recurse : Boolean )
+case class POJO2XMLRenderer(recurse: Boolean)
extends XMLRenderer {
type T = java.io.Serializable
override def value2XML(
- value : Object,
- field : java.lang.reflect.Field,
- pojo : java.io.Serializable
- ) : Node = {
- if (recurse) super.value2XML( value, field, pojo )
- else Text( value + "" )
+ value: Object,
+ field: java.lang.reflect.Field,
+ pojo: java.io.Serializable
+ ): Node = {
+ if (recurse) super.value2XML(value, field, pojo)
+ else Text(value + "")
}
}
-object thePOJO2XMLRenderer extends POJO2XMLRenderer( true ) {
+object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) {
}
-object Test extends Application {
+object Test extends App {
println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
}
diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala
index 1e4f40d654..d54805629a 100644
--- a/test/files/pos/t715/runner_2.scala
+++ b/test/files/pos/t715/runner_2.scala
@@ -1,3 +1,3 @@
-object Test extends Application {
+object Test extends App {
println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
}
diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala
index fbee3f8594..be9fbbf1ae 100644
--- a/test/files/run/collection-stacks.scala
+++ b/test/files/run/collection-stacks.scala
@@ -1,6 +1,6 @@
import scala.collection.{ immutable, mutable }
-object Test extends Application {
+object Test extends App {
def mutableStack[T](xs: T*): mutable.Stack[T] = {
val s = new mutable.Stack[T]
s.pushAll(xs)
diff --git a/test/files/run/t4047.scala b/test/files/run/t4047.scala
index cd42a8b4df..08989bd278 100644
--- a/test/files/run/t4047.scala
+++ b/test/files/run/t4047.scala
@@ -18,7 +18,7 @@ class D extends Bar[Unit]{
def foo = println("Unit: called D.foo")
}
-object Test extends Application {
+object Test extends App {
val a: Foo[Unit] = new A
a.foo
a.foo