Scala-Java incompatibility referencing static fields in a class with the same name as a static inner class -


take java class:

public class fisk {      public static class {     }      public static a = new a(); } 

this java code works:

    fisk.a = new fisk.a();     fisk.a b = fisk.a; 

but calling scala:

    val fisk = new fisk.a()     val strupp = fisk.a 

results in compiler-error:

error: ambiguous reference overloaded definition, [info] both variable in object fisk of type fisk.a [info] ,  object in object fisk of type object fisk.a [info] match expected type ? [info]          val strupp = fisk.a [info]                                   ^ [error] 1 error found 

anyone knows way around this, or have rename static field?

-- andreas

scala> fisk.a <console>:8: error: ambiguous reference overloaded definition, both variable in object fisk of type fisk.a ,  object in object fisk of type object fisk.a match expected type ?        fisk.a             ^ // static field of fisk scala> fisk.a: fisk.a res1: fisk.a = fisk$a@d86c58  // new constructed instance of type fisk.a scala> val fisk = new fisk.a() fisk: fisk.a = fisk$a@462f90  // static field of fisk (see same hashcode) scala> val strupp: fisk.a = fisk.a strupp: fisk.a = fisk$a@d86c58 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -