Closed buzden closed 6 years ago
Also, I suggest to add something like the following as a test.
object A { // Nice main class.
def main(args: Array[String]): Unit = println("Hello, normal object!")
}
class X private { // Should not be considered as a main class.
def main(args: Array[String]): Unit = println("Hello, private parameterless constructor!")
}
class Y(z: Int) { // Should not be considered as a main class.
def main(args: Array[String]): Unit = println("Hello, parameterized constructor!")
}
class Z { // Okay as a main class for cbt.
def main(args: Array[String]): Unit = println("Hello, public parameterless constructor!")
}
It is expected that (having this, for instance, in a single and only file of a project) cbt run
does not fail and suggests you to run either A
or Z
as a main-class.
Could you give an example of what this is fixing? Maybe including the code and call that trigger it, the problem you are seeing and what you are expecting to see instead?
Classes X
and Y
from above are examples of the situation when their existence in a project leads to simple failing of the cbt when trying to do cbt run
.
ah, sorry. forgot to read the related ticket.
ah, great. LGTM.
Possible fix for #585. Classes with non-public or parameterized contructors were made to be not searched by the main class searcher. This leads to
def main(args: Array[String])
at the same time);And, oh, I changed the signature of the
typeStaticMethod
, but I hope I made it more correct (since, as far as I can see, you use -OrFail
suffix for those methods you are expecting to be easily failing).