简体   繁体   English

Sikuli类型方法是Scala IDE中的关键字

[英]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. 我已经开始在Scala上开发测试应用程序,我是scala和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. 我正在使用最新的(基于Kepler)IDE,发现那里的“ type”是一个关键字,不允许我编译我的应用程序。 When I try to call a sikuli method "type", like: 当我尝试将sikuli方法称为“类型”时,例如:

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? 我知道我可以创建一个Java类来包装此类方法,并且将仅提供重命名的方法,甚至更改sikuli源中的方法名称,但是我认为这些不是最佳的解决方案。我告诉IDE类型只是方法名称,而不是关键字?

Thank you! 谢谢!

Enclose the type method in backticks like this: type方法放在反引号中,如下所示:

s.`type`(Key.ENTER)

See Need clarification on Scala literal identifiers (backticks) for more information. 有关更多信息,请参见Scala文字标识符(反引号)的需要说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM