From 6e7836a14d164258445460d56d4f1ddca278d508 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Mon, 12 Aug 2024 02:07:43 -0400 Subject: [PATCH] [wpilib] Deprecate Resource --- wpilibc/src/main/native/cpp/Resource.cpp | 4 ++++ wpilibc/src/main/native/include/frc/Resource.h | 3 ++- wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wpilibc/src/main/native/cpp/Resource.cpp b/wpilibc/src/main/native/cpp/Resource.cpp index 1f0e3486eb5..de32e11631f 100644 --- a/wpilibc/src/main/native/cpp/Resource.cpp +++ b/wpilibc/src/main/native/cpp/Resource.cpp @@ -4,8 +4,11 @@ #include "frc/Resource.h" +#include + #include "frc/Errors.h" +WPI_IGNORE_DEPRECATED using namespace frc; wpi::mutex Resource::m_createMutex; @@ -17,6 +20,7 @@ void Resource::CreateResourceObject(std::unique_ptr& r, r = std::make_unique(elements); } } +WPI_UNIGNORE_DEPRECATED Resource::Resource(uint32_t elements) { m_isAllocated = std::vector(elements, false); diff --git a/wpilibc/src/main/native/include/frc/Resource.h b/wpilibc/src/main/native/include/frc/Resource.h index 6d9dfa58500..ecc5bca5894 100644 --- a/wpilibc/src/main/native/include/frc/Resource.h +++ b/wpilibc/src/main/native/include/frc/Resource.h @@ -23,8 +23,9 @@ namespace frc { * The Resource class does not allocate the hardware channels or other * resources; it just tracks which indices were marked in use by Allocate and * not yet freed by Free. + * @deprecated Use the HandleResource classes instead */ -class Resource { +class [[deprecated("Use the HandleResource classes instead")]] Resource { public: virtual ~Resource() = default; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java index f4b04587ad4..ba97ca4d700 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java @@ -19,7 +19,10 @@ * created. Then, when the program actually starts - in the Robot constructor, all resources are * initialized. This ensures that the program is restartable in memory without having to * unload/reload. + * + * @deprecated Will be removed with no replacement. */ +@Deprecated(forRemoval = true, since = "2025") public final class Resource { private static Resource resourceList; private final boolean[] m_numAllocated;