/**
* Created by hamsterofdeath on 3/19/17.
*/
class WarningDemo {
class A {
// library code, cannot change it
def something = {}
}
class B extends A {
// warning type 1 here ;(
override def something() = {}
}
class C extends A {
// warning type 2 here ;(
override def something = {}
}
}
I assume you mean these warnings (please include such in your post, for clarity):
- Warning.scala:12: non-nullary method overrides nullary method
- Warning.scala:16: side-effecting nullary methods are discouraged: suggest defining as
def something()
instead
Adding -Xlint:-nullary-unit
turns off #2. -Xlint:-nullary-override
turns off #1. These aren’t great alternatives—both guard against common bugs—but I suppose -Xlint:-nullary-unit
is the lesser evil.
Meh, try to get the upstream to fix it too.
1 Like