From b653fc7db1ce61016ed81d34c7d8ffd4b3e077f1 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 23 Feb 2021 15:07:31 -0500 Subject: [PATCH] deprecate hasTargets (#252) hasTargets has the potential to allow users to inadvertantly create NPEs. --- photon-lib/src/main/java/org/photonvision/PhotonCamera.java | 3 +++ photon-lib/src/main/native/include/photonlib/PhotonCamera.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java index 2557b06c8..e75ed5c1b 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java @@ -190,6 +190,9 @@ public class PhotonCamera { /** * Returns whether the latest target result has targets. * + *

This method is deprecated; {@link PhotonPipelineResult#hasTargets()} should be used instead. + * + * @deprecated This method should be replaced with {@link PhotonPipelineResult#hasTargets()} * @return Whether the latest target result has targets. */ public boolean hasTargets() { diff --git a/photon-lib/src/main/native/include/photonlib/PhotonCamera.h b/photon-lib/src/main/native/include/photonlib/PhotonCamera.h index b6c87aefa..9cf844933 100644 --- a/photon-lib/src/main/native/include/photonlib/PhotonCamera.h +++ b/photon-lib/src/main/native/include/photonlib/PhotonCamera.h @@ -115,6 +115,10 @@ class PhotonCamera { /** * Returns whether the latest target result has targets. + * This method is deprecated; {@link PhotonPipelineResult#hasTargets()} should + * be used instead. + * @deprecated This method should be replaced with {@link + * PhotonPipelineResult#hasTargets()} * @return Whether the latest target result has targets. */ bool HasTargets() const { return GetLatestResult().HasTargets(); }