14

Possible Duplicate:
Using Java Lib with Scala Reserved Words

I'm experimenting with Scala, and a Java library I'm using has a with method on one of its objects, but with is a keyword in Scala. How do I call this method from my Scala code?

Community
  • 1
  • 1
Christopher Currie
  • 3,025
  • 1
  • 29
  • 40
  • 1
    See also: http://stackoverflow.com/questions/6576594/need-clarification-on-scala-literal-identifiers-backticks – Debilski Jul 06 '11 at 21:52

1 Answers1

18

From http://ofps.oreilly.com/titles/9780596155957/TypeLessDoMore.html#ReservedWords

Some Java methods use names that are reserved by Scala, e.g., java.util.Scanner.match. To avoid a compilation error, surround the name with single back quotes, e.g., java.util.Scanner.‵match‵.

(edited for formatting)

Dylan
  • 13,645
  • 3
  • 40
  • 67