Skip to content
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

[XAT.Bytecode] Add support for reading NotNull metadata into api.xml. #526

Merged
merged 1 commit into from
Dec 2, 2019

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Nov 25, 2019

First part of #468.

This adds support for reading @NotNull/@NonNull annotations from Java and putting them into api.xml. It does not add logic to consume them.

Adds not-null attribute to api.xml for Fields and Parameters:

<field 
  deprecated="not deprecated" 
  final="true" 
  name="CREATOR" 
  jni-signature="Landroid/os/Parcelable$Creator;" 
  not-null="true" 
  static="true" 
  transient="false" 
  type="android.os.Parcelable.Creator" 
  type-generic-aware="android.os.Parcelable.Creator&lt;android.app.DirectAction&gt;" 
  visibility="public" 
  volatile="false" />

<parameter 
  name="handler" 
  type="android.os.Handler" 
  jni-type="Landroid/os/Handler;" 
  not-null="true" />

Adds return-not-null attribute to api.xml for Methods:

<method 
  abstract="false" 
  deprecated="not deprecated" 
  final="true" 
  name="getContext" 
  jni-signature="()Landroid/content/Context;" 
  bridge="false" 
  native="false" 
  return="android.content.Context" 
  jni-return="Landroid/content/Context;" 
  static="false" 
  synchronized="false" 
  synthetic="false" 
  visibility="public" 
  return-not-null="true" />

Supported Annotations

Android:
android/annotation/NonNull
androidx/annotation/NonNull
androidx/annotation/RecentlyNonNull

Java:
javax/validation/constraints/NotNull
edu/umd/cs/findbugs/annotations/NonNull
javax/annotation/Nonnull
org/jetbrains/annotations/NotNull
lombok/NonNull
android/support/annotation/NonNull
org/eclipse/jdt/annotation/NonNull

List partially taken from https://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use.

@jpobst jpobst marked this pull request as ready for review November 27, 2019 17:31
@jpobst jpobst requested a review from jonpryor November 27, 2019 17:31
@jonpryor jonpryor merged commit 18c29b7 into master Dec 2, 2019
@jonpryor jonpryor deleted the parse-nrt branch December 2, 2019 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants