summaryrefslogtreecommitdiff
path: root/stub-annotations/src
AgeCommit message (Collapse)Author
2019-01-23Support non-migration annotationsTor Norbye
Until Android P, the SDK did not contain nullness annotations, so in Android P all annotations were marked as @RecentlyNullable or @RecentlyNonNull. This CL fixes things such that as of master/Q, when a nullness annotation on an API is not new, the annotation is instead mapped to a non-@Migrate annotation as far as the Kotlin compiler is concerned: android.annotation.{NonNull, Nullable}. Also makes some internal annotation processing more efficient. Test: Unit tests included Change-Id: Ia2144b5142cb0ce5e5303a5c72fb9c7c6e3a69d7
2018-07-09111216907: Private stub annotation classes breaks compilationTor Norbye
This CL updates metalava such that it *only* packages the @RecentlyNullable and @RecentlyNonNull annotations as package private stub annotations; the rest of the annotations are packaged as external annotations (which was the case prior to P anyway). It also turns off type-use annotations, since they are not properly supported anyway; their restoral is tracked in issue 111253910. Fixes: 111216907 Test: Unit tests updated Change-Id: I1d454024aeaee60daa8c717d40e352300ff768cc
2018-06-07Fix stub compilation for -showAnnotations (e.g. system api etc)Tor Norbye
Test: Manual compilation Bug: N/A Change-Id: I79dff3a876a1074fa9291a37fcb991669460ee49
2018-06-05Metalava fixes for compatibility with doclavaTor Norbye
This CL updates metalava in a few ways to make its output closer to doclava: * In compat mode, it inserts two spaces instead of one before elements without any visibility modifiers (e.g. package private.) This shows up in private API files. Also fixed it to properly treat Kotlin "internal" modifiers. * Explicitly include private constructors in enum classes * When emitting dex files, don't include inherited methods. Change-Id: Ice04229fbadffd82bc681e9d5fe5486f33e54c73
2018-05-21Improvements to annotation extraction, doconly and nullness migrationTor Norbye
This CL fixes a number of issses in metalava: (1) Support separate stub file generation for android.jar and for documentation stubs. The "--stubs" flag continues to create stubs intended for compilation into android.jar, and the new "--doc-stubs" flag generates stubs intended for documentation migration. Why are these separate, you ask? It turns out the stubs we compile for android.jar needs to be slightly different from those we generate documentation for. Here are some specific examples: (a) In the SDK stubs we'll use different nullness annotations for recently annotated elements than for elements that have been annotated for a while. This allows the Kotlin compiler to treat violations of these contracts as a warning instead of an error. In the documentation, however, we just want the normal @NonNull/@Nullable annotations to show up, not the specialized migration versions of these. (b) @doconly: Some elements, such as R.styleable, are marked with @doconly and should be present when running for example javadoc on the code, but should not be present in the actual SDK. (2) This CL updates the set of stub annotations that the stubs can be compiled with. These are in many cases nearly identical to the androidx.annotations in the support library, but with some notable changes, such as allowing type parameter and type use for the nullness annotations, switching to class retention for a few annotations, and removing some that don't apply. (3) This CL updates the nullness migration to the new scheme supported by Kotlin 1.2.50, and removes earlier handling for multiple stages of migration (@Newly<X> vs @Recently<X>). It also changes the annotation package handling from prefering android.support.annotation to androidx.annotation. There area also various fixes to the nullness coverage code which lets the reports be written to files, which more correctly accounts for static final primitive constants, etc. Finally, misc bug fixes I encountered. At this point, metalava can spit out stubs containing annotations that compile -- and which contain the right migration names for Kotlin. Bug: N/A Test: Unit tests included and updated Change-Id: I4915e199e2e14473df62206015461108bc58b962
2018-01-27Initial version of Metalava.Tor Norbye
For full information, read README.md. Test: ./gradlew test Change-Id: Ibe7cf1162af36f50afa025c3af0ea9cdaa5135c7
2018-01-28Revert "Initial checkin of metalava."Tor Norbye
This reverts commit 52ffe48fd214c9b6e39ac6d4f30cff9afbe9fa25. Reason for revert: <INSERT REASONING HERE> Change-Id: Ied5b40551b2e03419006784340805f7a4cb37611
2018-01-26Initial checkin of metalava.Aurimas Liutikas
This includes the following internal changes: ag/3072760 ag/3466329 ag/3474287 Test: ./gradlew assemble Change-Id: Iecc7996ec8f2cbb453d84e1c63f01ca046464da3