This isn't a problem with the IDE. A Scala class can't have conflicting symbols, whether or not they are methods or fields. For example, the following won't compile:
class Foo {
val bar = 1
def bar() = "bar"
}
notify
is defined on AnyRef
, and furthermore it is final
, so you don't really have any great options here!
You can name the variable something different, of course:
case class Foo(_notify: String)
If you insist on the variable name, you can also extends AnyVal
, but only if you have exactly one val
parameter:
case class Foo(notify: String) extends AnyVal
You might be looking for the feature that allows you to escape keywords with the grave accent:
case class Foo(`val`: String)
This would allow you to use a keyword (and some other normally illegal variable names) as a variable name. This doesn't apply to your example, since notify
isn't a keyword – it's an already used symbol on the class!
You can also come up with a solution where notify
is private to the class, but that won't work with case classes or most reasonable use cases.