Skip to content

Commit 69d850c

Browse files
committed
Remove code from misc bits of the compiler.
They are everywhere. They defy categorization. They are... M I S C
1 parent c54432c commit 69d850c

File tree

9 files changed

+11
-47
lines changed

9 files changed

+11
-47
lines changed

src/compiler/scala/tools/ant/sabbus/Settings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package scala.tools.ant.sabbus
1010

1111
import java.io.File
1212

13-
import org.apache.tools.ant.types.{Path, Reference}
13+
import org.apache.tools.ant.types.Path
1414

1515
class Settings {
1616

src/compiler/scala/tools/cmd/FromString.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,11 @@ abstract class FromString[+T](implicit t: ru.TypeTag[T]) extends PartialFunction
2424
}
2525

2626
object FromString {
27-
// We need these because we clash with the String => Path implicits.
28-
private def toFile(s: String) = new File(new java.io.File(s))
27+
// We need this because we clash with the String => Path implicits.
2928
private def toDir(s: String) = new Directory(new java.io.File(s))
3029

3130
/** Path related stringifiers.
3231
*/
33-
val ExistingFile: FromString[File] = new FromString[File]()(tagOfFile) {
34-
override def isDefinedAt(s: String) = toFile(s).isFile
35-
def apply(s: String): File =
36-
if (isDefinedAt(s)) toFile(s)
37-
else cmd.runAndExit(println("'%s' is not an existing file." format s))
38-
}
3932
val ExistingDir: FromString[Directory] = new FromString[Directory]()(tagOfDirectory) {
4033
override def isDefinedAt(s: String) = toDir(s).isDirectory
4134
def apply(s: String): Directory =

src/compiler/scala/tools/cmd/Reference.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ trait Reference extends Spec {
2626
def isUnaryOption(s: String) = unary contains toOpt(s)
2727
def isBinaryOption(s: String) = binary contains toOpt(s)
2828
def isExpandOption(s: String) = expansionMap contains toOpt(s)
29-
def isAnyOption(s: String) = isUnaryOption(s) || isBinaryOption(s) || isExpandOption(s)
3029

3130
def expandArg(arg: String) = expansionMap.getOrElse(fromOpt(arg), List(arg))
3231

src/compiler/scala/tools/reflect/ToolBoxFactory.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,6 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
392392
uttree
393393
}
394394

395-
def showAttributed(tree: u.Tree, printTypes: Boolean = true, printIds: Boolean = true, printKinds: Boolean = false): String =
396-
compiler.showAttributed(importer.importTree(tree), printTypes, printIds, printKinds)
397-
398395
def parse(code: String): u.Tree = {
399396
if (compiler.settings.verbose.value) println("parsing "+code)
400397
val ctree: compiler.Tree = compiler.parse(code)

src/compiler/scala/tools/util/Javap.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,11 @@ object Javap {
107107
type FakeEnvironment = AnyRef
108108
type FakePrinter = AnyRef
109109

110-
def apply(path: String): Unit = apply(Seq(path))
111-
def apply(args: Seq[String]): Unit = new JavapClass() apply args foreach (_.show())
112-
113110
sealed trait JpResult {
114111
type ResultType
115112
def isError: Boolean
116113
def value: ResultType
117114
def show(): Unit
118-
// todo
119-
// def header(): String
120-
// def fields(): List[String]
121-
// def methods(): List[String]
122-
// def signatures(): List[String]
123115
}
124116
class JpError(msg: String) extends JpResult {
125117
type ResultType = String

src/compiler/scala/tools/util/PathResolver.scala

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,9 @@ import scala.language.postfixOps
1818
// https://wiki.scala-lang.org/display/SW/Classpath
1919

2020
object PathResolver {
21-
// Imports property/environment functions which suppress
22-
// security exceptions.
21+
// Imports property/environment functions which suppress security exceptions.
2322
import AccessControl._
2423

25-
def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse ""
26-
27-
/** Map all classpath elements to absolute paths and reconstruct the classpath.
28-
*/
29-
def makeAbsolute(cp: String) = ClassPath.map(cp, x => Path(x).toAbsolute.path)
30-
3124
/** pretty print class path */
3225
def ppcp(s: String) = split(s) match {
3326
case Nil => ""
@@ -45,7 +38,6 @@ object PathResolver {
4538
/** Environment variables which java pays attention to so it
4639
* seems we do as well.
4740
*/
48-
def classPathEnv = envOrElse("CLASSPATH", "")
4941
def sourcePathEnv = envOrElse("SOURCEPATH", "")
5042

5143
def javaBootClassPath = propOrElse("sun.boot.class.path", searchForBootClasspath)
@@ -85,7 +77,6 @@ object PathResolver {
8577

8678
def scalaHome = Environment.scalaHome
8779
def scalaHomeDir = Directory(scalaHome)
88-
def scalaHomeExists = scalaHomeDir.isDirectory
8980
def scalaLibDir = Directory(scalaHomeDir / "lib")
9081
def scalaClassesDir = Directory(scalaHomeDir / "classes")
9182

@@ -108,15 +99,7 @@ object PathResolver {
10899
// classpath as set up by the runner (or regular classpath under -nobootcp)
109100
// and then again here.
110101
def scalaBootClassPath = ""
111-
// scalaLibDirFound match {
112-
// case Some(dir) if scalaHomeExists =>
113-
// val paths = ClassPath expandDir dir.path
114-
// join(paths: _*)
115-
// case _ => ""
116-
// }
117-
118102
def scalaExtDirs = Environment.scalaExtDirs
119-
120103
def scalaPluginPath = (scalaHomeDir / "misc" / "scala-devel" / "plugins").path
121104

122105
override def toString = """
@@ -135,7 +118,7 @@ object PathResolver {
135118
)
136119
}
137120

138-
def fromPathString(path: String, context: JavaContext = DefaultJavaContext): JavaClassPath = {
121+
def fromPathString(path: String, context: JavaContext = DefaultJavaContext): JavaClassPath = { // called from scalap
139122
val s = new Settings()
140123
s.classpath.value = path
141124
new PathResolver(s, context) result
@@ -160,7 +143,7 @@ object PathResolver {
160143
}
161144
}
162145
}
163-
import PathResolver.{ Defaults, Environment, firstNonEmpty, ppcp }
146+
import PathResolver.{ Defaults, Environment, ppcp }
164147

165148
class PathResolver(settings: Settings, context: JavaContext) {
166149
def this(settings: Settings) = this(settings, if (settings.inline.value) new JavaContext else DefaultJavaContext)

src/continuations/library/scala/util/continuations/ControlContext.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ final class ControlContext[+A,-B,+C](val fun: (A => B, Exception => B) => C, val
183183

184184
// need filter or other functions?
185185

186-
final def flatMapCatch[A1>:A,B1<:B,C1>:C<:B1](pf: PartialFunction[Exception, ControlContext[A1,B1,C1]]): ControlContext[A1,B1,C1] = {
186+
final def flatMapCatch[A1>:A,B1<:B,C1>:C<:B1](pf: PartialFunction[Exception, ControlContext[A1,B1,C1]]): ControlContext[A1,B1,C1] = { // called by codegen from SelectiveCPSTransform
187187
if (fun eq null)
188188
this
189189
else {
@@ -209,7 +209,7 @@ final class ControlContext[+A,-B,+C](val fun: (A => B, Exception => B) => C, val
209209
}
210210
}
211211

212-
final def mapFinally(f: () => Unit): ControlContext[A,B,C] = {
212+
final def mapFinally(f: () => Unit): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
213213
if (fun eq null) {
214214
try {
215215
f()

src/continuations/library/scala/util/continuations/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ package object continuations {
166166
throw new NoSuchMethodException("this code has to be compiled with the Scala continuations plugin enabled")
167167
}
168168

169-
def shiftUnitR[A,B](x: A): ControlContext[A,B,B] = {
169+
def shiftUnitR[A,B](x: A): ControlContext[A,B,B] = { // called in code generated by SelectiveCPSTransform
170170
new ControlContext[A, B, B](null, x)
171171
}
172172

@@ -176,11 +176,11 @@ package object continuations {
176176
* a final result.
177177
* @see shift
178178
*/
179-
def shiftR[A,B,C](fun: (A => B) => C): ControlContext[A,B,C] = {
179+
def shiftR[A,B,C](fun: (A => B) => C): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
180180
new ControlContext((f:A=>B,g:Exception=>B) => fun(f), null.asInstanceOf[A])
181181
}
182182

183-
def reifyR[A,B,C](ctx: => ControlContext[A,B,C]): ControlContext[A,B,C] = {
183+
def reifyR[A,B,C](ctx: => ControlContext[A,B,C]): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
184184
ctx
185185
}
186186

src/detach/plugin/scala/tools/detach/Detach.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract class Detach extends PluginComponent
7373
}
7474

7575
private val serializableAnnotationInfo =
76-
AnnotationInfo(SerializableAttr.tpe, List(), List())
76+
AnnotationInfo(requiredClass[scala.annotation.serializable].tpe, List(), List())
7777
/*
7878
private val throwsAnnotationInfo = {
7979
val RemoteExceptionClass = definitions.getClass("java.rmi.RemoteException")

0 commit comments

Comments
 (0)