Scala: xxx.type() cannot be used --- use xxx.`type`() instead (backticks)

Asked by DenisD

Hi!

I've started to develop an application on Scala, I'm newbie in both scala and sikuli.
I'm using scala IDE and found that "type" is a keyword there. When I try to call a sikuli method "type", like:
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!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
DenisD
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

type() has made problems from the beginning in various situations.
It will be solved in SikuliX with the availability of a more powerful write() function.

For now (if you do not want to use the nightly build versions of 1.1.0), the easiest solution is a wrapper function, that uses reflection to finally invoke the type() function.

Revision history for this message
DenisD (denis-work-acc) said :
#2

Thank you RaiMan, I found a better solution: we can enclose the type method in backticks like this:
s.`type`(Key.ENTER)

Revision history for this message
RaiMan (raimund-hocke) said :
#3

thanks.