Hello,

I would like to have strong types in the traits which I use.
For example in the trait "TraitA" i have a method fillInMap() in which I am 
adding elements to the "map" field.
The problem is - the IDE do not know what kind of type it is and does not 
support refactoring/code compition/etc - all the staff we are using the IDE for.
All suggestions would be highly appriciated
 
 trait  TraitA {

   def  fillInMap(){
    // here 'map' is with undefined type
    // is there a way to "suggest" its type 
    map.put( 'car1' , 'bmw1' ) 
    map.put( 'car2' , 'bmw2' )
  }
}
  
 class  ClassA  implements  TraitA{
  Map   map  =  new  HashMap ()

   public static void  main(String[] args) {
    ClassA classA =  new  ClassA()
    classA.fillInMap()

    classA. map .each { println it }

  }
} 

Reply via email to