-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the errors reported by NullAway #2776
Conversation
Looks like the majority are not inheriting the annotation from a base. Behavior for this doesn't seem well defined. I'm curious how others treat this, for example does Kotlin treat all these methods as non-null? If so then adding the annotation is good, if not though maybe NullAway interpreting too strictly? |
core/src/main/java/com/linecorp/armeria/client/DefaultClientRequestContext.java
Outdated
Show resolved
Hide resolved
@@ -220,14 +220,14 @@ | |||
|
|||
private static <T extends Annotation> void findMetaAnnotations( | |||
Builder<T> builder, Annotation annotation, | |||
Class<T> annotationType, Class<? extends Annotation> containerType) { | |||
Class<T> annotationType, @Nullable Class<? extends Annotation> containerType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Kotlin also inherits // in Java
interface Super {
@Nullable
String foo();
}
interface NullableSub extends Super {
@Override
String foo();
}
interface NonNullSub extends Super {
@Nonnull
@Override
String foo();
}
// in Kotlin
// Nullable is inherited
val a: NullableSub = ...
val fooA: String? = a.foo()
val b: NonNullSub = ...
val fooB: String = b.foo() |
Kotlin treats non-null by default if it does not have // in Java
class Foo {
@Nullable
String bar() { ... }
String baz() { ... }
}
// in Kotlin
val foo = Foo()
val bar: String? = foo.bar()
val baz: String = foo.baz() |
Only read this on my phone. What @ikhoon said |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, @ikhoon 😄
Oh, it seems like we are getting assertion errors during the build. Perhaps the new |
Oops... |
Codecov Report
@@ Coverage Diff @@
## master #2776 +/- ##
============================================
+ Coverage 72.78% 72.87% +0.08%
- Complexity 11845 11878 +33
============================================
Files 1042 1042
Lines 46090 46159 +69
Branches 5748 5764 +16
============================================
+ Hits 33546 33637 +91
+ Misses 9603 9571 -32
- Partials 2941 2951 +10
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Motivation: Before adopting NullAway(line#1680) or other static analysis tools. Manually run it and clean up errors. Modifications: - Fix all true positives reported by NullAway Result: Less NullAway errors
Motivation:
Before adopting NullAway(#1680) or other static analysis tools.
Manually run it and clean up errors.
Modifications:
Result:
Less NullAway errors