Annotate Point/PointF with nullability annotations
And a missing override or four. Bug: 78245676 Test: none Change-Id: I0293eaeb4ec9659b8ee09ac29351f995bb166dbc
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user