scala - Type aliasing Java classes with statics -


suppose myclass class defined in java, , has many static non-static members. tried alias class (and associated companion object) in scala object myobject shown below:

object myobject {   import javastuff._   type myalias = myclass   val myalias = myclass } 

scalac complains:

error: object myclass not value val myalias = myclass 

how work around this? thanks.

although works in pure scala class + companion object, it's not possible java's static methods, these don't belong interface.

scala could, in theory, create object containing delegates static methods of class, doesn't currently. it's possible write compiler plugin if feel comfortable writing plugins.

failing that, you'll either have create object full of delegates yourself, or cherry-pick few methods , pass them around functions.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -