Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2821b6a4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Annotate Point/PointF with nullability annotations"

parents fde43a2c 30d287aa
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.graphics;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.proto.ProtoOutputStream;
@@ -37,7 +38,7 @@ public class Point implements Parcelable {
        this.y = y;
    }

    public Point(Point src) {
    public Point(@NonNull Point src) {
        this.x = src.x;
        this.y = src.y;
    }
@@ -99,7 +100,7 @@ public class Point implements Parcelable {
    }

    /** @hide */
    public void printShortString(PrintWriter pw) {
    public void printShortString(@NonNull PrintWriter pw) {
        pw.print("["); pw.print(x); pw.print(","); pw.print(y); pw.print("]");
    }

@@ -130,7 +131,7 @@ public class Point implements Parcelable {
     * @param fieldId           Field Id of the Rect as defined in the parent message
     * @hide
     */
    public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
    public void writeToProto(@NonNull ProtoOutputStream protoOutputStream, long fieldId) {
        final long token = protoOutputStream.start(fieldId);
        protoOutputStream.write(PointProto.X, x);
        protoOutputStream.write(PointProto.Y, y);
@@ -141,6 +142,7 @@ public class Point implements Parcelable {
        /**
         * Return a new point from the data in the specified parcel.
         */
        @Override
        public Point createFromParcel(Parcel in) {
            Point r = new Point();
            r.readFromParcel(in);
@@ -150,6 +152,7 @@ public class Point implements Parcelable {
        /**
         * Return an array of rectangles of the specified size.
         */
        @Override
        public Point[] newArray(int size) {
            return new Point[size];
        }
@@ -161,7 +164,7 @@ public class Point implements Parcelable {
     *
     * @param in The parcel to read the point's coordinates from
     */
    public void readFromParcel(Parcel in) {
    public void readFromParcel(@NonNull Parcel in) {
        x = in.readInt();
        y = in.readInt();
    }
+6 −4
Original line number Diff line number Diff line
@@ -16,10 +16,10 @@

package android.graphics;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;


/**
 * PointF holds two float coordinates
 */
@@ -34,7 +34,7 @@ public class PointF implements Parcelable {
        this.y = y; 
    }
    
    public PointF(Point p) { 
    public PointF(@NonNull Point p) {
        this.x = p.x;
        this.y = p.y;
    }
@@ -50,7 +50,7 @@ public class PointF implements Parcelable {
    /**
     * Set the point's x and y coordinates to the coordinates of p
     */
    public final void set(PointF p) { 
    public final void set(@NonNull PointF p) {
        this.x = p.x;
        this.y = p.y;
    }
@@ -134,6 +134,7 @@ public class PointF implements Parcelable {
        /**
         * Return a new point from the data in the specified parcel.
         */
        @Override
        public PointF createFromParcel(Parcel in) {
            PointF r = new PointF();
            r.readFromParcel(in);
@@ -143,6 +144,7 @@ public class PointF implements Parcelable {
        /**
         * Return an array of rectangles of the specified size.
         */
        @Override
        public PointF[] newArray(int size) {
            return new PointF[size];
        }
@@ -154,7 +156,7 @@ public class PointF implements Parcelable {
     *
     * @param in The parcel to read the point's coordinates from
     */
    public void readFromParcel(Parcel in) {
    public void readFromParcel(@NonNull Parcel in) {
        x = in.readFloat();
        y = in.readFloat();
    }