Skip to content

Scala runner does not expand wildcards in classpath #17489

Open
@olhotak

Description

@olhotak

Compiler version

Scala code runner version 3.2.2 -- Copyright 2002-2023, LAMP/EPFL

Minimized code

cat << EOF > A.scala
object A {
  def main(args: Array[String]) = println("hello")
}
EOF
mkdir classes lib
scalac -d classes A.scala
cd classes
jar cf ../lib/lib.jar *
cd ..
scala -classpath 'lib/*.jar' A

Output

Ignoring spurious arguments: A
Welcome to Scala 3.2.2 (11.0.18, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                            
scala> 

Expectation

In Scala 2.13, the output is

hello

If the Scala 2.13 behaviour is not possible, I would at least expect a more informative error message. Was the runner thinking that lib/*.jar was the name of the class that was to be executed rather than an argument to -classpath? Or if it thought A was the class to be executed, the error should say that it couldn't find A on the classpath, rather than that A is a spurious argument.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions