summaryrefslogtreecommitdiff
path: root/test/script-tests/jar-manifest/src/jar-test.scala
blob: 80e3aafff04adf76a7e235d939a3063b43d4fdd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import scala.tools.nsc.util.HasClassPath

package bippy {
  object Runner {
    var line = 0
    def echo(msgs: Any*) = {
      line += 1
      Console.println("%-2s %s".format(line, msgs mkString " "))
    }

    def bippyBoo(quuxParameter: Int) = 5
    def bippyBingle(imparametorium: String, antidisestablish: Int, x: Float) = ()

    def main(args: Array[String]): Unit = {
      echo(new dingus.Printable)
      val namer = new com.thoughtworks.paranamer.BytecodeReadingParanamer
      getClass.getMethods filter (_.getName startsWith "bippy") foreach { m =>
        echo(m.getName, "has parameters:", namer.lookupParameterNames(m).mkString(", "))
      }
      echo("")
      echo("Urls exposed through the classloader:")
      getClass.getClassLoader match {
        case x: HasClassPath => x.classPathURLs foreach (x => echo(x))
        case _               => echo("None! Seems unlikely we'd get this far then.")
      }
    }
  }
}

package dingus {
  class Printable {
    override def toString = "\"Greetings from dingus.jar!\""
  }
}