Search code examples
scalatypessikulireserved-words

Sikuli type method is a keyword in Scala IDE


I've started to develop a testing application on Scala, I'm newbie in both scala and sikuli. I'm using the latest (based on Kepler) IDE and found that "type" is a keyword there that doesn't allow me to compile my app. When I try to call a sikuli method "type", like:

val s = new Screen    
s.type(Key.ENTER)

I get following error:

Multiple markers at this line
 - identifier expected but 'type' found.
 - identifier expected but 'type' found.

Could you advise me how I can handle such situations? I understand that I can create a java class that will be a wrap for such methods and will simply provide renamed methods, or even change the method name in sikuli sources, but I don't think that these are the best solutions.. How can I tell the IDE that type is simply a method name, not a keyword?

Thank you!


Solution

  • Enclose the type method in backticks like this:

    s.`type`(Key.ENTER)
    

    See Need clarification on Scala literal identifiers (backticks) for more information.