Commit Graph

35 Commits

Author SHA1 Message Date
Mikhael Bogdanov 0a8454d5fc Remove FULL_JDK from AbstractForeignAnnotationsTest tests 2020-03-04 14:51:16 +01:00
victor.petukhov 30762a450a Wrap diagnostic parameters to double quotes and split by comma instead of semicolon 2019-02-14 12:31:42 +03:00
Tor Norbye a42406f2aa KT-29586: Add android.annotation annotations
KT-29586 Fixed
2019-01-31 17:12:56 +03:00
Denis Zharkov 89d99e3989 Refine diagnostics for nullability migration warnings
#KT-24911 Fixed
2018-07-13 17:51:21 +03:00
Denis Zharkov 9de174959e Support androidx under-migration-like nullability annotations
They are hardcoded to avoid having dependency from android.jar on
our annotations' jar with UnderMigration.

Even while it could be a compile-only dependency we need to make sure
that annotated types are read properly without RecentlyNonNull/RecentlyNullable
in the classpath

 #KT-24278 Fixed
2018-05-14 17:16:15 +03:00
Jake Wharton b22f051edb Add support for nullability annotations in androidx package. 2018-03-15 10:34:33 +03:00
Dmitry Savvinov 4d951de616 Propagate nullability changes to enhancement for JSR-305 types
Fix TypeUtils.makeNullableAsSpecified for SimpleTypeWithEnhancement and
FlexibleTypeWithEnhancement: change nullability of enhancement too. This
fixes several false-positive warnings, like in KT-20855 and KT-20466.

Note that it removes warning in some cases (see testdata change for
uselessElvisRightIsNull.kt). However, this removes warning about
*unnecessary* elvis, i.e. this fixed introduces weak false-negatives, which
is acceptable for the moment.

#KT-20855 Fixed Target versions 1.2.30
#KT-20466 Fixed Target versions 1.2.30
#KT-21238 Fixed Target versions 1.2.30
2018-01-26 12:49:14 +03:00
Chris Povirk ac87ad422d Recognize Checker Framework declaration annotations.
We are migrating Guava to use these annotations rather than jsr305's
@Nullable. We can't use the Checker Framework's _@Nullable_ yet because
we promise compatibility with Java 7, which doesn't support type
annotations. This is related to but distinct from
https://youtrack.jetbrains.com/issue/KT-21408, which is about a
different jsr305 annotation we use, @ParametersAreNonnullByDefault.

I've also updated some docs to mention Kotlin's existing support for the
Checker Framework _@NonNull_.
2017-12-27 13:23:06 +01:00
Denis Zharkov fa6285d32a Fix NPE in JavaNullabilityChecker when checking equals-calls
This NPE was introduced in ce41b5745a
Prior to the latter change there was a synthetic PSI element for each
equals-related call, thus callOperationNode was not null here.

== are intentionally treated as safe calls, but for nullability checker
it's not relevant, it only should report warnings on real safe-calls
2017-12-14 19:15:41 +03:00
e5l 1e157d6480 Use report policy from TypeQualifierDefault annotation if possible 2017-10-03 16:44:02 +03:00
Leonid Stashevsky 95d32d8d1e Add @UnderMigration annotation and options for report level 2017-10-03 16:44:02 +03:00
Denis Zharkov fdc6b37264 Obtain default type qualifiers from value parameters too
#KT-20016 In Progress
2017-09-26 16:40:47 +03:00
Denis Zharkov 775d6988e8 Preserve flexibility for Java types annotated with @NonNull(UNKNOWN)
Before this chanhe, these annotations are simply ignored, but they should
preserve flexibility in case of enhanced nullability obtained from
enclosing default qualifier

 #KT-20158 Fixed
2017-09-26 16:40:47 +03:00
Denis Zharkov 02d3d9785c Move JSR-305 tests to one directory and strip common name prefix 2017-09-26 16:40:47 +03:00
Denis Zharkov 8a66919a5c Support @NonNull(when = NEVER) nullability annotation
#KT-20131 Fixed
2017-09-26 16:40:47 +03:00
Denis Zharkov c7812beea4 Fix SOE in SignatureEnhancement::extractNullability
The problem was that `resolveTypeQualifierAnnotation` actually doesn't
guarantee that `typeQualifierAnnotation` is javax.annotation.NonNull
with argument

