diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-14 10:28:22 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-14 10:28:22 -0800 |
commit | e14917528e1c080a7f10785e21de36f3a7769718 (patch) | |
tree | 71ae6a0805b2922f26a2eb1411b546e38fc2eb3d | |
parent | 22ed6d493b676e28c324d77a1e31f39672f2a9e1 (diff) | |
parent | d5ee322b733f106dba91c045790ad33f3ce4f1bc (diff) | |
download | scala-e14917528e1c080a7f10785e21de36f3a7769718.tar.gz scala-e14917528e1c080a7f10785e21de36f3a7769718.tar.bz2 scala-e14917528e1c080a7f10785e21de36f3a7769718.zip |
Merge pull request #1765 from paulp/pr/remove-detach
Removing more of that which merits removal
88 files changed, 0 insertions, 4575 deletions
diff --git a/build.detach.xml b/build.detach.xml deleted file mode 100644 index 03360e36d5..0000000000 --- a/build.detach.xml +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<project name="sabbus" default="build"> - - <description> -SuperSabbus for Scala detach plugin. - </description> - - <echo level="info" message="Running SABBUS for ${ant.project.name}..."/> - -<!-- =========================================================================== -END-USER TARGETS -============================================================================ --> - - <target name="build" depends="pack.done" - description="Builds the Scala detach plugin."/> - - <target name="clean" depends="quick.clean"> - </target> - - <target name="all.clean" depends="quick.clean, pack.clean"> - </target> - -<!-- =========================================================================== -PROPERTIES -============================================================================ --> - - <property environment="env"/> - <!-- Prevents system classpath from being used --> - <property name="build.sysclasspath" value="ignore"/> - - <!-- Defines the repository layout --> - <property name="lib.dir" value="${basedir}/lib"/> - <property name="src.dir" value="${basedir}/src"/> - <property name="partest.dir" value="${basedir}/test"/> - - <!-- Loads custom properties definitions --> - <property file="${basedir}/build.properties"/> - - <!-- Sets location of build folders --> - <property name="build.dir" value="${basedir}/build"/> - <property name="build-quick.dir" value="${build.dir}/quick"/> - <property name="build-pack.dir" value="${build.dir}/pack"/> - - <!-- if ANT_OPTS is already set by the environment, it will be unaltered, - but if it is unset it will take this default value. --> - <property name="env.ANT_OPTS" value="-Xms1024M -Xmx1024M -Xss1M -XX:MaxPermSize=128M -XX:+UseParallelGC" /> - - <property - name="scalacfork.jvmargs" - value="${env.ANT_OPTS}"/> - - <property name="scalac.args.quick" value="-deprecation"/> - <property name="scalac.args.optimise" value=""/> - - <!-- Setting-up Ant contrib tasks --> - <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib.dir}/ant/ant-contrib.jar"/> - -<!-- =========================================================================== -QUICK BUILD (QUICK) -============================================================================ --> - - <target name="quick.clean"> - <delete includeemptydirs="yes" quiet="yes" failonerror="no"> - <fileset dir="${build-quick.dir}/classes/detach-library"/> - <fileset dir="${build-quick.dir}/classes/detach-plugin"/> - </delete> - </target> - - <target name="quick.done"> - <stopwatch name="quick.done.timer"/> - <path id="quick.classpath"> - <pathelement location="${build-quick.dir}/classes/library"/> - <pathelement location="${build-quick.dir}/classes/compiler"/> - <pathelement location="${lib.dir}/forkjoin.jar"/> - <pathelement location="${ant.home}/lib/ant.jar"/> - </path> - <taskdef - resource="scala/tools/ant/sabbus/antlib.xml" - classpathref="quick.classpath" - /> - <mkdir dir="${build-quick.dir}/classes/detach-plugin"/> - <scalacfork - destdir="${build-quick.dir}/classes/detach-plugin" - compilerpathref="quick.classpath" - params="${scalac.args.quick}" - srcdir="${src.dir}/detach/plugin" - jvmargs="${scalacfork.jvmargs}"> - <include name="**/*.scala"/> - <compilationpath> - <pathelement location="${build-quick.dir}/classes/library"/> - <pathelement location="${build-quick.dir}/classes/compiler"/> - <pathelement location="${build-quick.dir}/classes/detach-plugin"/> - <pathelement location="${lib.dir}/forkjoin.jar"/> - </compilationpath> - </scalacfork> - <copy - file="${src.dir}/detach/plugin/scalac-plugin.xml" - todir="${build-quick.dir}/classes/detach-plugin" - /> - <mkdir dir="${build-quick.dir}/classes/detach-library"/> - <scalacfork - destdir="${build-quick.dir}/classes/detach-library" - compilerpathref="quick.classpath" - params="${scalac.args.quick}" - srcdir="${src.dir}/detach/library" - jvmargs="${scalacfork.jvmargs}"> - <include name="**/*.scala"/> - <compilationpath> - <pathelement location="${build-quick.dir}/classes/library"/> - <pathelement location="${lib.dir}/forkjoin.jar"/> - </compilationpath> - </scalacfork> - <touch file="${build-quick.dir}/plugins.complete" verbose="no"/> - <stopwatch name="quick.done.timer" action="total"/> - </target> - -<!-- =========================================================================== -PACKED QUICK BUILD (PACK) -============================================================================ --> - - <target name="pack.start" depends="quick.done"/> - - <target name="pack.pre-lib" depends="pack.start"> - <uptodate - property="pack.lib.available" - targetfile="${build-pack.dir}/lib/scala-detach.jar" - srcfile="${build-quick.dir}/plugins.complete"/> - </target> - - <target name="pack.lib" depends="pack.pre-lib" unless="pack.lib.available"> - <mkdir dir="${build-pack.dir}/misc/scala-devel/plugins"/> - <jar destfile="${build-pack.dir}/misc/scala-devel/plugins/detach.jar"> - <fileset dir="${build-quick.dir}/classes/detach-plugin"/> - </jar> - <mkdir dir="${build-pack.dir}/lib"/> - <jar destfile="${build-pack.dir}/lib/scala-detach.jar"> - <fileset dir="${build-quick.dir}/classes/detach-library"> - <include name="scala/**"/> - </fileset> - </jar> - </target> - - <target name="pack.done" depends="pack.lib"> - <path id="pack.classpath"> - <pathelement location="${build-pack.dir}/lib/scala-library.jar"/> - <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/> - <pathelement location="${build-pack.dir}/lib/scala-detach.jar"/> - <pathelement location="${build-pack.dir}/lib/scala-partest.jar"/> - <pathelement location="${build-pack.dir}/lib/scalap.jar"/> - <pathelement location="${ant.home}/lib/ant.jar"/> - <pathelement location="${lib.dir}/jline.jar"/> - </path> - <taskdef resource="scala/tools/ant/antlib.xml" classpathref="pack.classpath"/> - <taskdef resource="scala/tools/partest/antlib.xml" classpathref="pack.classpath"/> - </target> - - <target name="pack.clean"> - <delete includeemptydirs="yes" quiet="yes" failonerror="no"> - <fileset dir="${build-pack.dir}/lib" includes="scala-detach.jar"/> - <fileset dir="${build-pack.dir}/misc/scala-devel/plugins" includes="detach.jar"/> - </delete> - </target> - -<!-- =========================================================================== -TEST SUITE -============================================================================ --> - - <target name="test.suite" depends="pack.done"> - <property name="partest.srcdir" value="files" /> - <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java" - timeout="2400000" - srcdir="${partest.srcdir}" - scalacopts="${scalac.args.optimise} -Xpluginsdir ${build-pack.dir}/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable"> - <compilationpath> - <path refid="pack.classpath"/> - <fileset dir="${partest.dir}/files/lib" includes="*.jar" /> - </compilationpath> - <negtests dir="${partest.dir}/${partest.srcdir}/detach-neg" includes="*.scala"/> - <runtests dir="${partest.dir}/${partest.srcdir}/detach-run" includes="*.scala"/> - </partest> - </target> - -</project> diff --git a/src/detach/library/scala/remoting/Channel.scala b/src/detach/library/scala/remoting/Channel.scala deleted file mode 100644 index e60d16c0d5..0000000000 --- a/src/detach/library/scala/remoting/Channel.scala +++ /dev/null @@ -1,190 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: Channel.scala 18365 2009-07-21 11:00:42Z michelou $ - -package scala.remoting - -import java.io._ -import java.net._ -import java.rmi.server.RMIClassLoader - -/** <p> - * The class <code>Channel</code> implements (basic) typed channels - * which use <a href="http://java.sun.com/docs/books/tutorial/networking/sockets/" - * target="_top"/>Java socket</a> communication and Scala type manifests to - * provide type-safe send/receive operations between a localhost and another - * remote machine by specifying some <code>host</code> and <code>port</code>. - * </p> - * - * @author Stephane Micheloud - * @version 1.1 - */ -class Channel protected (socket: Socket) { - - // Create a socket without a timeout - def this(host: String, port: Int) = this(new Socket(host, port)) - - // // Create a socket with a timeout - // val sockaddr: SocketAddress = new InetSocketAddress(addr, port) - // val socket = new Socket() - // // If the timeout occurs, SocketTimeoutException is thrown. - // socket.connect(sockaddr, 2000) // 2 seconds - - /** Returns the local address of this channel. */ - val host = socket.getInetAddress.getHostAddress - - /** Returns the port on which this channel is listening. */ - val port = socket.getLocalPort - - private var cl: ClassLoader = - try { - // requires permission in Java policy file - val codebase = System.getProperty("java.rmi.server.codebase") - if (codebase != null) info("codebase="+codebase) - RMIClassLoader.getClassLoader(codebase) - } - catch { - case e: Exception => - sys.error("Class loader undefined: " + e.getMessage) - null - } - def classLoader: ClassLoader = cl - def classLoader_=(x: ClassLoader) { cl = x } - - info(""+this) - - private class CustomObjectInputStream(in: InputStream) - extends ObjectInputStream(in) { - override def resolveClass(desc: ObjectStreamClass): Class[_] = - if (cl eq null) - super.resolveClass(desc) - else - try { - info("resolve class "+desc.getName) - cl loadClass desc.getName - } - catch { - case e: ClassNotFoundException => - super.resolveClass(desc) - } - } - - // lazy modifier is required! - private lazy val in = - try { - new CustomObjectInputStream(socket.getInputStream) - } - catch { - case e: IOException => - sys.error("Input stream undefined: "+e.getMessage+" ("+this+")") - null - } - private lazy val out = - try { - new ObjectOutputStream(socket.getOutputStream) - } - catch { - case e: IOException => - sys.error("Output stream undefined: "+e.getMessage+" ("+this+")") - null - } - - /** <code>receive<primtype></code> methods may throw an - * <code>IOException</code>. - */ - def receiveUnit = receive[Unit] - def receiveBoolean = receive[Boolean] - def receiveByte = receive[Byte] - def receiveChar = receive[Char] - def receiveShort = receive[Short] - def receiveInt = receive[Int] - def receiveLong = receive[Long] - def receiveFloat = receive[Float] - def receiveDouble = receive[Double] - def receiveString = receive[String] - - /** <code>receive</code> method may throw either an - * <code>ClassNotFoundException</code> or an <code>IOException</code>. - * - * @throw <code>ChannelException</code> if received value has not - * the expected type. - */ - @throws(classOf[ChannelException]) - def receive[T](implicit expected: scala.reflect.ClassTag[T]): T = { - val found = in.readObject().asInstanceOf[reflect.ClassTag[_]] - info("receive: found="+found+", expected="+expected) - import scala.reflect.ClassTag - val x = found match { - case ClassTag.Unit => () - case ClassTag.Boolean => in.readBoolean() - case ClassTag.Byte => in.readByte() - case ClassTag.Char => in.readChar() - case ClassTag.Short => in.readShort() - case ClassTag.Int => in.readInt() - case ClassTag.Long => in.readLong() - case ClassTag.Float => in.readFloat() - case ClassTag.Double => in.readDouble() - case _ => in.readObject() - } - val res = if (found <:< expected) - x.asInstanceOf[T] - else - throw new ChannelException( - "\n\tfound \""+found+"\"\n\texpected \""+expected+"\"") - info("received "+res+" (available="+in.available+")") - res - } - - /** <code>?</code> method may throw either an - * <code>ClassNotFoundException</code> or an <code>IOException</code>. - */ - def ?[T](implicit t: scala.reflect.ClassTag[T]): T = receive[T](t) - - /** <code>send</code> method may throw an <code>IOException</code>. - */ - def send[T](x: T)(implicit t: scala.reflect.ClassTag[T]) { - out writeObject t - x match { - case x: Unit => // nop - case x: Boolean => out writeBoolean x - case x: Byte => out writeByte x - case x: Char => out writeChar x - case x: Short => out writeShort x - case x: Int => out writeInt x - case x: Long => out writeLong x - case x: Float => out writeFloat x - case x: Double => out writeDouble x - case x => out writeObject x - } - out.flush() - info("sent "+x) - } - - /** <code>!</code> method may throw an <code>IOException</code>. - */ - def ![T](x: T)(implicit m: scala.reflect.ClassTag[T]) { send(x)(m) } - - def close() { - try { socket.close() } - catch { case e: IOException => } - info(this+" closed") - } - - override def toString: String = socket.toString - - private def info(msg: String) { - runtime.remoting.Debug.info("[Channel] "+msg) - } -} - -/** <code>ChannelException</code> may be thrown by the operation - * <code>receive</code> when the received data has not the expected type. - */ -case class ChannelException(msg: String) extends IOException(msg) - diff --git a/src/detach/library/scala/remoting/Debug.scala b/src/detach/library/scala/remoting/Debug.scala deleted file mode 100644 index 79f2bcedde..0000000000 --- a/src/detach/library/scala/remoting/Debug.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: Debug.scala 17412 2009-03-31 10:08:25Z michelou $ - -package scala.remoting - -/** - * @author Stephane Micheloud - * @version 1.0 - */ -object Debug extends runtime.remoting.Debug { - private val f = new java.text.SimpleDateFormat("HH:mm:ss") - private val c = new java.util.GregorianCalendar - - def getTime: String = f format c.getTime - - def getLocation(obj: AnyRef): String = { - val s = obj.getClass().getClassLoader().toString() - s substring s.indexOf('[') - } -} diff --git a/src/detach/library/scala/remoting/ServerChannel.scala b/src/detach/library/scala/remoting/ServerChannel.scala deleted file mode 100644 index 7828f85a1d..0000000000 --- a/src/detach/library/scala/remoting/ServerChannel.scala +++ /dev/null @@ -1,68 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: ServerChannel.scala 18365 2009-07-21 11:00:42Z michelou $ - -package scala.remoting - -import java.net.{ServerSocket, Socket} - -/** <p> - * Creates a server channel and binds its associated socket to the - * specified port number.<br/> - * Example: - * </p><pre> - * <b>class</b> ComputeChannel(s: Socket) <b>extends</b> Channel(s) { - * <b>def</b> receiveFunc = receive[Int => Int] - * } - * <b>class</b> ComputeServer(p: Int) - * <b>extends</b> AbstractServerChannel[ComputeChannel](p) { - * <b>def</b> newChannel(s: Socket) = <b>new</b> ComputeChannel(s) - * }</pre> - * - * @author Stephane Micheloud - * @version 1.0 - */ -class ServerChannel(p: Int) extends AbstractServerChannel[Channel](p) { - def newChannel(s: Socket) = new Channel(s) -} - -abstract class AbstractServerChannel[T <: Channel](_port: Int) { - - /** Creates an input channel and binds its associated socket to any - * free port. - */ - def this() = this(0) - - // The maximum queue length for incoming requests to connect is set to 50. - private val serverSocket = new ServerSocket(_port) - - /** Returns the local address of this channel. */ - val host = serverSocket.getInetAddress.getHostAddress - - /** Returns the port on which this channel is listening. */ - val port = serverSocket.getLocalPort - info("Listening on port "+port) - - protected def newChannel(socket: Socket): T - - def accept: T = { - System.gc() // required! - newChannel(serverSocket.accept) - } - - def close() { - try { serverSocket.close() } - catch { case e: java.io.IOException => } - info("Server socket "+host+":"+port+" closed") - } - - protected def info(msg: String) { - runtime.remoting.Debug.info("[ServerChannel] "+msg) - } -} diff --git a/src/detach/library/scala/remoting/detach.scala b/src/detach/library/scala/remoting/detach.scala deleted file mode 100644 index 51a3ac515d..0000000000 --- a/src/detach/library/scala/remoting/detach.scala +++ /dev/null @@ -1,49 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: detach.scala 16901 2009-01-13 15:37:05Z michelou $ - -package scala.remoting - - -/** The <code>detach</code> object is a <em>marker object</em> which informs - * the Scala compiler that arguments whose type is a function type are - * eligible for remote closure generation. - * - * @author Stephane Micheloud - * @version 1.0, 13/07/2005 - */ -object detach { - - def apply[R](f: Function0[R]): Function0[R] = f - def apply[T0, R](f: Function1[T0, R]): Function1[T0, R] = f - def apply[T0, T1, R](f: Function2[T0, T1, R]): Function2[T0, T1, R] = f - def apply[T0, T1, T2, R](f: Function3[T0, T1, T2, R]): Function3[T0, T1, T2, R] = f - def apply[T0, T1, T2, T3, R](f: Function4[T0, T1, T2, T3, R]): Function4[T0, T1, T2, T3, R] = f - def apply[T0, T1, T2, T3, T4, R](f: Function5[T0, T1, T2, T3, T4, R]): Function5[T0, T1, T2, T3, T4, R] = f - def apply[T0, T1, T2, T3, T4, T5, R](f: Function6[T0, T1, T2, T3, T4, T5, R]): Function6[T0, T1, T2, T3, T4, T5, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, R](f: Function7[T0, T1, T2, T3, T4, T5, T6, R]): Function7[T0, T1, T2, T3, T4, T5, T6, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, R](f: Function8[T0, T1, T2, T3, T4, T5, T6, T7, R]): Function8[T0, T1, T2, T3, T4, T5, T6, T7, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, R](f: Function9[T0, T1, T2, T3, T4, T5, T6, T7, T8, R]): Function9[T0, T1, T2, T3, T4, T5, T6, T7, T8, R] = f - - // since 2.7.0 - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R](f: Function10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R]): Function10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R](f: Function11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]): Function11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R](f: Function12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R]): Function12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R](f: Function13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]): Function13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R](f: Function14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]): Function14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R](f: Function15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]): Function15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R](f: Function16[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]): Function16[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R](f: Function17[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]): Function17[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](f: Function18[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]): Function18[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R](f: Function19[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]): Function19[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R](f: Function20[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]): Function20[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R](f: Function21[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]): Function21[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R] = f - def apply[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R](f: Function22[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R]): Function22[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R] = f -} - diff --git a/src/detach/library/scala/runtime/RemoteRef.scala b/src/detach/library/scala/runtime/RemoteRef.scala deleted file mode 100644 index e65b22cb71..0000000000 --- a/src/detach/library/scala/runtime/RemoteRef.scala +++ /dev/null @@ -1,182 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteRef.scala 18365 2009-07-21 11:00:42Z michelou $ - -package scala.runtime - -import java.net.{InetAddress, MalformedURLException} -import java.rmi.{NoSuchObjectException, NotBoundException, Remote} -import java.rmi.registry.{LocateRegistry, Registry} -import java.rmi.server.{ExportException, RemoteObject, UnicastRemoteObject} - -import scala.runtime.remoting.{Debug, RemoteGC} - -/** - * - * @author Stephane Micheloud - * @version 1.0 - */ -object RemoteRef { /*extends Thread { - start() - - private class QuitException extends Exception - private var isTerminated = false - - // keeps track of live remote objects - val remoteGC = new RemoteGC - - override def run() { - info("started thread") - try { - while (!isTerminated) { - this.synchronized { - try { - wait(200) - } catch { - case _: InterruptedException => - if (isTerminated) throw new QuitException - } - remoteGC.gc() - if (remoteGC.allClosed) - throw new QuitException - } // synchronized - - } - } catch { - case _: QuitException => - // allow thread to exit - } - } -*/ - try { - val prop = System.getProperty("sun.rmi.dgc.server.gcInterval") - if (prop eq null) - System.setProperty("sun.rmi.dgc.server.gcInterval", "10000") - } - catch { - case e => - error(e.getMessage) - } - - private val host = - try { - val prop = System.getProperty("java.rmi.server.hostname") - if (prop ne null) prop else InetAddress.getLocalHost.getHostAddress - } - catch { - case e => - warning(e.getMessage) - InetAddress.getLocalHost.getHostAddress - } - - private val port = - try { - val prop = System.getProperty("scala.remoting.port") - if (prop ne null) prop.toInt else Registry.REGISTRY_PORT - } - catch { - case e => - warning(e.getMessage) - Registry.REGISTRY_PORT // default port - } - - private val registry = - try { - LocateRegistry.createRegistry(port) - } - catch { - case e => - warning(e.getMessage) - LocateRegistry.getRegistry(host, port) - } - - private val prefix = "//"+host+":"+port+"/" - printDebugInfos - - // Variant 1: rebind/unbind - def bind(name: String, x: Remote): Remote = - try { - registry.rebind(prefix+name, x) - info("\""+prefix+name+"\" bound") - val stub = RemoteObject.toStub(x) - //remoteGC.newRef(stub) - stub - } catch { - case e: MalformedURLException => - error(e.getMessage); null - case e: ExportException => - info(""+e); null - case e: Exception => // AlreadyBoundException, etc.. - throw e - } - - def unbind(name: String) = - try { - registry.unbind(prefix+name) - info("\""+name+"\" unbound") - } catch { - case e: java.io.EOFException => - warning(e.getMessage) - case e: NotBoundException => - warning(e.getMessage+" already unbound") - case e: MalformedURLException => - error(e.getMessage) - case e: Exception => - throw e - } -/* - // Variant 2: un-/exportObject - def bind(name: String, x: Remote): Remote = - try { - val ex = UnicastRemoteObject.exportObject(x) - registry.rebind(prefix+name, ex) - info("\""+prefix+name+"\" bound") - //val stub = RemoteObject.toStub(ex) - //remoteGC.newRef(ex) - ex //stub - } catch { - case e: MalformedURLException => - error(e.getMessage); null - case e: ExportException => - info(""+e); null - case e: Exception => // AlreadyBoundException, etc.. - throw e - } - - def unbind(x: Remote) { - try { - UnicastRemoteObject.unexportObject(x, false) - info("\""+x+"\" unbound") - } catch { - case e: java.io.EOFException => - warning(e.getMessage) - case e: NotBoundException => - warning(e.getMessage+" already unbound") - case e: MalformedURLException => - error(e.getMessage) - case e: Exception => - throw e - } - } -*/ - private def info(msg: String) { Debug.info("[RemoteRef] "+msg) } - private def warning(msg: String) { Debug.warning("[RemoteRef] "+msg) } - private def error(msg: String) { Debug.error("[RemoteRef] "+msg) } - - private def printDebugInfos() { - def property(name: String): String = - name+"="+( - try { System.getProperty(name, "") } - catch { case e => warning(e.getMessage); "?" }) - info(property("java.rmi.server.hostname")) - info(property("sun.rmi.dgc.server.gcInterval")) - info("registry="+registry) - info("prefix="+prefix) - } -} diff --git a/src/detach/library/scala/runtime/remoting/Debug.scala b/src/detach/library/scala/runtime/remoting/Debug.scala deleted file mode 100644 index 06cdc67997..0000000000 --- a/src/detach/library/scala/runtime/remoting/Debug.scala +++ /dev/null @@ -1,85 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: Debug.scala 17777 2009-05-19 18:16:25Z michelou $ - -package scala.runtime.remoting - -/** - * @author Stephane Micheloud - * @version 1.0 - */ -object Debug extends Debug { - override def info (msg: String) { if (lib) super.info(msg) } - override def verbose(msg: String) { if (lib) super.verbose(msg) } - override def warning(msg: String) { if (lib) super.warning(msg) } - override def error (msg: String) { if (lib) super.error(msg) } -} - -/** - * @author Stephane Micheloud - * @version 1.0 - */ -class Debug(tag: String) { - - def this() = this("") - - object Level extends Enumeration { - type Level = Value - val SILENT, ERROR, WARNING, VERBOSE, INFO = Value - } - - private val level0 = - try { - val prop = System.getProperty("scala.remoting.logLevel") - if (prop ne null) prop.toLowerCase else "" - } - catch { - case e => - Console.err.println(e.getMessage) - "" - } - - import Level._ - protected var (lev, lib) = { - val p = java.util.regex.Pattern.compile("(error|warning|verbose|info)(\\,lib)?(.*)") - val m = p matcher level0 - val (s, b) = - if (m.matches) (m.group(1), m.group(2) ne null) - else ("", false) - s match { - case "error" => (ERROR , b) - case "warning" => (WARNING, b) - case "verbose" => (VERBOSE, b) - case "info" => (INFO , b) - case _ => (SILENT , false) - } - } - - def level = lev - def level_= (lev: Level) = { this.lev = lev } - - private val tag0: String = - if (tag != null & tag.length > 0) tag+" " else "" - - def info(msg: String) { - if (lev >= INFO) Console.println(tag0 + "(info): " + msg) - } - - def verbose(msg: String) { - if (lev >= VERBOSE) Console.println(tag0 + "(verb): " + msg) - } - - def warning(msg: String) { - if (lev >= WARNING) Console.err.println(tag0 + "(warn): " + msg) - } - - def error(msg: String) { - if (lev >= ERROR) Console.err.println(tag0 + "(erro): " + msg) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala b/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala deleted file mode 100644 index 1105832ef7..0000000000 --- a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala +++ /dev/null @@ -1,192 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RegistryDelegate.scala 18234 2009-07-07 13:21:57Z michelou $ - -package scala.runtime.remoting - -import java.rmi.{RMISecurityManager, Remote, RemoteException} -import java.rmi.registry.{LocateRegistry, Registry} -import java.rmi.server.UnicastRemoteObject - -/** - * <p> - * This class implements the registry delegate concept - * (see http://www.genady.net/rmi/v20/docs/delegate/RegistryDelegate.html) - * </p> - * <p> - * In order to enforce some level of security, the standard RMI registry - * implementation (e.g. <code>rmiregistry.exe</code>) only allows processes - * on the same host to register objects in the registry (think of a bank - * running a registry on one of its servers, and doesn't want anybody - * modifying it). So, by design, if a process tries to - * <code>bind(String, Remote)</code> an object to a remote registry, - * an exception will be thrown. - * </p> - * <p> - * However, the design of a distributed system may require remote clients to - * register themselves in a central registry. If such system is deployed in a - * controlled and trusted environment (e.g., a firewalled intranet with tight - * access control), the security risk may be acceptable. - * </p> - * <p> - * The simplest technical solution to the remote registration problem is to - * have a registry delegate. A registry delegate is an object that serves as - * a proxy for the real registry. The delegate itself usually appears in the - * registry under a well known name. It implements the Registry interface and - * simply delegates all method calls to the appropriate methods of the real - * registry. The delegate is allowed to perform bind and unbind operations - * because it is running on the same host as the registry. - * </p> - * <p> - * The common scenario for starting a registry and creating the delegate is - * starting a class with the following <code>main(Array[String])</code> method: - * </p> - * <pre> - * @throws(classOf[AccessException], classOf[RemoteException], classOf[AlreadyBoundException]) - * <b>object</b> namingService { - * <b>def</b> main(args: Array[String]) { - * <b>if</b> (System.getSecurityManager() == <b>null</b>) - * System.setSecurityManager(<b>new</b> RMISecurityManager()) - * - * <b>val</b> registry = LocateRegistry.createRegistry(REGISTRY_PORT) - * registry.bind(DELEGATE_NAME, <b>new</b> RegistryDelegate()); - * - * do { - * <b>try</b> { - * Thread.sleep(Long.MAX_VALUE) - * } <b>catch</b> { - * <b>case</b> e: InterruptedException => // do nothing - * <b>case</b> e: Throwable => e.printStackTrace(); sys.exit(1) - * } - * } while (<b>true</b>) - * } - * }</pre> - * <p> - * The common usage scenario looks something like: - * </p><pre> - * Registry remoteRegistry = LocateRegistry.getRegistry("remotehost.mycompany.com"); - * Registry delegate = (Registry) remoteRegistry.lookup(DELEGATE_NAME); - * delegate.bind("someName", <b>new</b> SomeRemoteObject());</pre> - * <p> - * The <code>getRegistryDelegate(String)</code> method is a helper method - * that fetches the registry delegate for you. - * </p> - * <p> - * The <code>main(Array[String])</code> method of this class will create a - * local registry on the default port, create a registry delegate and bind - * it under the well known name that you chose in the wizard - * (<code>DELEGATE_NAME</code>). - * </p> - * - * @author Genady Beryozkin, rmi-info@genady.net - */ - -object RMIDelegate { - /** The name under which the delegate appears in the registry. */ - val DELEGATE_NAME = "foo" - - /** This method retrieves the registry delegate from a registry that is - * running on a remote host. - */ - @throws(classOf[RemoteException]) - def getRegistryDelegate(remoteHost: String): Registry = - getRegistryDelegate(remoteHost, Registry.REGISTRY_PORT) - - /** This method retrieves the registry delegate from a registry that is - * running on a remote host. - */ - @throws(classOf[RemoteException]) - def getRegistryDelegate(remoteHost: String, remotePort: Int): Registry = { - val registry = LocateRegistry.getRegistry(remoteHost, remotePort) - (registry lookup DELEGATE_NAME).asInstanceOf[Registry] - } - - /** A simple way to run a registry and bind a registry delegate. */ - @throws(classOf[RemoteException]) - def main(args: Array[String]) { - var port = Registry.REGISTRY_PORT - - if (args.length > 0) { - if (args(0) equals "-help") { - println("Usage: rmidelegate <options> <port>") - sys.exit(0) - } - try { - port = args(0).toInt - } catch { - case e: NumberFormatException => - println("Usage: rmidelegate <options> <port>") - sys.exit(1) - } - val opts = args filter (_ startsWith "-J-D") - for (opt <- opts) { - val x = opt.substring(4) split "=" - if (x.length == 2) System.setProperty(x(0), x(1)) - else System.setProperty(x(0), "") - } - } - - if (System.getSecurityManager() == null) - System.setSecurityManager(new RMISecurityManager() { - override def checkPermission(p: java.security.Permission) {} - }) - - - val registry = LocateRegistry.createRegistry(port) - registry.bind(DELEGATE_NAME, new RegistryDelegate()) - - do { - try { - Thread.sleep(Long.MaxValue) - } catch { - case e: InterruptedException => - // do nothing - case e: Throwable => - e.printStackTrace() - sys.exit(1) - } - } while (true) - } - -} - -/** Create a delegate for a user provided registry instance. The registry is - * assumed to be a local registry, as there is no point in creating a delegate - * for a remote registry. - */ -class RegistryDelegate(reg: Registry) extends UnicastRemoteObject with Registry { - /** The local registry */ - private val localRegistry: Registry = reg - - /** Create a delegate for a local registry that is bound to the default - * local port (1099). - */ - def this() = this(LocateRegistry.getRegistry()) - - /** Create a delegate for a local registry that is bound to a user - * specified port. - */ - def this(port: Int) = this(LocateRegistry.getRegistry(port)) - - @throws(classOf[RemoteException]) - def bind(name: String, obj: Remote) { localRegistry.bind(name, obj) } - - @throws(classOf[RemoteException]) - def list(): Array[String] = localRegistry.list() - - @throws(classOf[RemoteException]) - def lookup(name: String): Remote = localRegistry.lookup(name) - - @throws(classOf[RemoteException]) - def rebind(name: String, obj: Remote) { localRegistry.rebind(name, obj) } - - @throws(classOf[RemoteException]) - def unbind(name: String) { localRegistry.unbind(name) } - -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteBooleanRef.scala b/src/detach/library/scala/runtime/remoting/RemoteBooleanRef.scala deleted file mode 100644 index ff6c8f6b6c..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteBooleanRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteBooleanRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{BooleanRef, RemoteRef} - -/** - * The trait Remote<code>RemoteBooleanRef</code> provides a remote interface - * for manipulating boolean references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteBooleanRef { - def elem_=(value: Boolean) - def elem: Boolean -} - -/** - * The class <code>RemoteBooleanRefImpl</code> implements a remote (global) - * boolean reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.BooleanRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteBooleanRefImpl(name: String, x: BooleanRef) -extends UnicastRemoteObject with RemoteBooleanRef with Unreferenced { - def elem_=(value: Boolean) { x.elem = value } - def elem: Boolean = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteBooleanRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteByteRef.scala b/src/detach/library/scala/runtime/remoting/RemoteByteRef.scala deleted file mode 100644 index 335f0d9019..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteByteRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteByteRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{ByteRef, RemoteRef} - -/** - * The trait Remote<code>RemoteByteRef</code> provides a remote interface - * for manipulating byte references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteByteRef { - def elem_=(value: Byte) - def elem: Byte -} - -/** - * The class <code>RemoteByteRefImpl</code> implements a remote (global) - * byte reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.ByteRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteByteRefImpl(name: String, x: ByteRef) -extends UnicastRemoteObject with RemoteByteRef with Unreferenced { - def elem_=(value: Byte) { x.elem = value } - def elem: Byte = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteByteRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteCharRef.scala b/src/detach/library/scala/runtime/remoting/RemoteCharRef.scala deleted file mode 100644 index e0f48eb970..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteCharRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteCharRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{CharRef, RemoteRef} - -/** - * The trait Remote<code>RemoteCharRef</code> provides a remote interface - * for manipulating character references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteCharRef { - def elem_=(value: Char) - def elem: Char -} - -/** - * The class <code>RemoteCharRefImpl</code> implements a remote (global) - * character reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.CharRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteCharRefImpl(name: String, x: CharRef) -extends UnicastRemoteObject with RemoteCharRef with Unreferenced { - def elem_=(value: Char) { x.elem = value } - def elem: Char = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteCharRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteDoubleRef.scala b/src/detach/library/scala/runtime/remoting/RemoteDoubleRef.scala deleted file mode 100644 index 2e1319595a..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteDoubleRef.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteDoubleRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{DoubleRef, RemoteRef} - -/** - * The trait Remote<code>RemoteDoubleRef</code> provides.. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteDoubleRef { - def elem_=(value: Double) - def elem: Double -} - -/** - * The class <code>RemoteDoubleRefImpl</code> implements a remote (global) - * double reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.DoubleRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteDoubleRefImpl(name: String, x: DoubleRef) -extends UnicastRemoteObject with RemoteDoubleRef with Unreferenced { - def elem_=(value: Double) { x.elem = value } - def elem: Double = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteDoubleRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteFloatRef.scala b/src/detach/library/scala/runtime/remoting/RemoteFloatRef.scala deleted file mode 100644 index f4e61ea6da..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteFloatRef.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteFloatRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{FloatRef, RemoteRef} - -/** - * The trait Remote<code>RemoteFloatRef</code> provides a remote interface - * for manipulating float references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteFloatRef { - def elem_=(value: Float) - def elem: Float -} - -/** - * The class <code>RemoteFloatRefImpl</code> implements a remote (global) - * float reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.FloatRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteFloatRefImpl(name: String, x: FloatRef) -extends UnicastRemoteObject with RemoteFloatRef with Unreferenced { - def elem_=(value: Float) { x.elem = value } - def elem: Float = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteIntFloatImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteGC.scala b/src/detach/library/scala/runtime/remoting/RemoteGC.scala deleted file mode 100644 index 393c031bfc..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteGC.scala +++ /dev/null @@ -1,66 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteGC.scala 17547 2009-04-21 13:56:28Z michelou $ - -package scala.runtime.remoting - -import java.lang.ref.{Reference, WeakReference, ReferenceQueue} -import java.rmi.{NoSuchObjectException, Remote} -import java.rmi.server.UnicastRemoteObject -import scala.collection.mutable - -/** - * - * @author Stephane Micheloud - * @version 1.0 - */ -// Adapted from scala.actors.ActorGC -private [runtime] class RemoteGC { - - private val refQueue = new ReferenceQueue[Remote] - private val refSet = new mutable.HashSet[Reference[T] forSome { type T <: Remote }] - - private var liveRefs = 0 - - def newRef(a: Remote) = synchronized { - refSet += new WeakReference(a, refQueue) - liveRefs += 1 - info("added object reference \""+a+"\" ("+liveRefs+")") - } - - def gc() = synchronized { - info("GC called ("+liveRefs+")") - // check for unreachable object references - def drain() { - val wr = refQueue.poll - if (wr != null) { - val msg = try { - UnicastRemoteObject.unexportObject(wr.get, true/*force*/) - "removed object reference" - } - catch { - case e: NoSuchObjectException => - "object already unbound" - } - info(msg+" ("+liveRefs+")") - liveRefs -= 1 - refSet -= wr - // continue draining - drain() - } - } - drain() - } - - def allClosed: Boolean = synchronized { - liveRefs <= 0 - } - - private def info(msg: String) { Debug.info("[RemoteGC] "+msg) } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteIntRef.scala b/src/detach/library/scala/runtime/remoting/RemoteIntRef.scala deleted file mode 100644 index b14403f6ca..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteIntRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteIntRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{IntRef, RemoteRef} - -/** - * The trait Remote<code>RemoteIntRef</code> provides a remote interface - * for manipulating integer references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteIntRef { - def elem_=(value: Int) - def elem: Int -} - -/** - * The class <code>RemoteIntRefImpl</code> implements a remote (global) - * integer reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.IntRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteIntRefImpl(name: String, x: IntRef) -extends UnicastRemoteObject with RemoteIntRef with Unreferenced { - def elem_=(value: Int) { x.elem = value } - def elem: Int = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteIntRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteLongRef.scala b/src/detach/library/scala/runtime/remoting/RemoteLongRef.scala deleted file mode 100644 index da83491489..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteLongRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteLongRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{LongRef, RemoteRef} - -/** - * The trait Remote<code>RemoteLongRef</code> provides a remote interface - * for manipulating long integer references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteLongRef { - def elem_=(value: Long) - def elem: Long -} - -/** - * The class <code>RemoteLongRefImpl</code> implements a remote (global) - * long integer reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.LongRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteLongRefImpl(name: String, x: LongRef) -extends UnicastRemoteObject with RemoteLongRef with Unreferenced { - def elem_=(value: Long) { x.elem = value } - def elem: Long = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteLongRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteObjectRef.scala b/src/detach/library/scala/runtime/remoting/RemoteObjectRef.scala deleted file mode 100644 index 9f27b26114..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteObjectRef.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteObjectRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{ObjectRef, RemoteRef} - -/** - * The trait Remote<code>RemoteObjectRef</code> provides a remote interface - * for manipulating object references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteObjectRef { - def elem_=(value: AnyRef) - def elem: AnyRef -} - -/** - * The class <code>RemoteObjectRefImpl</code> implements a remote (global) - * object reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.ObjectRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface to automatically - * remove the no more referenced binding from the registry. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteObjectRefImpl(name: String, x: ObjectRef) -extends UnicastRemoteObject with RemoteObjectRef with Unreferenced { - def elem_=(value: AnyRef) { x.elem = value } - def elem: AnyRef = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteObjectRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/library/scala/runtime/remoting/RemoteShortRef.scala b/src/detach/library/scala/runtime/remoting/RemoteShortRef.scala deleted file mode 100644 index 2ced9dbc83..0000000000 --- a/src/detach/library/scala/runtime/remoting/RemoteShortRef.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: RemoteShortRef.scala 18398 2009-07-28 14:26:36Z michelou $ - -package scala.runtime.remoting - -import java.rmi.server.{UnicastRemoteObject, Unreferenced} -import scala.runtime.{ShortRef, RemoteRef} - -/** - * The trait Remote<code>RemoteShortRef</code> provides a remote interface - * for manipulating short integer references. - * - * @author Stephane Micheloud - * @version 1.0 - */ -@remote -trait RemoteShortRef { - def elem_=(value: Short) - def elem: Short -} - -/** - * The class <code>RemoteShortRefImpl</code> implements a remote (global) - * short integer reference by inheriting from the class - * <code>UnicastRemoteObject</code>. - * - * In particular, it forwards method invocations to the <code>elem</code> - * accessors of class <code>runtime.ShortRef</code> and implements the - * <code>java.rmi.server.Unreferenced</code> interface. - * - * @author Stephane Micheloud - * @version 1.0 - */ -class RemoteShortRefImpl(name: String, x: ShortRef) -extends UnicastRemoteObject with RemoteShortRef with Unreferenced { - def elem_=(value: Short) { x.elem = value } - def elem: Short = x.elem - override def toString() = x.elem.toString - def unreferenced() { - Debug.info("[RemoteShortRefImpl] unreferenced: "+this) - RemoteRef.unbind(name) - } -} diff --git a/src/detach/plugin/scala/tools/detach/Detach.scala b/src/detach/plugin/scala/tools/detach/Detach.scala deleted file mode 100644 index 499a97b761..0000000000 --- a/src/detach/plugin/scala/tools/detach/Detach.scala +++ /dev/null @@ -1,1190 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2005-2013 LAMP/EPFL - * @author Stephane Micheloud - */ - -package scala.tools.detach - -import scala.collection.{ mutable, immutable } -import scala.collection.mutable.ListBuffer -import scala.tools.nsc._ -import scala.tools.nsc.plugins.PluginComponent -import scala.tools.nsc.symtab.Flags._ -import scala.tools.nsc.transform._ - -abstract class Detach extends PluginComponent - with Transform with TypingTransformers { - import global._ - import definitions._ - - /** the following two members override abstract members in Transform */ - val phaseName: String = "detach" - - protected def newTransformer(unit: CompilationUnit): Transformer = - new DetachTransformer(unit) - - // set with the `-P:detach:enable` plugin option (see DetachPlugin) */ - protected[detach] var isEnabled = false - - private class DetachTransformer(unit: CompilationUnit) - extends TypingTransformer(unit) { - private val DEBUG = settings.debug.value - private val PROXY_PREFIX = "proxy$" // local proxy objects - private val PROXY_SUFFIX = "$proxy" // top-level proxy classes - private val DETACH_SUFFIX = "$detach" // detached closures - private val IMPL_SUFFIX = "Impl" // follows Java convention - - private val nme_bind = newTermName("bind") - private val nme_unbind = newTermName("unbind") - private val nme_unreferenced = newTermName("unreferenced") - - private val Functions = FunctionClass.toList // see method isFuncType - - private val RemoteClass = - definitions.getClass("java.rmi.Remote") - - private val UIDClass = - definitions.getClass("java.rmi.server.UID") - - private val UnicastRemoteObjectClass = - definitions.getClass("java.rmi.server.UnicastRemoteObject") - - private val UnreferencedClass = - definitions.getClass("java.rmi.server.Unreferenced") - - private val DetachModule = - definitions.getModule("scala.remoting.detach") - - private val DebugModule = - definitions.getModule("scala.remoting.Debug") - - private val RemoteRefModule = - definitions.getModule("scala.runtime.RemoteRef") - - private val ThreadModule = - definitions.getModule("java.lang.Thread") - - private val UnicastRemoteObjectModule = - definitions.getModule("java.rmi.server.UnicastRemoteObject") - - private val remoteAnnotationInfo = { - val RemoteAttr: Symbol = definitions.getClass("scala.remote") - AnnotationInfo(RemoteAttr.tpe, List(), List()) - } - - private val serializableAnnotationInfo = - AnnotationInfo(requiredClass[scala.annotation.serializable].tpe, List(), List()) -/* - private val throwsAnnotationInfo = { - val RemoteExceptionClass = definitions.getClass("java.rmi.RemoteException") - val ThrowsAttr = definitions.getClass("scala.throws") - AnnotationInfo( - ThrowsAttr.tpe, - List(Literal(Constant(RemoteExceptionClass.tpe))), - List() - ) - } -*/ - // todo: see generation of Java version UID - private def serialVersionUIDAnnotationInfo(clazz: Symbol) = { - def genHash(sym: Symbol): Long = { - val sym1 = if (sym.isConstructor) sym.owner else sym - val ts = sym.tpe match { - case MethodType(params, rt) => (params map (_.tpe)) ::: List(rt) - case t => List(t) - } - val hashes = sym1.nameString.hashCode :: - (ts map (_.typeSymbol.nameString.hashCode)) - (0L /: hashes)((acc, h) => acc ^ h) - } - val hashes = for (sym <- clazz.info.decls.toList) yield genHash(sym) - val uid: Long = (0L /: hashes) ((acc, h) => acc * 41 + h) - val serialVersionUIDAttr = definitions.getClass("scala.SerialVersionUID") - AnnotationInfo( - serialVersionUIDAttr.tpe, - List(Literal(Constant(uid))), - List() - ) - } - - private def elems(suffix: String): List[(Symbol, Symbol)] = - for (clazz <- ObjectRefClass :: refClass.valuesIterator.toList) yield { - val name = "scala.runtime.remoting.Remote" + clazz.name + suffix - (clazz, definitions.getClass(name)) - } - private val remoteRefClass = immutable.HashMap(elems(""): _*) - private val remoteRefImpl = immutable.HashMap(elems("Impl"): _*) - - private val proxyInterfaceDefs = new mutable.HashMap[Symbol/*owner*/, ListBuffer[Tree]] - private val detachedClosureApply = new mutable.HashMap[Tree, Apply] - - private type SymSet = mutable.HashSet[Symbol] - private val capturedObjects = new mutable.HashMap[Symbol/*clazz*/, SymSet] - private val capturedFuncs = new mutable.HashMap[Symbol/*clazz*/, SymSet] - private val capturedCallers = new mutable.HashMap[Symbol/*clazz*/, SymSet] - private val capturedThisClass = new mutable.HashMap[Symbol, Symbol] - - private val proxies = new mutable.HashMap[ - Symbol, //clazz - (Symbol, Symbol, mutable.HashMap[Symbol, Symbol]) //iface, impl, accessor map - ] - def toInterface(clazz: Symbol) = proxies(clazz)._1 - private val classdefs = new mutable.HashMap[Symbol/*clazz*/, ClassDef] - // detachedClosure gathers class definitions containing a "detach" apply - private val detachedClosure = new mutable.HashMap[Symbol/*clazz*/, ClassDef] - - /** <p> - * The method <code>freeObjTraverser.traverse</code> is invoked - * in the method <code>DetachPlugin.transformUnit</code> in order to - * gather information about objects referenced inside a detached - * closure and which will be accessed remotely through object proxies. - * </p> - * <p> - * Object proxies are generated in method <code>mkClosureApply</code> - * and their definitions are generated in method <code>genProxy</code>. - * </p> - */ - private val freeObjTraverser = new Traverser { - def symSet(f: mutable.HashMap[Symbol, SymSet], sym: Symbol): SymSet = f.get(sym) match { - case Some(ss) => ss - case None => val ss = new mutable.HashSet[Symbol]; f(sym) = ss; ss - } - def getClosureApply(tree: Tree): Apply = tree match { - case Block(_, expr) => getClosureApply(expr) - case Typed(expr, _) => getClosureApply(expr) - case apply @ Apply(Select(_, _), _) => apply // sel="<init>" or some "f$0" - case Apply(fun, _) => getClosureApply(fun) - case _ => - throw new Error("getClosureApply: unhandled case " + tree) - } - def isFuncType(tp: Type): Boolean = tp match { - case TypeRef(pre, sym, args) => - Functions contains sym.tpe.typeSymbol - case _ => - false - } - def isOuterMember(sym: Symbol): Boolean = - sym.isOuterAccessor || - sym.name.endsWith(nme.OUTER/*, nme.OUTER.length*/) - override def traverse(tree: Tree) { - val sym = tree.symbol - val owner = - if (currentOwner.isModule) currentOwner - else currentOwner.enclClass - tree match { - case cdef @ ClassDef(_, _, _, impl) => - classdefs(sym) = cdef - super.traverse(impl) - if (detachedClosure contains sym) { - detachedClosure(sym) = cdef - symSet(capturedObjects, sym) += capturedThisClass(sym) - } - - case Apply(Select(qual, _), List(arg)) - if (qual.tpe <:< DetachModule.tpe) => - assert(isFuncType(arg.tpe))//debug - val t = getClosureApply(arg) - if (!t.fun.symbol.isConstructor) - unit.error(t.pos, "detach inapplicable for " +t.fun.symbol) - val sym = t.fun.symbol.owner - capturedThisClass(sym) = owner - symSet(capturedFuncs, sym) - detachedClosureApply(tree) = t - classdefs get sym match { - case None => - detachedClosure(sym) = null // set later in case ClassDef - case Some(cdef) => - detachedClosure(sym) = cdef - symSet(capturedObjects, sym) += capturedThisClass(sym) - } - super.traverse(arg) - - case Select(qual @ This(_), name) - if qual.symbol.isModuleClass && !qual.symbol.isPackageClass => - val qsym = qual.symbol - symSet(capturedFuncs, owner) += sym - symSet(capturedObjects, owner) += qsym - - case Select(qual, name) - if (qual.hasSymbolField && - (sym.owner != owner) && - !(sym.ownerChain contains ScalaPackageClass) && - !(sym.owner hasFlag JAVA)) => - val qsym = qual.symbol - symSet(capturedFuncs, owner) += sym - if (qsym.isStaticModule && !qsym.isPackage) { - //println("*****1******* capturedObjects("+owner+") += "+qsym) - symSet(capturedObjects, owner) += qsym - } - else if (!isOuterMember(qsym) && !(qsym isNestedIn owner)) { - //println("*****3******* capturedCallers("+sym+") += "+qsym) - symSet(capturedCallers, sym) += qsym - } - - case _ => - super.traverse(tree) - } - } - } //freeObjTraverser - - private val valueClass = immutable.HashMap( - (for ((sym, ref) <- refClass.toList) yield (ref, sym)): _* - ) + (ObjectRefClass -> ObjectClass) - - private def toValueClass(tp: Type): Type = - if (isRefClass(tp)) valueClass(tp.typeSymbol).tpe - else if (proxies contains tp.typeSymbol) toInterface(tp.typeSymbol).tpe - else tp - - private def isRefClass(tp: Type): Boolean = - (tp ne null) && - ((refClass.valuesIterator contains tp.typeSymbol) || (ObjectRefClass eq tp.typeSymbol)) - - private def isRemoteRefClass(tp: Type): Boolean = - (tp ne null) && (remoteRefClass.valuesIterator contains tp.typeSymbol) - - private def mkRemoteRefClass(tp: Type): Type = { - assert(isRefClass(tp)) - val tp1 = remoteRefClass(tp.typeSymbol) - typeRef(tp1.typeConstructor.prefix, tp1, Nil) // after erasure, no type anymore! - } - - class TreeOuterSubstituter(from: List[Symbol], to: List[Symbol]) extends Traverser { - if (DEBUG) - println("\nTreeOuterSubstituter:"+ - "\n\tfrom="+from.mkString(",")+ - "\n\tto="+to.mkString(",")) - val substMap = new mutable.HashMap[Symbol, Symbol] - override def traverse(tree: Tree) { - def subst(from: List[Symbol], to: List[Symbol]) { - if (!from.isEmpty) - if (tree.symbol.tpe == from.head.tpe) { - if (DEBUG) - println("\nTreeOuterSubstituter\n\tsym="+tree.symbol+ - ", tpe="+tree.symbol.tpe+ - "\n\towner="+tree.symbol.owner) - tree.symbol updateInfo to.head.tpe - } - else tree.symbol.tpe match { - case MethodType(params, restp) => - for (p <- params if p.tpe == from.head.tpe) { - p updateInfo to.head.tpe - } - if (restp == from.head.tpe) { - if (DEBUG) - println("\nTreeOuterSubstituter(2)\n\tsym="+tree.symbol+ - ", tpe="+tree.symbol.tpe+ - ", owner="+tree.symbol.owner) - tree.symbol updateInfo MethodType(params, to.head.tpe) - } - case _ => - subst(from.tail, to.tail) - } - } - def isOuter(sym: Symbol): Boolean = - sym.isOuterAccessor || - sym.name.endsWith(nme.OUTER/*, nme.OUTER.length*/) - if (tree.hasSymbolField && isOuter(tree.symbol)) subst(from, to) - super.traverse(tree) - } - } - - // based on class Trees.TreeTypeSubstituter - private class TreeTypeRefSubstituter(clazz: Symbol) extends Traverser { - override def traverse(tree: Tree) { - val sym = tree.symbol - if (tree.hasSymbolField && isRefClass(sym.tpe) && - (sym.owner.enclClass == clazz) && - (sym.isValueParameter || sym.hasFlag(PARAMACCESSOR))) { - sym setInfo mkRemoteRefClass(sym.tpe) - tree.tpe = sym.tpe - } - if (isRefClass(tree.tpe)) - tree.tpe = mkRemoteRefClass(tree.tpe) - super.traverse(tree) - } - override def apply[T <: Tree](tree: T): T = super.apply(tree) - } - - private class TreeOwnerSubstituter(from: Symbol, to: Symbol) extends Traverser { - def substType(sym: Symbol): Type = { - def subst(tpe: Type): Type = tpe match { - case MethodType(params, restp) => - println("TreeOwnerSubstituter[1]: tpe="+tpe+ - ", tpe.typeSymbol="+tpe.typeSymbol+", sym="+sym)//debug - for (p <- params if p.tpe == from.tpe) { - println("TreeOwnerSubstituter[2]: sym="+sym+ - ", sym.owner="+sym.owner+", p.tpe="+p.tpe)//debug - p updateInfo to.tpe - } - MethodType(params, subst(restp)) - case _ => - if (sym.owner == from && tpe == from.tpe) { - println("TreeOwnerSubstituter[3]: sym="+sym+ - ", owner="+sym.owner+", tpe="+tpe)//debug - to.tpe - } else tpe - } - subst(sym.tpe) - } - val map = new mutable.HashMap[Symbol, Symbol] - override def traverse(tree: Tree) { - if (tree.hasSymbolField && tree.symbol != NoSymbol) { - val sym = tree.symbol - if (sym.owner == from) { - val sym1 = map get sym match { - case Some(s) => s - case None => val s = sym.cloneSymbol(to); map(sym) = s; s - } - tree setSymbol sym1 - } - val sym1 = tree.symbol - val tp = substType(sym1) - if (tp != sym1.tpe) { - if (sym1.owner == to) - println("\n%%%%%1%%%%%%% TreeOwnerSubst: tree="+tree+", sym1="+sym1+", sym1.owner="+sym1.owner)//debug - sym1 setInfo tp - tree setSymbol sym1 - } - } - super.traverse(tree) - } - //override def apply[T <: Tree](tree: T): T = super.apply(tree/*.duplicate*/) - } - - private var inConstructorFlag = 0L - - private def isCaptured(clazz: Symbol, sym: Symbol): Boolean = - if (capturedFuncs contains clazz) { - //log("**1** isCaptured: clazz="+clazz+", sym="+sym+", ") - capturedFuncs(clazz) contains sym - } - else { - //log("**2** isCaptured: clazz="+clazz+", sym="+sym) - sym.isMethod && !sym.isConstructor - } - - private class TreeAccessorSubstituter(clazz: Symbol, objs: List[Symbol], proxySyms: List[Symbol]) - extends Transformer { - def removeAccessors(tree: Tree): Tree = tree match { - case Apply(fun, _) => - removeAccessors(fun) - case Select(qual, _) if tree.hasSymbolField && tree.symbol.isOuterAccessor => - removeAccessors(qual) - case _ => - tree - } - if (DEBUG) - println("\nTreeAccessorSubstituter: "+ - "\n\tobjs="+objs.mkString(",")+ - "\n\tproxies="+proxySyms.mkString(",")) - override def transform(tree: Tree): Tree = tree match { - // transforms field assignment $outer.i$1.elem=.. - // into setter $outer.i$1_=(..) - case Assign(lhs @ Select(qual1 @ Select(qual, name), name1), rhs) - if qual1.hasSymbolField && !qual1.symbol.isPrivateLocal && - isRemoteRefClass(qual1.tpe) => - if (DEBUG) - println("\nTreeAccessorSubstituter: Assign1\n\tqual1="+qual1+", sel.tpe="+lhs.tpe+ - "\n\tqual1.tpe="+qual1.tpe+", name1="+name1+ - "\n\tqual.tpe="+qual.tpe+", tree.tpe="+tree.tpe)//debug - val iface = toInterface(qual.tpe.typeSymbol) - val sym = iface.tpe.decls lookup nme.getterToSetter(name) - atPos(tree.pos)(Apply( - Select(super.transform(qual), sym) setType lhs.tpe, - List(super.transform(rhs)) - ) setType tree.tpe) - - // transforms local assignment this.x$1.elem=.. - // into setter method this.x$1_=(..) - case Assign(lhs @ Select(qual, name), rhs) - if qual.hasSymbolField && qual.symbol.isPrivateLocal && - isRemoteRefClass(qual.tpe) => - if (DEBUG) - println("\nTreeAccessorSubstituter: Assign2"+ - "\n\tqual="+qual+", qual.tpe="+qual.tpe+ - "\n\tname="+name) - // substitute the 'elem' member of the reference class with - // the corresponding setter method of the remote reference class. - val qual1 = super.transform(qual) - val sym = qual1.tpe.decls lookup nme.getterToSetter(name) - val fun = gen.mkAttributedSelect(qual1, sym) - Apply(fun, List(super.transform(rhs))) setType lhs.tpe - - case Assign(Select(qual, name), rhs) - if qual.hasSymbolField && (objs contains qual.symbol) => - val sym = qual.symbol - val proxy = proxySyms(objs indexOf sym) - if (DEBUG) - println("\nTreeAccessorSubstituter: Assign3"+ - "\n\tqual="+qual+", qual.tpe="+qual.tpe+ - "\n\tproxy="+proxy+", proxy.tpe="+proxy.tpe+ - "\n\tname="+name)//debug - // substitute the member accessor of the enclosing class with - // the corresponding setter method of the detached interface. - val iface = toInterface(sym) - val substSymbols = new TreeSymSubstituter( - sym.info.decls.toList filter { isCaptured(sym, _) }, - iface.info.decls.toList) - substSymbols(Apply( - Select(Ident(proxy), nme.getterToSetter(name)), - List(super.transform(rhs)))) - - // transforms setter invocation this.i$1_=(..) - // into setter invocation $outer.i$1_=(..) - case Apply(Select(qual @ This(_), name), args) - if (objs contains qual.symbol) && nme.isSetterName(name) => - val proxy = proxySyms(objs indexOf qual.symbol) - if (DEBUG) - println("\nTreeAccessorSubstituter: Apply"+ - "\n\tqual="+qual+", qual.tpe="+qual.tpe+ - "\n\tproxy="+proxy+", proxy.tpe="+proxy.tpe+ - "\n\tname="+name+", decoded="+name.decode) - val qual1 = gen.mkAttributedSelect(gen.mkAttributedThis(proxy.owner), proxy) - val sym1 = proxy.info.decls lookup name.decode - val fun = gen.mkAttributedSelect(qual1, sym1) - Apply(fun, args map (super.transform(_))) setType tree.tpe - - // transforms access to field this.name$1 - // into invocation of getter method $outer.name$1() - case Select(qual @ This(_), name) - if objs contains qual.symbol => - val proxy = proxySyms(objs indexOf qual.symbol) - if (DEBUG) - println("\nTreeAccessorSubstituter: Select"+ - "\n\tqual="+qual+", qual.tpe="+qual.tpe+ - "\n\tproxy="+proxy+", proxy.tpe="+proxy.tpe+ - "\n\tname="+name+", decoded="+name.decode) - val qual1 = gen.mkAttributedSelect(gen.mkAttributedThis(proxy.owner), proxy) - val sym1 = proxy.info.decls lookup nme.originalName(name) //name - gen.mkAttributedSelect(qual1, sym1) - - // transforms field $outer.name$1 into getter method $outer.name$1() - case Select(qual @ Select(_, name1), name) - if qual.hasSymbolField && name1.endsWith(nme.OUTER/*, nme.OUTER.length*/) && - !tree.symbol.isMethod => - if (DEBUG) - println("\nTreeAccessorSubstituter: Select0\n\tqual="+qual+ - ", qual.tpe="+qual.tpe+", name="+name)//debug - val sym = qual.symbol - val qual1 = gen.mkAttributedSelect(gen.mkAttributedThis(sym.owner), sym) - val iface = toInterface(qual.tpe.typeSymbol) - val sym1 = iface.tpe.decls lookup name - val fun = gen.mkAttributedSelect(qual1, sym1) - Apply(fun, List()) setType tree.tpe - - case Select(apply @ Apply(fun @ Select(qual, _), _), name) - if fun.symbol.isOuterAccessor => - val tsym = fun.symbol.tpe.resultType.typeSymbol - val funcs = capturedFuncs(clazz).toList filter (sym => - (tsym.ownerChain contains sym.owner) || (tsym isSubClass sym.owner)) - if (DEBUG) - println("\nTreeAccessorSubstituter: Select1\n\tfun="+fun+ - ",\n\tfun.tpe="+fun.tpe+", name="+name+ - ",\n\tfuncs="+funcs)//debug - funcs find (tree.symbol.==) match { - case Some(sym) => - val qual1 = - if (currentOwner.enclClass isNestedIn clazz) apply - else removeAccessors(qual) - val name1 = - (if (tsym isSubClass qual1.tpe.typeSymbol) "" - else tsym.fullName('$')+"$")+sym.name - val iface = toInterface(qual1.tpe.typeSymbol) - val sym1 = iface.tpe.decls lookup name1 - gen.mkAttributedSelect(qual1, sym1) - case None => - super.transform(tree) - } - - // transforms field access $outer.i$1.elem - // into invocation of getter method $outer.i$1() - case Select(qual @ Select(qual1, name1), name) - if qual.hasSymbolField && !qual.symbol.isPrivateLocal && - isRemoteRefClass(qual.tpe) => - if (DEBUG) - println("\nTreeAccessorSubstituter: Select2\n\tqual="+qual+ - "\n\tqual.tpe="+qual.tpe+", tree.tpe="+tree.tpe)//debug - val iface = toInterface(qual.symbol.owner) - val sym1 = iface.tpe.decls lookup name1 - val fun = gen.mkAttributedSelect(qual1, sym1) - Apply(fun, List()) setType tree.tpe - - // transforms local access this.i$1.elem - // into invocation of getter method this.i$1() - case Select(qual, name) - if qual.hasSymbolField && qual.symbol.isPrivateLocal && - isRemoteRefClass(qual.tpe) => - if (DEBUG) - println("\nTreeAccessorSubstituter: Select3\n\tqual="+qual+ - "\n\tqual.tpe="+qual.tpe)//debug - val sym = qual.tpe.decls lookup name - val fun = gen.mkAttributedSelect(qual, sym) - Apply(fun, List()) setType tree.tpe - - case Select(qual, name) - if qual.hasSymbolField && (objs contains qual.symbol) => - if (DEBUG) - println("\nTreeAccessorSubstituter: Select4\n\tqual="+qual+ - ", qual.tpe="+qual.tpe+", name="+name)//debug - val sym = qual.symbol - val proxy = proxySyms(objs indexOf sym) - // substitute the accessor of a member of the enclosing class - // with the corresponding accessor of the detached interface - val qual1 = gen.mkAttributedSelect(gen.mkAttributedThis(proxy.owner), proxy) - val iface = toInterface(sym) - val sym1 = iface.tpe.decls lookup name.decode - gen.mkAttributedSelect(qual1, sym1) - - case _ => - super.transform(tree) - } - def apply[T <: Tree](tree: T): T = transform(tree).asInstanceOf[T] - } // TreeAccessorSubstituter -/* - private class TreeNameSubstituter(from: Name, to: Symbol) extends Transformer { - override def transform(tree: Tree): Tree = tree match { - case Super(qual, mix) if tree.symbol.name == from => - Super(qual, mix) setSymbol to - case This(name) if name == from => - This(to.name) setSymbol to - case _ => - super.transform(tree) - } - def apply[T <: Tree](tree: T): T = transform(tree).asInstanceOf[T] - } -*/ - /** <p> - * Given the closure definition (generated by previous phases) - * </p><pre> - * class $anonfun$1 extends Object with Function1 { - * def this($outer: C, x$1: Int): $anonfun$1 = .. - * def apply(x: Int): Int = x + this.$outer.x() + this.x$1 - * }</pre> - * <p> - * the method <code>mkClosureDef</code> transforms the above code - * to the following: - * </p><pre> - * @serializable - * class $anonfun$1$detach extends Object with Function1 { - * def this($outer: C$proxy, x$1: Int): $anonfun$1$detach = .. - * def apply(x: Int): Int = x + this.$outer.x() + this.x$1 - * }</pre> - * <p> - * In particular, it performs the following operations: - * 1) add constructor parameter <code>proxy_n</code> to access - * proxy of the enclosing class - * 2) change reference types in constructor arguments to type - * <code<Remote_type_Ref</code>' - * 3) change occurences of <code>this</code> identifier to - * <code>proxy_n</code> in template code - * 4) change reference types of local value definitions associated - * to updated constructor arguments to type <code>Remote_type_Ref</code> - * </p> - * - * @param clazz the symbol of the original closure definition - * @return the typed class definition for the detached closure. - */ - private def mkClosureDef(clazz: Symbol): Tree = { - val cdef = detachedClosure(clazz) - val name = cdef.symbol.name - if (name endsWith DETACH_SUFFIX) - return cdef // closure already detached - - clazz.name = encode(clazz.name.decode + DETACH_SUFFIX) - clazz addAnnotation serialVersionUIDAnnotationInfo(clazz) - clazz addAnnotation serializableAnnotationInfo - - val thiz = capturedThisClass(clazz) - val (List(outer), captured) = - capturedObjects(clazz).toList partition (thiz.==) - - /** <p> - * Method <code>updateConstructorParams</code> updates the class - * symbol of the detached closure as follows: - * 1) it appends the "$detach" suffix to the class name, - * 2) it adds the "@serializable" annotation to class attributes, - * 3) it adds a parameter symbol for each element of "captured". - * </p> - * <p> - * and also updates the signature of the constructor symbol: - * 1) it adds a parameter type for each element of "captured", - * 2) it changes reference types to remote reference types. - * </p> - */ - def updateConstructorParams(vparams: List[ValDef]): List[Symbol] = { - val hasOuter = !vparams.isEmpty && (vparams.head.symbol.tpe == thiz.tpe) - val ctor = clazz.primaryConstructor - val params = (for (sym <- captured) yield { - val iface = toInterface(sym) - val param = ctor.newValueParameter(ctor.pos, freshProxyName) - .setFlag(SYNTHETIC) - .setInfo(iface.tpe) - param.owner = ctor - param - }) ::: ( - if (hasOuter) Nil - else { - val iface = toInterface(thiz) - val param = ctor.newValueParameter(ctor.pos, nme.OUTER) - .setFlag(SYNTHETIC) - .setInfo(iface.tpe) - param.owner = ctor - List(param) - } - ) - val tp = ctor.tpe match { - case mt @ MethodType(params1, restp) => - val params2 = if (hasOuter) { - val iface = toInterface(params1.head.tpe.typeSymbol) - ctor.newSyntheticValueParam(iface.tpe) :: params1.tail - } - else params1 - for (p <- params2 if isRefClass(p.tpe)) { - p updateInfo mkRemoteRefClass(p.tpe) - } - MethodType(params ::: params2, restp) - case tp => - tp - } - ctor updateInfo tp - params - } //updateConstructorParams - - /** - */ - def updateConstructorDef(ctor: DefDef): (List[Tree], List[Symbol]) = { - val DefDef(mods, name, tparams, List(vparams), tpt, rhs) = ctor - val newparams = updateConstructorParams(vparams) - val vparams0 = newparams map (sym => ValDef(sym) setType sym.tpe) - val ctorDef = treeCopy.DefDef(ctor, mods, name, tparams, List(vparams0 ::: vparams), tpt, rhs) - val accessors = for (sym <- newparams) yield { - val acc = clazz.newValue(sym.pos, sym.name) - .setFlag(SYNTHETIC | PARAMACCESSOR | PRIVATE | LOCAL) - .setInfo(sym.tpe) - clazz.info.decls enter acc - acc - } - val accDefs = accessors map (sym => ValDef(sym) setType sym.tpe) - (ctorDef :: accDefs, accessors) - } //updateConstructorDef - - val impl = cdef.impl - val (List(ctor: DefDef), body1) = impl.body partition (t => - t.isDef && t.symbol.isPrimaryConstructor) - val (defs, accessors) = updateConstructorDef(ctor) - val impl1 = treeCopy.Template(impl, impl.parents, impl.self, defs ::: body1) - val (from, to) = /*List.unzip*/( - for (obj <- captured ::: List(outer)) - yield (obj, toInterface(obj)) - ) unzip - //val substNames = new TreeNameSubstituter(name, clazz) - val substTypeRefs = new TreeTypeRefSubstituter(clazz) - val substAccs = new TreeAccessorSubstituter(clazz, from, accessors) - val substTypes = new TreeOuterSubstituter(from, to) - val substSyms = new TreeSymSubstituter(from, to) - val t1 = ClassDef(clazz, substSyms(substTypes(substAccs(substTypeRefs(impl1))))) - //println("mkClosureDef: t(untyped)=\n"+nodeToString(t1)) - val t = localTyper typed t1 - detachedClosure(clazz) = t.asInstanceOf[ClassDef] - //println("mkClosureDef: t(typed)=\n"+nodeToString(t)) - t - } //mkClosureDef - - /** <p> - * Given a class <code>C</code> with member <code>x</code> - * which is (remotely) referenced from inside a detached closure: - * </p><pre> - * class C extends .. { - * var x: Int - * }</pre> - * <p> - * the method <code>addProxy</code> generates the following two - * proxy definitions (used later in method <code>mkClosureApply</code> - * to generate object proxies): - * </p><pre> - * trait C$proxy extends java.rmi.Remote { - * def x(): Int - * def x_=(x$1: Int): Unit - * } - * class C$proxyImpl - * extends java.rmi.server.UnicastRemoteObject - * with C$proxy with java.rmi.server.Unreferenced { - * def this(x$0: String, x$1: C): C$ProxyImpl = .. - * def x(): Int = this.x$1.x() - * def x_=(x$1: Int): Unit = this.x$1.x_=(x$1) - * def unreferenced(): Unit = RemoteRef.unbind(this.x$0) - * }</pre> - */ - private def addProxy(closure: Symbol, clazz: Symbol) { - // the Sun RMI compiler crashes with the error message - // "error: An error has occurred in the compiler; ..." with trace - // "sun.tools.java.CompilerError: getInnerClassField" if the - // generated proxy class does not belong to the top-level scope. - val proxyOwner = clazz.toplevelClass.owner //clazz.owner - - if (DEBUG) - println("\nadd proxy for "+clazz+" in "+proxyOwner)//debug - - val (proxyIntf, proxyImpl, proxyMap) = proxies get clazz match { - case Some(proxy) => - proxy - case None => - val iface = - proxyOwner.newClass(clazz.pos, encode(clazz.name.decode + PROXY_SUFFIX)) - iface.sourceFile = clazz.sourceFile - iface setFlag (ABSTRACT | TRAIT | INTERFACE) // Java interface - val iparents = List(ObjectClass.tpe, RemoteClass.tpe) - iface setInfo ClassInfoType(iparents, newScope, iface) - // methods must throw RemoteException - iface addAnnotation remoteAnnotationInfo - - val iclaz = - proxyOwner.newClass(clazz.pos, encode(iface.name.decode + IMPL_SUFFIX)) - iclaz.sourceFile = clazz.sourceFile - iclaz setFlag (SYNTHETIC | FINAL) - // Variant 1: rebind/unbind - val cparents = List(UnicastRemoteObjectClass.tpe, iface.tpe, UnreferencedClass.tpe) - // Variant 2: un-/exportObject - //val cparents = List(ObjectClass.tpe, iface.tpe, UnreferencedClass.tpe) - iclaz setInfo ClassInfoType(cparents, newScope, iclaz) - val proxy = (iface, iclaz, new mutable.HashMap[Symbol, Symbol]) - proxies(clazz) = proxy - proxy - } - - def addAccessors() { - def mkGetter(sym: Symbol, name: String): Symbol = { - val getter = if (sym.isMethod) { - val meth = sym.cloneSymbol(proxyIntf) - meth.name = name - val tsym = meth.tpe.resultType.typeSymbol - if (proxies contains tsym) - meth updateInfo MethodType(List(), toInterface(tsym).tpe) - meth - } - else { - val meth = proxyIntf.newMethod(sym.pos, nme.getterName(sym.originalName)) - meth setFlag ACCESSOR - meth setInfo MethodType(List(), toValueClass(sym.tpe)) - meth - } - getter setFlag ABSTRACT - getter resetFlag FINAL - getter - } - def mkSetter(sym: Symbol): Symbol = { - val setter = proxyIntf.newMethod(sym.pos, nme.getterToSetter(sym.originalName)) - setter setFlag (sym.flags & ~(PRIVATE | LOCAL) | ACCESSOR | lateDEFERRED) - val param = setter.newSyntheticValueParam(toValueClass(sym.tpe)) - setter setInfo MethodType(List(param), UnitClass.tpe) - setter setFlag ABSTRACT - setter resetFlag FINAL - setter - } - def create(owner: Symbol, clazz: Symbol) { - val funcs = capturedFuncs(owner).toList - funcs find (_.isConstructor) match { - case Some(sym) if capturedFuncs contains sym.owner => - create(sym.owner, clazz) - case _ => - } - val newfuncs = funcs filterNot (proxyMap.valuesIterator.toList contains) - val (members, others) = newfuncs partition (clazz isSubClass _.owner) - val outers = others filter (sym => - (clazz isNestedIn sym.owner) && clazz.isClass) - for (sym <- outers) { - val sym1 = mkGetter(sym, sym.fullName('$')) - proxyIntf.info.decls enter sym1 - proxyMap(sym1) = sym - }/* - for (sym <- outers if capturedCallers contains sym; - caller <- capturedCallers(sym)) { - val sym1 = mkGetter(sym, caller.nameString+'$'+sym.nameString) - if (clazz.isAnonymousClass) - println("[2] clazz="+clazz+", sym1="+sym1) - proxyIntf.info.decls enter sym1 - proxyMap(sym1) = sym - }*/ - for (sym <- members if !sym.isConstructor) { - val sym1 = mkGetter(sym, sym.originalName.decode) - proxyIntf.info.decls enter sym1 - proxyMap(sym1) = sym - } - for (sym <- members if isRefClass(sym.tpe)) { - val sym1 = mkSetter(sym) - proxyIntf.info.decls enter sym1 - proxyMap(sym1) = sym - } - } - create(closure, clazz) - } - - addAccessors - if (DEBUG) { - val xs = proxyMap.keysIterator.toList - println("\tadded "+proxyIntf+ - "\n\twith "+xs.mkString(", ")+" ["+xs.length+"]") - } - } //addProxy - - def genProxy(clazz: Symbol) { - val (proxyIntf, proxyImpl, proxyMap) = proxies(clazz) - - // generate proxy interface - val ifaceBody = proxyMap.keysIterator.toList map { DefDef(_, EmptyTree) } - val ifaceParents = - proxyIntf.info.parents map (t => TypeTree(t) setPos proxyIntf.pos) - val ifaceTmpl = Template(ifaceParents, emptyValDef, ifaceBody) - val ifaceDef = localTyper typed ClassDef(proxyIntf, ifaceTmpl) - - // generated proxy implementation - // Variant 1: rebind/unbind - val param1 = - proxyImpl.newValueParameter(proxyImpl.pos, freshName("x$")) - .setFlag(SYNTHETIC | PARAMACCESSOR | PRIVATE | LOCAL) - .setInfo(StringClass.tpe) - proxyImpl.info.decls enter param1 - - val param2 = - proxyImpl.newValueParameter(proxyImpl.pos, freshName("x$")) - .setFlag(SYNTHETIC | PARAMACCESSOR | PRIVATE | LOCAL) - .setInfo(clazz.tpe) - proxyImpl.info.decls enter param2 - - val unreferenced = - proxyImpl.newMethod(proxyImpl.pos, nme_unreferenced) - .setInfo(MethodType(List(), UnitClass.tpe)) - proxyImpl.info.decls enter unreferenced - - val proxyBody = - DefDef(unreferenced, List(List()), Block( - List(Apply( //stats - Select(gen.mkAttributedRef(DebugModule), "info"), - List(Apply( - Select(Literal(Constant("unreferenced: ")), "$plus"), - // Variant 1: rebind/unbind - List(Select(This(proxyImpl), param1.name)) - // Variant 2: un-/exportObject - //List(This(proxyImpl)) - )) - )), - Apply( //expr - Select(gen.mkAttributedRef(RemoteRefModule), nme_unbind), - // Variant 1: rebind/unbind - List(Select(This(proxyImpl), param1.name)) - // Variant 2: un-/exportObject - //List(This(proxyImpl)) - ) - )) :: ( - for (sym <- proxyIntf.info.decls.toList) yield { - val sym1 = sym.cloneSymbol(proxyImpl) - sym1 resetFlag (ABSTRACT | DEFERRED | lateDEFERRED) - proxyImpl.info.decls enter sym1 - DefDef(sym1, { - val sym2 = proxyMap(sym) - var t = Select(This(proxyImpl), param2) - var outerAcc = - if (sym2.owner isSubClass param2) None - else param2.info.decls.toList find (_.isOuterAccessor) - while (!outerAcc.isEmpty) { - t = Select(t, outerAcc.get) - val outerClass = outerAcc.get.tpe.resultType.typeSymbol - outerAcc = - if (sym2.owner == outerClass) None - else outerClass.info.decls.toList find (_.isOuterAccessor) - } - val sel = Select(t, sym2) - if (sym2.isMethod) { - Apply(sel, sym1.paramss(0) map { Ident(_) }) - } - else if (isRefClass(sym2.tpe)) { - val sel1 = Select(sel, nme.elem) - if (sym1.tpe.paramTypes.length == 0) sel1 - else Assign(sel1, Ident(sym1.paramss(0)(0))) - } - else - sel - }) - }) - val proxyParents = - proxyImpl.info.parents map (t => TypeTree(t) setPos proxyImpl.pos) - val proxyTmpl = Template(proxyParents, - emptyValDef, NoMods, - // Variant 1: rebind/unbind - /*vparamss*/ List(List(ValDef(param1), ValDef(param2))), - // Variant 2: un-/exportObject - ///*vparamss*/ List(List(ValDef(param2))), - /*argss*/ List(List()), proxyBody, NoPosition) - val proxyDef = localTyper typed ClassDef(proxyImpl, proxyTmpl) - - // remember definitions to be added by transformStats - val proxyOwner = proxyIntf.owner - if (! (proxyInterfaceDefs contains proxyOwner)) - proxyInterfaceDefs(proxyOwner) = new ListBuffer - proxyInterfaceDefs(proxyOwner) += ifaceDef - proxyInterfaceDefs(proxyOwner) += proxyDef - } //genProxy - - private def freshName(s: String): Name = - unit.fresh.newName(s) - - private def freshProxyName: Name = - unit.fresh.newName(PROXY_PREFIX) - - /** <p> - * Given a detached closure applied in some environment consisting - * of an enclosing class <code>C</code> and some local variables - * <code>x$1</code> (immutable) and <code>y$1</code> (mutable): - * </p><pre> - * scala.remoting.detach.apply({ - * (new $anonfun$1(C.this, x$1, y$1): Function1) - * })</pre> - * <p> - * the above code is transformed to the following block: - * </p><pre> - * { - * val proxy$1: C$Proxy = - * RemoteRef.bind("C/proxy$1", new C$ProxyImpl(C.this)) - * val proxy$2: RemoteIntRef = - * RemoteRef.bind("C/proxy$2", new RemoteIntRefImpl(y$1)) - * (new $anonfun$1detach(proxy$1, x$1, proxy$2): Function1) - * } - * </pre> - */ - private def mkClosureApply(tree: Tree): Tree = { - val apply @ Apply(fun, args) = detachedClosureApply(tree) - assert(fun.symbol.isConstructor, fun.symbol+" is not a constructor")//debug - val clazz = apply.tpe.typeSymbol - val thiz = capturedThisClass(clazz) - val cdef = mkClosureDef(clazz) - val uid = localTyper typed { - val sym = currentOwner.newValue(tree.pos, freshName("uid$")) - .setFlag(SYNTHETIC) - .setInfo(StringClass.tpe) - val rhs = Apply(Select( - Apply( - Select(New(TypeTree(UIDClass.tpe)), nme.CONSTRUCTOR), - List() - ), - "toString" - ), List()) - ValDef(sym, rhs) - } - def cast(tree: Tree, tpe: Type): Tree = - Apply( - TypeApply( - Select(tree, Object_asInstanceOf), - List(TypeTree(tpe)) - ), - List() - ) - - def mkProxy(csym: Symbol): ValDef = { - val (iface, proxy, _) = proxies(csym) - val sym = currentOwner.newValue(csym.pos, freshProxyName) - .setFlag(SYNTHETIC) - .setInfo(iface.tpe) - val bind = Select(gen.mkAttributedRef(RemoteRefModule), nme_bind) - val name = Apply( - Select(Literal(Constant(sym.fullName('/')+"$")), String_+), - List(Ident(uid.symbol)) - ) - val thiz = - if (csym.isModule) gen.mkAttributedIdent(csym) - else gen.mkAttributedThis(csym) - val args = List(name, - Apply(Select(New(TypeTree(proxy.tpe)), nme.CONSTRUCTOR), - // Variant 1: rebind/unbind - List(name, thiz))) - // Variant 2: un-/exportObject - //List(thiz))) - val rhs = cast(Apply(bind, args), iface.tpe) - ValDef(sym, rhs) - } - - def mkObjProxies: List[ValDef] = { - val (outer, captured) = - capturedObjects(clazz).toList partition (thiz.==) - (captured ::: outer) map mkProxy - } - - def mkArgProxies: Map[Symbol, ValDef] = { - def retRefs(t: Tree): List[Tree] = t match { - case Apply(fun, args) => - args flatMap retRefs - case id @ Ident(_) => - if (isRefClass(id.tpe)) List(id) else Nil - case Template(_, _, body) => - body flatMap retRefs - case New(tpt) => - retRefs(tpt) - case thiz @ This(_) => - if (isRefClass(thiz.tpe)) List(thiz) else Nil - case _ => - throw new Error("Internal error: " + t.getClass) - } - new immutable.HashMap[Symbol, ValDef] ++ ( - for (variable <- retRefs(apply)) yield { - val param = variable.symbol - assert(isRefClass(param.tpe), param) - val proxy = currentOwner.newValue(param.pos, freshProxyName) - .setFlag(SYNTHETIC) - .setInfo(mkRemoteRefClass(param.tpe)) - val bind = Select(gen.mkAttributedRef(RemoteRefModule), nme_bind) - //val name = Literal(Constant(proxy.fullName('/'))) - val name = Apply( - Select(Literal(Constant(proxy.fullName('/')+"$")), String_+), - List(Ident(uid.symbol)) - ) - val ts = param.tpe.typeSymbol - val args = List(name, - Apply( - Select(New(TypeTree(remoteRefImpl(ts).tpe)), nme.CONSTRUCTOR), - // Variant 1: rebind/unbind - List(name, variable))) - // Variant 2: un-/exportObject - //List(variable))) - val rhs = cast(Apply(bind, args), remoteRefClass(ts).tpe) - (param, ValDef(proxy, rhs)) - } - ) - } //mkArgProxies - - /** <p> - * Method <code>mkClosureInstance</code> updates the list of actual - * parameters passed to the closure instance. - * </p> - */ - def mkClosureInstance(objProxies: List[ValDef], - argProxies: Map[Symbol, ValDef]): Tree = { - fun.tpe = fun.symbol.tpe - val args0 = objProxies map (tree => Ident(tree.symbol)) - val hasOuter = !args.isEmpty && (args.head.symbol.tpe == thiz.tpe) - val args1 = (if (hasOuter) args.tail else args) map (arg => - argProxies get arg.symbol match { - case Some(t) => Ident(t.symbol) - case None => arg - } - ) - if (DEBUG) - println("\nmkClosureInstance:\n\targs0="+args0+"\n\targs1="+args1) - val t = Typed( - Apply(fun, args0 ::: args1), - //TypeTree(clazz.info.parents.tail.head) //interface (2.7.x) - TypeTree(clazz.info.parents.head) //interface (2.8.x) - ) - localTyper typed t - } //mkClosureInstance - - val objProxies = mkObjProxies - val argProxies = mkArgProxies - val stats = uid :: objProxies ::: argProxies.valuesIterator.toList - val expr = mkClosureInstance(objProxies, argProxies) - localTyper typed Block(stats, expr) - } //mkClosureApply - - override def transform(tree: Tree): Tree = { - def withInConstructorFlag(inConstructorFlag: Long)(f: => Tree): Tree = { - val savedInConstructorFlag = this.inConstructorFlag - this.inConstructorFlag = inConstructorFlag - val t = f - this.inConstructorFlag = savedInConstructorFlag - t - } - if (!isEnabled) return tree - tree match { - case ClassDef(mods, name, tparams, impl) => - val tree1 = super.transform(tree) - if (!reporter.hasErrors && (capturedThisClass contains tree1.symbol)) - mkClosureDef(tree1.symbol) - else - tree1 - - case Apply(Select(_, _), _) => - val tree1 = super.transform(tree) - if (!reporter.hasErrors && (detachedClosureApply contains tree1)) - atPos(tree1.pos)(mkClosureApply(tree1)) - else - tree1 - - case Template(_, _, _) => - withInConstructorFlag(0) { super.transform(tree) } - - case _ => - super.transform(tree) - } - } - - /** Transform statements and add detached definitions to them. */ - override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = { - val stats1 = super.transformStats(stats, exprOwner) - val newDefs = { - val buf = new ListBuffer[Tree] - if (proxyInterfaceDefs contains currentOwner) - buf ++= proxyInterfaceDefs(currentOwner).toList - buf.toList - } - if (newDefs.isEmpty) stats1 else stats1 ::: newDefs - } - - private def genProxies() { - def printDebugInfo() { - println("\ncompilation unit : "+unit) - for ((sym, _) <- detachedClosure) { - println("closure to detach: "+sym+" (owner: "+sym.owner+")") - println("captured this : "+capturedThisClass(sym)) - val objs = capturedObjects get sym match { - case Some(ss) => ss.toList - case None => Nil - } - println("captured objects : "+objs.mkString(", ")+" ["+objs.length+"]") - } - println("\ncalled functions :") - for (sym <- capturedFuncs.keysIterator) { - val xs = capturedFuncs(sym).toList map (s => { - val callers = capturedCallers get s match { - case Some(ss) => "|"+ss.toList.mkString(",") - case None => "" - } - s+"("+s.owner.name+callers+")" - }) - println("\t"+sym+" -> "+xs.mkString(", ")+" ["+xs.length+"]") - } - } - def printDebugInfo2() { - println("\nproxy classes :") - for (sym <- proxies.keysIterator) - println("\t"+sym+"("+sym.tpe+") -> "+proxies(sym)) - } - if (DEBUG) - printDebugInfo - for ((closure, _) <- detachedClosure; - captured <- capturedObjects(closure)) - addProxy(closure, captured) - if (DEBUG) - printDebugInfo2 - for (sym <- proxies.keysIterator) - genProxy(sym) - } //genProxies - - /** <p> - * Method <code>transformUnit</code> performs three successive operations: - * </p> - * <ol> - * <li>it first gathers infos about free objects and detached - * closures;</li> - * <li>it then adds proxies for free objects;</li> - * <li>finally, if transforms detached closures (both definition and - * instantiation).</li> - * </ol> - */ - override def transformUnit(unit: CompilationUnit) { - freeObjTraverser.traverse(unit.body) - if (!reporter.hasErrors) genProxies - super.transformUnit(unit) - } - } - -} - diff --git a/src/detach/plugin/scala/tools/detach/DetachPlugin.scala b/src/detach/plugin/scala/tools/detach/DetachPlugin.scala deleted file mode 100644 index c6e18b7abe..0000000000 --- a/src/detach/plugin/scala/tools/detach/DetachPlugin.scala +++ /dev/null @@ -1,41 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2005-2013 LAMP/EPFL - * @author Stephane Micheloud - */ - -package scala.tools.detach - -import scala.tools.nsc.{Global, Phase} -import scala.tools.nsc.plugins.{Plugin, PluginComponent} - -class DetachPlugin(val global: Global) extends Plugin { - import global._ - - val name = "detach" - val description = "Perform detaching of remote closures" - - object detach extends { - val global = DetachPlugin.this.global - val runsAfter = List("lambdalift") - override val runsBefore = List("constructors") - } with Detach - - val components = List[PluginComponent](detach) - - def setEnabled(flag: Boolean) { detach.isEnabled = flag } - - override def processOptions(options: List[String], error: String => Unit) = { - var enabled = false - for (option <- options) { - if (option == "enable") { - enabled = true - } else { - error("Option not understood: "+option) - } - } - setEnabled(enabled) - } - - override val optionsHelp: Option[String] = - Some(" -P:detach:enable Enable detaching of remote closures") -} diff --git a/src/detach/plugin/scalac-plugin.xml b/src/detach/plugin/scalac-plugin.xml deleted file mode 100644 index 6c8600e331..0000000000 --- a/src/detach/plugin/scalac-plugin.xml +++ /dev/null @@ -1,4 +0,0 @@ -<plugin> - <name>detach</name> - <classname>scala.tools.detach.DetachPlugin</classname> -</plugin> diff --git a/test/attic/files/cli/test1/Main.check.j9vm5 b/test/attic/files/cli/test1/Main.check.j9vm5 deleted file mode 100644 index de454ef478..0000000000 --- a/test/attic/files/cli/test1/Main.check.j9vm5 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test1.Main: No such file or directory -env: -cp: No such file or directory -1: test 3 passed diff --git a/test/attic/files/cli/test1/Main.check.java b/test/attic/files/cli/test1/Main.check.java deleted file mode 100644 index 64410de98f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.java5 b/test/attic/files/cli/test1/Main.check.java5 deleted file mode 100644 index 64410de98f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5 +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.java5_api b/test/attic/files/cli/test1/Main.check.java5_api deleted file mode 100644 index 8693a5d92f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5_api +++ /dev/null @@ -1,19 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -`-- test1 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -2 directories, 15 files diff --git a/test/attic/files/cli/test1/Main.check.java5_j9 b/test/attic/files/cli/test1/Main.check.java5_j9 deleted file mode 100644 index de454ef478..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5_j9 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test1.Main: No such file or directory -env: -cp: No such file or directory -1: test 3 passed diff --git a/test/attic/files/cli/test1/Main.check.javac b/test/attic/files/cli/test1/Main.check.javac deleted file mode 100644 index ba25d9b6ca..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac +++ /dev/null @@ -1,19 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - diff --git a/test/attic/files/cli/test1/Main.check.javac5 b/test/attic/files/cli/test1/Main.check.javac5 deleted file mode 100644 index 0cb29d31ff..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac5 +++ /dev/null @@ -1,24 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - diff --git a/test/attic/files/cli/test1/Main.check.javac6 b/test/attic/files/cli/test1/Main.check.javac6 deleted file mode 100644 index 8f37a05bcb..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac6 +++ /dev/null @@ -1,29 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - diff --git a/test/attic/files/cli/test1/Main.check.jikes b/test/attic/files/cli/test1/Main.check.jikes deleted file mode 100644 index cd891689db..0000000000 --- a/test/attic/files/cli/test1/Main.check.jikes +++ /dev/null @@ -1,3 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. diff --git a/test/attic/files/cli/test1/Main.check.jikes5 b/test/attic/files/cli/test1/Main.check.jikes5 deleted file mode 100644 index cd891689db..0000000000 --- a/test/attic/files/cli/test1/Main.check.jikes5 +++ /dev/null @@ -1,3 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. diff --git a/test/attic/files/cli/test1/Main.check.scala b/test/attic/files/cli/test1/Main.check.scala deleted file mode 100644 index 43b200ae02..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala +++ /dev/null @@ -1,24 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.scala_api b/test/attic/files/cli/test1/Main.check.scala_api deleted file mode 100644 index 6fac39d3f0..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala_api +++ /dev/null @@ -1,33 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -`-- test1$package.html - -3 directories, 28 files diff --git a/test/attic/files/cli/test1/Main.check.scala_j9 b/test/attic/files/cli/test1/Main.check.scala_j9 deleted file mode 100644 index 65d5ddaac4..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala_j9 +++ /dev/null @@ -1,15 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.scalac b/test/attic/files/cli/test1/Main.check.scalac deleted file mode 100644 index 5561cc1ead..0000000000 --- a/test/attic/files/cli/test1/Main.check.scalac +++ /dev/null @@ -1,61 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5) - -migrate Assist in migrating from Scala version 1.0 - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test1/Main.check.scalaint b/test/attic/files/cli/test1/Main.check.scalaint deleted file mode 100644 index 88345d1874..0000000000 --- a/test/attic/files/cli/test1/Main.check.scalaint +++ /dev/null @@ -1,45 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test1/Main.java b/test/attic/files/cli/test1/Main.java deleted file mode 100644 index 8850b87517..0000000000 --- a/test/attic/files/cli/test1/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -// @info no dependency -package test1; -public class Main { - public static void main(String args[]) { - String arg = (args.length > 0) ? args[0] : "?"; - System.out.println("1: test " + arg + " passed (" + args.length + ")"); - } -} diff --git a/test/attic/files/cli/test1/Main.scala b/test/attic/files/cli/test1/Main.scala deleted file mode 100644 index f7dd8a0a36..0000000000 --- a/test/attic/files/cli/test1/Main.scala +++ /dev/null @@ -1,8 +0,0 @@ -// @info no dependency -package test1 -object Main { - def main(args: Array[String]) = { - val arg = if (args != null && args.length > 0) args(0) else "?" - Console.println("1: test " + arg + " passed (" + args.length + ")") - } -} diff --git a/test/attic/files/cli/test2/Main.check.j9vm5 b/test/attic/files/cli/test2/Main.check.j9vm5 deleted file mode 100644 index 8f4fdf8aa1..0000000000 --- a/test/attic/files/cli/test2/Main.check.j9vm5 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test2.Main: No such file or directory -env: -cp: No such file or directory -2: 1: test 3 passed diff --git a/test/attic/files/cli/test2/Main.check.java b/test/attic/files/cli/test2/Main.check.java deleted file mode 100644 index aca383de3e..0000000000 --- a/test/attic/files/cli/test2/Main.check.java +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.java5 b/test/attic/files/cli/test2/Main.check.java5 deleted file mode 100644 index aca383de3e..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5 +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.java5_api b/test/attic/files/cli/test2/Main.check.java5_api deleted file mode 100644 index 4ff775c3da..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5_api +++ /dev/null @@ -1,24 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -|-- test1 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -`-- test2 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -3 directories, 19 files diff --git a/test/attic/files/cli/test2/Main.check.java5_j9 b/test/attic/files/cli/test2/Main.check.java5_j9 deleted file mode 100644 index 2dcb6e892a..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5_j9 +++ /dev/null @@ -1,36 +0,0 @@ -JVMJ9VM007E Command-line option unrecognised: -cpp -Could not create the Java virtual machine. - -Usage: java [-options] class [args...] - (to execute a class) - or java [-jar] [-options] jarfile [args...] - (to execute a jar file) - -where options include: - -cp -classpath <directories and zip/jar files separated by :> - set search path for application classes and resources - -D<name>=<value> - set a system property - -verbose[:class|gc|jni] - enable verbose output - -version print product version - -version:<value> - require the specified version to run - -showversion print product version and continue - -jre-restrict-search | -no-jre-restrict-search - include/exclude user private JREs in the version search - -agentlib:<libname>[=<options>] - load native agent library <libname>, e.g. -agentlib:hprof - see also, -agentlib:jdwp=help and -agentlib:hprof=help - -agentpath:<pathname>[=<options>] - load native agent library by full pathname - -javaagent:<jarpath>[=<options>] - load Java programming language agent, see java.lang.instrument - -? -help print this help message - -X print help on non-standard options - -assert print help on assert options - -The java class is not found: test2.Main -The java class is not found: test2.Main -The java class is not found: test2.Main -The java class is not found: test2.Main diff --git a/test/attic/files/cli/test2/Main.check.javac b/test/attic/files/cli/test2/Main.check.javac deleted file mode 100644 index c40c0a7a89..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac +++ /dev/null @@ -1,27 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.javac5 b/test/attic/files/cli/test2/Main.check.javac5 deleted file mode 100644 index 0ac32b056e..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac5 +++ /dev/null @@ -1,28 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.javac6 b/test/attic/files/cli/test2/Main.check.javac6 deleted file mode 100644 index 350d3253bc..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac6 +++ /dev/null @@ -1,33 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test2/Main.java:5: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.jikes b/test/attic/files/cli/test2/Main.check.jikes deleted file mode 100644 index 97943e8347..0000000000 --- a/test/attic/files/cli/test2/Main.check.jikes +++ /dev/null @@ -1,9 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 1 semantic error compiling "files/cli/test2/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test2.Main". diff --git a/test/attic/files/cli/test2/Main.check.jikes5 b/test/attic/files/cli/test2/Main.check.jikes5 deleted file mode 100644 index 97943e8347..0000000000 --- a/test/attic/files/cli/test2/Main.check.jikes5 +++ /dev/null @@ -1,9 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 1 semantic error compiling "files/cli/test2/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test2.Main". diff --git a/test/attic/files/cli/test2/Main.check.scala b/test/attic/files/cli/test2/Main.check.scala deleted file mode 100644 index 7e5f17625b..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala +++ /dev/null @@ -1,24 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.scala_api b/test/attic/files/cli/test2/Main.check.scala_api deleted file mode 100644 index bcb0f0c7fb..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala_api +++ /dev/null @@ -1,37 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -|-- test1$package.html -|-- test2 -| `-- Main$object.html -|-- test2$content.html -`-- test2$package.html - -4 directories, 31 files diff --git a/test/attic/files/cli/test2/Main.check.scala_j9 b/test/attic/files/cli/test2/Main.check.scala_j9 deleted file mode 100644 index 80cbb50fa9..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala_j9 +++ /dev/null @@ -1,15 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.scalac b/test/attic/files/cli/test2/Main.check.scalac deleted file mode 100644 index 5561cc1ead..0000000000 --- a/test/attic/files/cli/test2/Main.check.scalac +++ /dev/null @@ -1,61 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5) - -migrate Assist in migrating from Scala version 1.0 - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test2/Main.check.scalaint b/test/attic/files/cli/test2/Main.check.scalaint deleted file mode 100644 index 89b6766bb5..0000000000 --- a/test/attic/files/cli/test2/Main.check.scalaint +++ /dev/null @@ -1,45 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test2/Main.java b/test/attic/files/cli/test2/Main.java deleted file mode 100644 index f6797632bf..0000000000 --- a/test/attic/files/cli/test2/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -// @info 1 dependency -package test2; -public class Main { - public static void main(String args[]) { - System.out.print("2: "); - test1.Main.main(args); - } -} diff --git a/test/attic/files/cli/test2/Main.scala b/test/attic/files/cli/test2/Main.scala deleted file mode 100644 index 11c878b9c0..0000000000 --- a/test/attic/files/cli/test2/Main.scala +++ /dev/null @@ -1,8 +0,0 @@ -// @info 1 dependency -package test2 -object Main { - def main(args: Array[String]) = { - Console.print("2: ") - test1.Main.main(args) - } -} diff --git a/test/attic/files/cli/test3/Main.check.j9vm5 b/test/attic/files/cli/test3/Main.check.j9vm5 deleted file mode 100644 index a094dc8daf..0000000000 --- a/test/attic/files/cli/test3/Main.check.j9vm5 +++ /dev/null @@ -1,5 +0,0 @@ -env: -cpp: No such file or directory -env: test3.Main: No such file or directory -env: -cp: No such file or directory -3: 1: test 3 passed -3: 2: 1: test 3 passed diff --git a/test/attic/files/cli/test3/Main.check.java b/test/attic/files/cli/test3/Main.check.java deleted file mode 100644 index de3eb7b136..0000000000 --- a/test/attic/files/cli/test3/Main.check.java +++ /dev/null @@ -1,10 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.java5 b/test/attic/files/cli/test3/Main.check.java5 deleted file mode 100644 index de3eb7b136..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5 +++ /dev/null @@ -1,10 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.java5_api b/test/attic/files/cli/test3/Main.check.java5_api deleted file mode 100644 index f6112211f0..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5_api +++ /dev/null @@ -1,29 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -|-- test1 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -|-- test2 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -`-- test3 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -4 directories, 23 files diff --git a/test/attic/files/cli/test3/Main.check.java5_j9 b/test/attic/files/cli/test3/Main.check.java5_j9 deleted file mode 100644 index 9e228d7649..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5_j9 +++ /dev/null @@ -1,36 +0,0 @@ -JVMJ9VM007E Command-line option unrecognised: -cpp -Could not create the Java virtual machine. - -Usage: java [-options] class [args...] - (to execute a class) - or java [-jar] [-options] jarfile [args...] - (to execute a jar file) - -where options include: - -cp -classpath <directories and zip/jar files separated by :> - set search path for application classes and resources - -D<name>=<value> - set a system property - -verbose[:class|gc|jni] - enable verbose output - -version print product version - -version:<value> - require the specified version to run - -showversion print product version and continue - -jre-restrict-search | -no-jre-restrict-search - include/exclude user private JREs in the version search - -agentlib:<libname>[=<options>] - load native agent library <libname>, e.g. -agentlib:hprof - see also, -agentlib:jdwp=help and -agentlib:hprof=help - -agentpath:<pathname>[=<options>] - load native agent library by full pathname - -javaagent:<jarpath>[=<options>] - load Java programming language agent, see java.lang.instrument - -? -help print this help message - -X print help on non-standard options - -assert print help on assert options - -The java class is not found: test3.Main -The java class is not found: test3.Main -The java class is not found: test3.Main -The java class is not found: test3.Main diff --git a/test/attic/files/cli/test3/Main.check.javac b/test/attic/files/cli/test3/Main.check.javac deleted file mode 100644 index 8d235b647b..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac +++ /dev/null @@ -1,33 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.javac5 b/test/attic/files/cli/test3/Main.check.javac5 deleted file mode 100644 index 3a48fa000e..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac5 +++ /dev/null @@ -1,31 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.javac6 b/test/attic/files/cli/test3/Main.check.javac6 deleted file mode 100644 index 677b950aed..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac6 +++ /dev/null @@ -1,36 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test3/Main.java:5: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:7: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.jikes b/test/attic/files/cli/test3/Main.check.jikes deleted file mode 100644 index 604333e81a..0000000000 --- a/test/attic/files/cli/test3/Main.check.jikes +++ /dev/null @@ -1,14 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 2 semantic errors compiling "files/cli/test3/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test3.Main". - - - 8. test2.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test2" was found in type "test3.Main". diff --git a/test/attic/files/cli/test3/Main.check.jikes5 b/test/attic/files/cli/test3/Main.check.jikes5 deleted file mode 100644 index 604333e81a..0000000000 --- a/test/attic/files/cli/test3/Main.check.jikes5 +++ /dev/null @@ -1,14 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 2 semantic errors compiling "files/cli/test3/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test3.Main". - - - 8. test2.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test2" was found in type "test3.Main". diff --git a/test/attic/files/cli/test3/Main.check.scala b/test/attic/files/cli/test3/Main.check.scala deleted file mode 100644 index f78729b9a2..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala +++ /dev/null @@ -1,28 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.scala_api b/test/attic/files/cli/test3/Main.check.scala_api deleted file mode 100644 index 4552819b5b..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala_api +++ /dev/null @@ -1,41 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -|-- test1$package.html -|-- test2 -| `-- Main$object.html -|-- test2$content.html -|-- test2$package.html -|-- test3 -| `-- Main$object.html -|-- test3$content.html -`-- test3$package.html - -5 directories, 34 files diff --git a/test/attic/files/cli/test3/Main.check.scala_j9 b/test/attic/files/cli/test3/Main.check.scala_j9 deleted file mode 100644 index 3804c17636..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala_j9 +++ /dev/null @@ -1,19 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.scalac b/test/attic/files/cli/test3/Main.check.scalac deleted file mode 100644 index 5561cc1ead..0000000000 --- a/test/attic/files/cli/test3/Main.check.scalac +++ /dev/null @@ -1,61 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5) - -migrate Assist in migrating from Scala version 1.0 - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test3/Main.check.scalaint b/test/attic/files/cli/test3/Main.check.scalaint deleted file mode 100644 index cffa02c5b6..0000000000 --- a/test/attic/files/cli/test3/Main.check.scalaint +++ /dev/null @@ -1,48 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test3/Main.java b/test/attic/files/cli/test3/Main.java deleted file mode 100644 index 208863d012..0000000000 --- a/test/attic/files/cli/test3/Main.java +++ /dev/null @@ -1,10 +0,0 @@ -// @info 2 dependency -package test3; -public class Main { - public static void main(String args[]) { - System.out.print("3: "); - test1.Main.main(args); - System.out.print("3: "); - test2.Main.main(args); - } -} diff --git a/test/attic/files/cli/test3/Main.scala b/test/attic/files/cli/test3/Main.scala deleted file mode 100644 index 63fc11b771..0000000000 --- a/test/attic/files/cli/test3/Main.scala +++ /dev/null @@ -1,10 +0,0 @@ -// @info 2 dependencies -package test3 -object Main { - def main(args: Array[String]) = { - Console.print("3: ") - test1.Main.main(args) - Console.print("3: ") - test2.Main.main(args) - } -} diff --git a/test/files/detach-neg/det_bar.check b/test/files/detach-neg/det_bar.check deleted file mode 100644 index 70b47581a5..0000000000 --- a/test/files/detach-neg/det_bar.check +++ /dev/null @@ -1,4 +0,0 @@ -det_bar.scala:7: error: detach inapplicable for method bar - detach(bar) - ^ -one error found diff --git a/test/files/detach-neg/det_bar.scala b/test/files/detach-neg/det_bar.scala deleted file mode 100644 index 862afb1d6e..0000000000 --- a/test/files/detach-neg/det_bar.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.remoting._ -class A(y: Int) { - var z = 2 - var bar = (x: Int) => x + y + z - def foo(x: Int): Int = x + y + z - bar = (x: Int) => x * y - detach(bar) -} - -object test extends App { - val a = new A(1) - println(a.bar(2)) -} diff --git a/test/files/detach-run/actor-run.check b/test/files/detach-run/actor-run.check deleted file mode 100644 index 9448ddd5fe..0000000000 --- a/test/files/detach-run/actor-run.check +++ /dev/null @@ -1,5 +0,0 @@ -Server.main 8889 -Client.main 127.0.0.1 8889 -yInstVal = 10 -zLocVal = 1000 -result received: 11111 diff --git a/test/files/detach-run/actor/Client.scala b/test/files/detach-run/actor/Client.scala deleted file mode 100644 index 12573e24d3..0000000000 --- a/test/files/detach-run/actor/Client.scala +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.actors.Actor._, ClientHelper._ -import scala.actors.remote._, RemoteActor._ -import scala.remoting._, Debug._ - -object Foo { - def trace(msg: String) { info("[Foo.trace] "+msg)} -} -object Client { - val yInstVal: Int = 10 - var yInstVar: Int = 99 - object Bar { - def trace(msg: String) { info("[Bar.trace] "+msg) } - } - def main(args: Array[String]) { - init(args) - actor { - val server = select(Node(host, port), 'Server) - val zLocVal: Int = 1000 - var zLocVar: Int = 9998 - server ! detach( - (x: Int) => { - println("yInstVal = "+yInstVal) - this.trace("yInstVar = "+yInstVar) - Bar.trace("zLocVal = "+zLocVal) - Foo.trace("zLocVar = "+zLocVar) - zLocVar += 2 - System.out.println("zLocVal = "+zLocVal) - Debug.info("zLocVar = "+zLocVar) - x + yInstVal + yInstVar + zLocVal + zLocVar - }) - react { - case result: Int => - println("result received: " + result) - Predef.exit(0) - } - } - } - private def trace(msg: String) { info("[Client.trace] "+msg) } -} - -object ClientHelper { - private var _host = "127.0.0.1" - private var _port = 8888 - def host = _host - def port = _port - def init(args: Array[String]) { - try { _host = args(0) } catch { case _ => } - try { _port = args(1).toInt } catch { case _ => } - } -} diff --git a/test/files/detach-run/actor/Server.scala b/test/files/detach-run/actor/Server.scala deleted file mode 100644 index b56d22f744..0000000000 --- a/test/files/detach-run/actor/Server.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.actors.Actor._ -import scala.actors.remote.RemoteActor._ - -object Server extends ServerConsole { - private def computation(f: Int => Int): Int = { - //some time-consuming task - f(2) - } - def main(args: Array[String]) { - actor { - classLoader = serverClassLoader - alive(args(0).toInt) - register('Server, self) - loopWhile(isRunning) { - react { - case f: (Int => Int) => - val result = computation(f) - sender ! result - } - } - } - } -} diff --git a/test/files/detach-run/actor/ServerConsole.scala b/test/files/detach-run/actor/ServerConsole.scala deleted file mode 100644 index 8ebd9d4c2e..0000000000 --- a/test/files/detach-run/actor/ServerConsole.scala +++ /dev/null @@ -1,75 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.io.{BufferedReader, InputStreamReader} - -import scala.compat.Platform.currentTime -import scala.remoting.Debug, Debug._ - -trait ServerConsole extends Thread { - private val startTime = currentTime - actors.Debug.level = // e.g. 3 // info+warning+error - try { System.getProperty("scala.actors.logLevel", "0").toInt } - catch { case e => 0 } - - start() - - val serverClassLoader = { - import java.rmi.server.RMIClassLoader - val codebase = System.getProperty("java.rmi.server.codebase") - info("[ServerConsole] codebase="+codebase) - RMIClassLoader getClassLoader codebase - } - - private var isTerminated = false - - def terminate() { isTerminated = false } - - def isRunning = !isTerminated - - override def run() { - val in = new BufferedReader(new InputStreamReader(System.in)) - var quit = false - while (!quit) { - val args = getArgs(in) - if (args contains "quit") - quit = true - if (args contains "cls") { - println(ERASE_SCREEN) - println(CURSOR_HOME) - } - if (args contains "warning") - Debug.level = Level.WARNING - if (args contains "info") - Debug.level = Level.INFO - if (args contains "silent") - Debug.level = Level.SILENT - } - terminate() - println("Server exited ("+mkTimeString(currentTime - startTime)+")") - sys.exit(0) - } - - protected def trace(msg: String) { - Debug.info("[ServerConsole.trace] "+msg) - } - - private def getArgs(in: BufferedReader): List[String] = { - val input = try { in.readLine() } catch { case _ => null } - if (input != null) (input.trim split "\\s+").toList else Nil - } - - private def mkTimeString(time: Long): String = { - def twoDigits(i: Long) = (if (i < 10) "0" else "")+i - val sec = time / 1000 - val min = sec / 60 - val h = min / 60 - twoDigits(h) +":"+ - twoDigits(min - h * 60)+":"+ - twoDigits(sec - min * 60) - } - - private val ERASE_SCREEN = "\033[2J" - private val CURSOR_HOME = "\033[H" -} diff --git a/test/files/detach-run/actor/actor.flags b/test/files/detach-run/actor/actor.flags deleted file mode 100644 index 55eed8bbcd..0000000000 --- a/test/files/detach-run/actor/actor.flags +++ /dev/null @@ -1 +0,0 @@ --Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable diff --git a/test/files/detach-run/actor/actor.scala b/test/files/detach-run/actor/actor.scala deleted file mode 100644 index 23a10d6982..0000000000 --- a/test/files/detach-run/actor/actor.scala +++ /dev/null @@ -1,157 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -object Test { - - val name = "actor" - val host = "127.0.0.1" - val port = 8889 - - def main(args: Array[String]) { - setenv() - println("Server.main "+port) - Server.main(Array(port.toString)) - println("Client.main "+host+" "+port) - Client.main(Array(host, port.toString)) - Server.terminate() - } - - private def setenv() { - import Env._ - - // Java properties for server & client - System.setProperty("scala.actors.logLevel", actors_logLevel) - System.setProperty("scala.remoting.logLevel", logLevel) - System.setProperty("java.security.manager", "") - System.setProperty("java.security.policy", policyFile) - // Java properties for server only - System.setProperty("java.rmi.server.codebase", deployUrl) - System.setProperty("java.rmi.server.hostname", host) - System.setProperty("java.rmi.server.useCodebaseOnly", "true") - - // application-specific classes to be deployed and accessed via URL - // (i.e. detached closure, proxy interfaces and proxy stubs) - val classNames = List( - "$anonfun$main$1$proxy", - "$anonfun$main$1$proxyImpl_Stub", - "Bar$proxy", - "Bar$proxyImpl_Stub", - "Client$$anonfun$main$1$$anonfun$apply$1$detach", - "Client$proxy", - "Client$proxyImpl_Stub", - "Foo$proxy", - "Foo$proxyImpl_Stub") - - val proxyImplNames = - for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0) - yield n.substring(0, i) - - generatePolicyFile() - generateRmiStubs(proxyImplNames) - generateJarFile(classNames) - } -} - -object Env { - import java.io._, java.util.jar._ - - val actors_logLevel = "0" - // = "3" // info+warning+error - val logLevel = "silent" - // = "info" // debug user code only - // = "info,lib" // debug user & library code - - // we assume an Apache server is running locally for deployment - private val sep = File.separator - val docPath = System.getProperty("user.home")+sep+"public_html" - val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name") - - private val policyTmpl = - System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy" - val outPath = System.getProperty("partest.output") - val libPath = System.getProperty("partest.lib") - val policyFile = outPath+sep+"java.policy" - val codebaseDir = outPath+sep+"-" - - assert((new File(docPath)).isDirectory, - "Root directory \""+docPath+"\" not found") - val deployJar = docPath+sep+Test.name+"_deploy.jar" - val deployUrl = docRoot+"/"+Test.name+"_deploy.jar" - - def generatePolicyFile() { - val in = new BufferedReader(new FileReader(policyTmpl)) - val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile))) - var line = in.readLine() - while (line != null) { - val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir) - out.println(line1) - line = in.readLine() - } - in.close() - out.close() - } - - def generateRmiStubs(classNames: List[String]) { - val options = List( - "-v1.2", - "-classpath "+libPath+File.pathSeparator+outPath, - "-d "+outPath) - rmic(options, classNames) - //ls(outPath) - } - - def generateJarFile(classNames: List[String]) { - val out = new JarOutputStream(new FileOutputStream(deployJar)) - classNames foreach (name => try { - val classFile = name+".class" - val in = new FileInputStream(outPath+sep+classFile) - out putNextEntry new JarEntry(classFile) - val buf = new Array[Byte](512) - var len = in read buf - while (len != -1) { - out.write(buf, 0, len) - len = in read buf - } - in.close() - } catch { - case e: FileNotFoundException => println(e) - }) - out.close() - } - - private def ls(path: String) { exec("ls -al "+path) } - - private def rmic(options: List[String], classNames: List[String]) { - val javaHome = scala.util.Properties.javaHome - val jdkHome = - if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4) - else javaHome - val rmicExt = if (scala.util.Properties.isWin) ".exe" else "" - val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt - val cmdLine = rmicCmd+options.mkString(" ", " ", "")+ - classNames.mkString(" "," ","") - // println(cmdLine) - exec(cmdLine) - } - - private def exec(command: String) { - val proc = Runtime.getRuntime exec command - proc.waitFor() - val out = new BufferedReader(new InputStreamReader(proc.getInputStream)) - var line = out.readLine() - while (line != null) { - println(line) - line = out.readLine() - } - out.close() - val err = new BufferedReader(new InputStreamReader(proc.getErrorStream)) - line = err.readLine() - while (line != null) { - println(line) - line = err.readLine() - } - err.close() - } -} - diff --git a/test/files/detach-run/actor/java.policy b/test/files/detach-run/actor/java.policy deleted file mode 100644 index b305f10b4c..0000000000 --- a/test/files/detach-run/actor/java.policy +++ /dev/null @@ -1,25 +0,0 @@ -// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html -// See http://mindprod.com/jgloss/policyfile.html -// The policy expands ${/} to the correct path or folder delimiter on your host platform. - -// Actions available with SocketPermission: accept, connect, listen, resolve -// 1) The "resolve" action is implied when any of the other actions are present. -// 2) The "listen" action is only meaningful when used with "localhost". - -grant { - permission java.net.SocketPermission "*:80", "connect,accept,listen"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "scala.remoting.logLevel", "read"; - permission java.util.PropertyPermission "scala.remoting.port", "read"; -}; - -grant codeBase "@PROJECT_LIB_BASE@" { - permission java.lang.RuntimePermission "getClassLoader"; - permission java.util.PropertyPermission "java.rmi.server.codebase", "read"; - permission java.util.PropertyPermission "java.rmi.server.hostname", "read"; - permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write"; -}; - -//grant { -// permission java.security.AllPermission; -//}; diff --git a/test/files/detach-run/basic-run.check b/test/files/detach-run/basic-run.check deleted file mode 100644 index 6463d97497..0000000000 --- a/test/files/detach-run/basic-run.check +++ /dev/null @@ -1,5 +0,0 @@ -Server.main 8889 -> Client.main 127.0.0.1 8889 -yInstVal = 10 -zLocVal = 1000 -result received: 11111 diff --git a/test/files/detach-run/basic/Client.scala b/test/files/detach-run/basic/Client.scala deleted file mode 100644 index f8eddb041d..0000000000 --- a/test/files/detach-run/basic/Client.scala +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.net._, Thread._, ClientHelper._ -import scala.remoting._, Debug._ - -object Foo { - def trace(s: String) { info("[Foo.trace] "+s)} -} -object Client { - val yInstVal: Int = 10 - var yInstVar: Int = 99 - object Bar { - def trace(s: String) { info("[Bar.trace] "+s) } - } - def main(args: Array[String]) { - init(args) - val server = new Channel(host, port) - val zLocVal: Int = 1000 - var zLocVar: Int = 9998 - server ! detach( - (x: Int) => { - println("yInstVal = "+yInstVal) - this.trace("yInstVar = "+yInstVar) - Bar.trace("zLocVal = "+zLocVal) - Foo.trace("zLocVar = "+zLocVar) - zLocVar += 2 - System.out.println("zLocVal = "+zLocVal) - Debug.info("zLocVar = "+zLocVar) - x + yInstVal + yInstVar + zLocVal + zLocVar - }) - val result = server.receiveInt - println("result received: " + result) - } - private def trace(s: String) { info("[Client.trace] "+s) } -} - -object ClientHelper { - private var _host = "127.0.0.1" - private var _port = 8888 - def host = _host - def port = _port - def init(args: Array[String]) { - try { _host = args(0) } catch { case _ => } - try { _port = args(1).toInt } catch { case _ => } - } -} diff --git a/test/files/detach-run/basic/Server.scala b/test/files/detach-run/basic/Server.scala deleted file mode 100644 index f8aa02a4ba..0000000000 --- a/test/files/detach-run/basic/Server.scala +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.remoting.ServerChannel - -object Server extends ServerConsole { - private def computation(f: Int => Int): Int = { - //some time-consuming task - f(2) - } - def main(args: Array[String]) { - val server = new ServerChannel(args(0).toInt) - loop { - val client = server.accept - val f = client.receive[Int => Int] - val result = computation(f) - client ! result - } - server.close() - } -} diff --git a/test/files/detach-run/basic/ServerConsole.scala b/test/files/detach-run/basic/ServerConsole.scala deleted file mode 100644 index 65b81c0ca1..0000000000 --- a/test/files/detach-run/basic/ServerConsole.scala +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.io._ - -import scala.compat.Platform.currentTime -import scala.remoting.Debug, Debug._ - -trait ServerConsole extends Thread { - private val startTime = currentTime - - start() - - private var isTerminated = false - - def terminate() { isTerminated = true } - - protected def loop(block: => Unit) { - while (!isTerminated) { - try { - block - } - catch { - case e: ObjectStreamException => - trace("Object stream error ("+e.getMessage+")") - case e: EOFException => - trace("Connection lost") - case e: ClassNotFoundException => - trace("Class not found") - case e => - trace("Server error: "+e) - } - } - } - - override def run() { - val in = new BufferedReader(new InputStreamReader(System.in)) - var quit = false - while (!quit) { - val args = getArgs(in) - if (args contains "quit") - quit = true - if (args contains "cls") { - println(ERASE_SCREEN) - println(CURSOR_HOME) - } - if (args contains "warning") - Debug.level = Level.WARNING - if (args contains "info") - Debug.level = Level.INFO - if (args contains "silent") - Debug.level = Level.SILENT - } - terminate() - println("Server exited ("+mkTimeString(currentTime - startTime)+")") - exit(0) - - } - - protected def trace(msg: String) { - Debug.info("[ServerConsole.trace] "+msg) - } - - private def getArgs(in: BufferedReader): List[String] = { - print("> ") - val input = try { in.readLine() } catch { case _ => null } - if (input != null) (input.trim split "\\s+").toList else Nil - } - - private def mkTimeString(time: Long): String = { - def twoDigits(i: Long) = (if (i < 10) "0" else "")+i - val sec = time / 1000 - val min = sec / 60 - val h = min / 60 - twoDigits(h) +":"+ - twoDigits(min - h * 60)+":"+ - twoDigits(sec - min * 60) - } - - private val ERASE_SCREEN = "\033[2J" - private val CURSOR_HOME = "\033[H" -} diff --git a/test/files/detach-run/basic/basic.flags b/test/files/detach-run/basic/basic.flags deleted file mode 100644 index 55eed8bbcd..0000000000 --- a/test/files/detach-run/basic/basic.flags +++ /dev/null @@ -1 +0,0 @@ --Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable diff --git a/test/files/detach-run/basic/basic.scala b/test/files/detach-run/basic/basic.scala deleted file mode 100644 index 4d0fc2d933..0000000000 --- a/test/files/detach-run/basic/basic.scala +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -object Test { - - val name = "basic" - val host = "127.0.0.1" - val port = 8889 - - def main(args: Array[String]) { - setenv() - println("Server.main "+port) - server.start() - println("Client.main "+host+" "+port) - client.start() - server.terminate() - } - - private var server = new ServerThread(port) - private var client = new ClientThread(host, port) - - private class ServerThread(port: Int) extends Runnable { - private var th = new Thread(this) - def start() { th.start(); Thread.sleep(1000) } - def run() { Server.main(Array(port.toString)) } - def terminate() { Server.terminate(); sys.exit(0) } - } - - private class ClientThread(host: String, port: Int) extends Runnable { - private var th = new Thread(this) - def start() { th.start(); th.join() } - def run() { Client.main(Array(host, port.toString)) } - } - - private def setenv() { - import Env._ - - // Java properties for server & client - System.setProperty("scala.remoting.logLevel", logLevel) - System.setProperty("java.security.manager", "") - System.setProperty("java.security.policy", policyFile) - // Java properties for server only - System.setProperty("java.rmi.server.codebase", deployUrl) - System.setProperty("java.rmi.server.hostname", host) - System.setProperty("java.rmi.server.useCodebaseOnly", "true") - - // application-secific classes to be deployed and accessed via URL - // (i.e. detached closure, proxy interfaces and proxy stubs) - val classNames = List( - "Bar$proxy", - "Bar$proxyImpl_Stub", - "Client$$anonfun$main$1$detach", - "Client$proxy", - "Client$proxyImpl_Stub", - "Foo$proxy", - "Foo$proxyImpl_Stub") - - val proxyImplNames = - for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0) - yield n.substring(0, i) - - generatePolicyFile() - generateRmiStubs(proxyImplNames) - generateJarFile(classNames) - } -} - -object Env { - import java.io._, java.util.jar._ - - val actors_logLevel = "0" - // = "3" // info+warning+error - val logLevel = "silent" - // = "info" // debug user code only - // = "info,lib" // debug user & library code - - // we assume an Apache server is running locally for deployment - private val sep = File.separator - val docPath = System.getProperty("user.home")+sep+"public_html" - val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name") - - private val policyTmpl = - System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy" - val outPath = System.getProperty("partest.output") - val libPath = System.getProperty("partest.lib") - val policyFile = outPath+sep+"java.policy" - val codebaseDir = outPath+sep+"-" - - assert((new File(docPath)).isDirectory, - "Root directory \""+docPath+"\" not found") - val deployJar = docPath+sep+Test.name+"_deploy.jar" - val deployUrl = docRoot+"/"+Test.name+"_deploy.jar" - - def generatePolicyFile() { - val in = new BufferedReader(new FileReader(policyTmpl)) - val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile))) - var line = in.readLine() - while (line != null) { - val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir) - out.println(line1) - line = in.readLine() - } - in.close() - out.close() - } - - def generateRmiStubs(classNames: List[String]) { - val options = List( - "-v1.2", - "-classpath "+libPath+File.pathSeparator+outPath, - "-d "+outPath) - rmic(options, classNames) - //ls(outPath) - } - - def generateJarFile(classNames: List[String]) { - val out = new JarOutputStream(new FileOutputStream(deployJar)) - classNames foreach (name => try { - val classFile = name+".class" - val in = new FileInputStream(outPath+sep+classFile) - out putNextEntry new JarEntry(classFile) - val buf = new Array[Byte](512) - var len = in read buf - while (len != -1) { - out.write(buf, 0, len) - len = in read buf - } - in.close() - } catch { - case e: FileNotFoundException => println(e) - }) - out.close() - } - - private def ls(path: String) { exec("ls -al "+path) } - - private def rmic(options: List[String], classNames: List[String]) { - val javaHome = scala.util.Properties.javaHome - val jdkHome = - if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4) - else javaHome - val rmicExt = if (scala.util.Properties.isWin) ".exe" else "" - val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt - val cmdLine = rmicCmd+options.mkString(" ", " ", "")+ - classNames.mkString(" "," ","") - // println(cmdLine) - exec(cmdLine) - } - - private def exec(command: String) { - val proc = Runtime.getRuntime exec command - proc.waitFor() - val out = new BufferedReader(new InputStreamReader(proc.getInputStream)) - var line = out.readLine() - while (line != null) { - println(line) - line = out.readLine() - } - out.close() - val err = new BufferedReader(new InputStreamReader(proc.getErrorStream)) - line = err.readLine() - while (line != null) { - println(line) - line = err.readLine() - } - err.close() - } -} diff --git a/test/files/detach-run/basic/java.policy b/test/files/detach-run/basic/java.policy deleted file mode 100644 index 92c1045c3d..0000000000 --- a/test/files/detach-run/basic/java.policy +++ /dev/null @@ -1,26 +0,0 @@ -// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html -// See http://mindprod.com/jgloss/policyfile.html -// The policy expands ${/} to the correct path or folder delimiter on your host platform. - -// Actions available with SocketPermission: accept, connect, listen, resolve -// 1) The "resolve" action is implied when any of the other actions are present. -// 2) The "listen" action is only meaningful when used with "localhost". - -grant { - permission java.net.SocketPermission "*:80", "connect,accept,listen"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "scala.remoting.logLevel", "read"; - permission java.util.PropertyPermission "scala.remoting.port", "read"; -}; - -grant codeBase "@PROJECT_LIB_BASE@" { - permission java.lang.RuntimePermission "getClassLoader"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.util.PropertyPermission "java.rmi.server.codebase", "read"; - permission java.util.PropertyPermission "java.rmi.server.hostname", "read"; - permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write"; -}; - -//grant { -// permission java.security.AllPermission; -//}; |