gradle-baseline
gradle-baseline copied to clipboard
[IllegalSafeLoggingArgument] Prevent subclasses from overriding methods to be less safe
What happened?
While working on another PR, I saw something that was roughly this situation:
interface MyInterface {
@Safe
String myMethod();
}
class MyClass implements MyInterface {
@Unsafe
String myMethod() {
return "The secret is 42";
}
}
(with SafeLoggable
and RemoteException
)
What did you want to happen?
I would expect IllegalSafeLoggingArgument
to throw an error, but it did not.
Next Steps
Should verify what the current behavior is with a test in this repo.
Yes, we should cause compilation to fail in that case, as well as the case where an unmarked class attempts to implement two interfaces with different safety values for a given method -- these examples violate the liskov substitution principle.
https://github.com/palantir/gradle-baseline/pull/2699