i want java.lang.class
scala package object:
app/package.scala:
package object app { }
app/main.scala:
package app
object main extends app { val _ = app.getclass }
compilation fails with:
object getclass not member of package app note app extends any, not anyref. such types can participate in value classes, instances cannot appear in singleton types or in reference comparisons.
you can define method inside app returning class:
package object app { def cls = getclass }
Comments
Post a Comment