From ebca9c9ee89c5654f2e748ef12e755abdc286d34 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 5 Nov 2023 07:36:55 -0500 Subject: [PATCH] Add support for RISC-V in ArchUtils #1128 --- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/lang3/ArchUtils.java | 4 ++-- src/main/java/org/apache/commons/lang3/arch/Processor.java | 6 +++--- src/test/java/org/apache/commons/lang3/ArchUtilsTest.java | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 281e437ca..eab567380 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -79,6 +79,7 @@ The type attribute can be add,update,fix,remove. Add ExceptionUtils.throwUnchecked(T) where T extends Throwable, and deprecate Object version. Add ExceptionUtils.rethrowRuntimeException(T), and deprecate rethrow(T). ConcurrentInitializer implementations can now be instantiated and configured with allocation and release lambdas. + Add support for RISC-V in ArchUtils #1128. Bump commons-parent from 58 to 64. Bump org.easymock:easymock from 5.1.0 to 5.2.0 #1104. diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java index 25a644c4e..547ed9cd1 100644 --- a/src/main/java/org/apache/commons/lang3/ArchUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java @@ -121,11 +121,11 @@ public class ArchUtils { } private static void init_RISCV_32Bit() { - addProcessors(new Processor(Processor.Arch.BIT_32, Processor.Type.RISCV), "riscv32"); + addProcessors(new Processor(Processor.Arch.BIT_32, Processor.Type.RISC_V), "riscv32"); } private static void init_RISCV_64Bit() { - addProcessors(new Processor(Processor.Arch.BIT_64, Processor.Type.RISCV), "riscv64"); + addProcessors(new Processor(Processor.Arch.BIT_64, Processor.Type.RISC_V), "riscv64"); } private static void init_X86_32Bit() { diff --git a/src/main/java/org/apache/commons/lang3/arch/Processor.java b/src/main/java/org/apache/commons/lang3/arch/Processor.java index 2fc18cb65..8466944e8 100644 --- a/src/main/java/org/apache/commons/lang3/arch/Processor.java +++ b/src/main/java/org/apache/commons/lang3/arch/Processor.java @@ -112,7 +112,7 @@ public class Processor { * * @since 3.14.0 */ - RISCV("RISC-V"), + RISC_V("RISC-V"), /** * Unknown architecture. @@ -236,11 +236,11 @@ public class Processor { /** * Tests if {@link Processor} is type of RISC-V. * - * @return {@code true}. if {@link Processor} is {@link Type#RISCV}, else {@code false}. + * @return {@code true}. if {@link Processor} is {@link Type#RISC_V}, else {@code false}. * @since 3.14.0 */ public boolean isRISCV() { - return Type.RISCV == type; + return Type.RISC_V == type; } @Override diff --git a/src/test/java/org/apache/commons/lang3/ArchUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArchUtilsTest.java index 64519e97f..7517418ff 100644 --- a/src/test/java/org/apache/commons/lang3/ArchUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ArchUtilsTest.java @@ -104,11 +104,11 @@ public class ArchUtilsTest extends AbstractLangTest { assertTrue(processor.isAarch64()); processor = ArchUtils.getProcessor(RISCV_32); - assertEqualsTypeNotNull(Processor.Type.RISCV, processor); + assertEqualsTypeNotNull(Processor.Type.RISC_V, processor); assertTrue(processor.isRISCV()); processor = ArchUtils.getProcessor(RISCV_64); - assertEqualsTypeNotNull(Processor.Type.RISCV, processor); + assertEqualsTypeNotNull(Processor.Type.RISC_V, processor); assertTrue(processor.isRISCV()); }