It could be just any type qualifier (see the test)
2017-09-22 14:15:11 +03:00
Denis Zharkov 2ca220d442 Ignore built-in type qualifier defaults when Jsr305State=IGNORE 2017-09-14 18:05:32 +03:00
Dmitry Jemerov cc8fbf6078 Store third-party annotations in a separate directory 2017-09-13 17:25:20 +02:00
Denis Zharkov 4e4bf31016 Fix loading JSR-305 nicknames for @CheckForNull annotation
For sake of working without jsr305.jar in the classpath `resolveTypeQualifierAnnotation`
may return javax.annotation.CheckForNull (although the latter is nickname itself)

 #KT-19985 Fixed
2017-08-31 15:13:26 +03:00
baratynskiy 67fdd9f76e javac-wrapper: fixes after rebase and review 2017-08-29 18:01:36 +03:00
baratynskiy 01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03:00
e5l e315249624 Add tests on jsr305 annotations warnings 2017-08-15 11:01:08 +03:00
Denis Zharkov 8898455352 Add tests on foreign annotations without them in classpath
#KT-19419 Fixed
2017-08-11 10:18:41 +07:00
Denis Zharkov a82e313d14 Minor. Fix wrong target in test data for foreign annotations 2017-08-11 10:18:41 +07:00
Denis Zharkov 5453f3067c Load @NonNull(when=UNKNOWN) annotated type as a flexible one 2017-07-03 17:55:37 +03:00
Denis Zharkov e26c210d69 Support TypeQualifierDefault from JSR 305 for nullability qualifiers
#KT-10942 Fixed
2017-07-03 17:55:37 +03:00
Denis Zharkov 57b7b91444 Do not add container annotaions to type artificially
It was only used for type-related nullability/mutability
annotations and it was necessary to remove them
in the descriptor renderer (duplicating their fqnames there).
At the same time they're only needed for types enhancement
where they can be simply restored from type owners' descriptors

The testData changes are more or less correct: this kind of annotations
is bound both to types themselves and their use because of their targets
2017-07-03 17:55:37 +03:00
Denis Zharkov 92f9194112 Support TypeQualifierNickname for nullability annotations
#KT-10942 In Progress
2017-07-03 17:55:37 +03:00
Christopher Horner 8df40eaa46 Add support for RxJava's nullability annotations. 2017-04-20 17:20:39 +03:00
Valentin Kipyatkov ec51076355 DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers 2016-10-11 23:38:54 +03:00
Denis Zharkov a644dd3ae9 Create tests for TYPE_USE nullability annotations
- tests and declarations for checkerframework has been moved,
because they only Java 8 targeted
- tests for eclipse annotations has been just copied,
because there are two jars: one for Java 8 and other for earlier versions
2016-03-16 20:22:59 +03:00
Denis Zharkov 3f3c2bb272 Minor. Update eclipse nullability annotation sources
Accordingly to their repository
2016-03-16 20:22:58 +03:00
Jake Wharton f713adc96e Add support for AOSP's nullability annotations.
These are different than 'android.support.annotation' in that they are used on the JVM for projects within AOSP.
2016-02-15 11:32:09 +03:00
Denis Zharkov 11a96ee8c8 Introduce not null type parameter capability
Java nullability annotations may generate types that currently are not denotable in Kotlin:
class Java {
  void <F> foo(@NotNull F f) {}
}

Type of given value parameter should be not nullable under any substitution:
String/String?/String! because of annotation contract.

NB: Currently there is no full analogues for such types in pure kotlin
2016-01-28 08:36:23 +03:00
Denis Zharkov f4613b8db1 Support foreign nullability annotations
#KT-10418 Fixed
 #KT-10594 Fixed
2016-01-14 19:24:10 +03:00