GP-0: Fixing some warnings

This commit is contained in:
Ryan Kurtz 2025-06-13 07:48:40 -04:00
parent 3e53ea7f90
commit 412bd0ffc1
9 changed files with 82 additions and 72 deletions

View file

@ -62,7 +62,7 @@ public enum AnalyzerType {
} }
/** /**
* Return the name of this AnalyzerType. * {@return the name of this AnalyzerType}
*/ */
public String getName() { public String getName() {
return name; return name;

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,13 +26,13 @@ public interface Array {
/** /**
* Removes the value at that index. If the array is of primitive type (int, short, etc), * Removes the value at that index. If the array is of primitive type (int, short, etc),
* then "removing" the value is equivilent to setting the value to 0; * then "removing" the value is equivalent to setting the value to 0;
* @param index int index into the array to remove. * @param index int index into the array to remove.
*/ */
void remove(int index); void remove(int index);
/** /**
* Returns the index of the last non-null or non-zero element in the array. * {@return the index of the last non-null or non-zero element in the array}
*/ */
int getLastNonEmptyIndex(); int getLastNonEmptyIndex();

View file

@ -45,18 +45,17 @@ import ghidra.xml.XmlParseException;
* (See {@link SpecExtension}) using * (See {@link SpecExtension}) using
* {@link SpecExtension#addReplaceCompilerSpecExtension(String, TaskMonitor)} or * {@link SpecExtension#addReplaceCompilerSpecExtension(String, TaskMonitor)} or
* {@link SpecExtension#removeCompilerSpecExtension(String, TaskMonitor)}. * {@link SpecExtension#removeCompilerSpecExtension(String, TaskMonitor)}.
* * <p>
* {@code ProgramCompilerSpec} allows the static evaluation models, described by the underlying * {@code ProgramCompilerSpec} allows the static evaluation models, described by the underlying
* {@link BasicCompilerSpec} and returned by * {@link BasicCompilerSpec} and returned by
* {@link #getPrototypeEvaluationModel(EvaluationModelType)}, to be overridden by Program-specific * {@link #getPrototypeEvaluationModel(EvaluationModelType)}, to be overridden by Program-specific
* options. * options.
* * <p>
* {@link #getDecompilerOutputLanguage()} queries the Program-specific language the decompiler * {@link #getDecompilerOutputLanguage()} queries the Program-specific language the decompiler
* should use as output. * should use as output.
* * <p>
* {@link #installExtensions()} is the main entry point for integrating the Program Options with the * {@link #installExtensions()} is the main entry point for integrating the Program Options with the
* Language's base CompilerSpec and producing a complete in-memory CompilerSpec for the Program. * Language's base CompilerSpec and producing a complete in-memory CompilerSpec for the Program.
*
*/ */
public class ProgramCompilerSpec extends BasicCompilerSpec { public class ProgramCompilerSpec extends BasicCompilerSpec {

View file

@ -58,6 +58,7 @@ public class AddressMapImpl {
/** /**
* Creates a new AddressMapImpl with the specified mapID * Creates a new AddressMapImpl with the specified mapID
* @param mapID the 8-bit value is placed in the upper 8 bits of every address encoding. * @param mapID the 8-bit value is placed in the upper 8 bits of every address encoding.
* @param addrFactory the address factory
*/ */
public AddressMapImpl(byte mapID, AddressFactory addrFactory) { public AddressMapImpl(byte mapID, AddressFactory addrFactory) {
this.addrFactory = addrFactory; this.addrFactory = addrFactory;

View file

@ -31,18 +31,18 @@ import java.math.BigInteger;
public interface AddressRange extends Comparable<AddressRange>, Iterable<Address> { public interface AddressRange extends Comparable<AddressRange>, Iterable<Address> {
/** /**
* Returns the number of addresses in the range. * {@return the number of addresses in the range}
*/ */
public long getLength(); public long getLength();
/** /**
* Returns the number of addresses as a BigInteger. * {@return the number of addresses as a BigInteger}
* @return the number of addresses as a BigInteger.
*/ */
public BigInteger getBigLength(); public BigInteger getBigLength();
/** /**
* Returns true if the given address is contained in the range. * {@return true if the given address is contained in the range}
* @param addr The address to check
*/ */
public boolean contains(Address addr); public boolean contains(Address addr);
@ -64,13 +64,13 @@ public interface AddressRange extends Comparable<AddressRange>, Iterable<Address
public AddressRange intersectRange(Address start, Address end); public AddressRange intersectRange(Address start, Address end);
/** /**
* Returns true if the given range intersects this range. * {@return true if the given range intersects this range; otherwise, false}
* @param range the range to test for intersection with. * @param range the range to test for intersection with.
*/ */
public boolean intersects(AddressRange range); public boolean intersects(AddressRange range);
/** /**
* Returns true if the given range intersects this range. * {@return true if the given range intersects this range; otherwise, false}
* @param start the first address in the range to test for intersection. * @param start the first address in the range to test for intersection.
* @param end the last address in the range to test for intersection. * @param end the last address in the range to test for intersection.
*/ */

View file

@ -23,7 +23,8 @@ package ghidra.program.model.address;
public interface AddressSetCollection { public interface AddressSetCollection {
/** /**
* Determine if any AddressSet in this collection intersects with the specified address set. * {@return true if any AddressSet in this collection intersects with the specified address set;
* otherwise, false}
* *
* @param addrSet address set to check intersection with. * @param addrSet address set to check intersection with.
*/ */
@ -57,7 +58,8 @@ public interface AddressSetCollection {
public boolean hasFewerRangesThan(int rangeThreshold); public boolean hasFewerRangesThan(int rangeThreshold);
/** /**
* Returns a single AddressSet containing the union of all the addressSetViews in the collection. * {@return a single AddressSet containing the union of all the addressSetViews in the
* collection}
*/ */
public AddressSet getCombinedAddressSet(); public AddressSet getCombinedAddressSet();

View file

@ -102,7 +102,7 @@ public interface AddressSpace extends Comparable<AddressSpace> {
new GenericAddressSpace("REGISTER", 32, TYPE_REGISTER, 0); new GenericAddressSpace("REGISTER", 32, TYPE_REGISTER, 0);
/** /**
* Returns the name of this address space. * {@return the name of this address space}.
* With the exception of {@link OverlayAddressSpace}, the name of an address space may not change. * With the exception of {@link OverlayAddressSpace}, the name of an address space may not change.
*/ */
String getName(); String getName();
@ -114,14 +114,16 @@ public interface AddressSpace extends Comparable<AddressSpace> {
*/ */
int getSpaceID(); int getSpaceID();
/** Returns the number of bits that are used to form the address. Thus /**
* {@return the number of bits that are used to form the address.} Thus
* the maximum offset for this address space will be 2^size-1. * the maximum offset for this address space will be 2^size-1.
*/ */
int getSize(); int getSize();
/** /**
* Returns the number of data bytes which correspond to each addressable * {@return the number of data bytes which correspond to each addressable
* location within this space (i.e., word-size in bytes). * location within this space (i.e., word-size in bytes).}
* <p>
* NOTE: When transforming a byte-offset to an addressable word * NOTE: When transforming a byte-offset to an addressable word
* offset the method {@link #getAddressableWordOffset(long)} should * offset the method {@link #getAddressableWordOffset(long)} should
* be used instead of simple division. When transforming an addressable word-offset * be used instead of simple division. When transforming an addressable word-offset
@ -145,17 +147,19 @@ public interface AddressSpace extends Comparable<AddressSpace> {
public long getAddressableWordOffset(long byteOffset); public long getAddressableWordOffset(long byteOffset);
/** /**
* Returns the absolute size of a pointer into this space (in bytes). * {@return the absolute size of a pointer into this space (in bytes).}
* @see Program#getDefaultPointerSize() for a user adjustable pointer size which is derived from the * @see Program#getDefaultPointerSize() for a user adjustable pointer size which is derived from the
* CompilerSpec store pointer size. * CompilerSpec store pointer size.
*/ */
int getPointerSize(); int getPointerSize();
/** Returns the type of this address space /**
* {@return the type of this address space}
*/ */
int getType(); int getType();
/** Returns the unique index for this address space /**
* {@return the unique index for this address space}
*/ */
int getUnique(); int getUnique();
@ -372,14 +376,14 @@ public interface AddressSpace extends Comparable<AddressSpace> {
/** /**
* Check the specified address range for validity within this space. * Check the specified address range for validity within this space.
* Segmented spaces will restrict a range to a single segment. * Segmented spaces will restrict a range to a single segment.
* @param byteOffset * @param byteOffset The offset
* @param length * @param length The length
* @return true if range is valid for this space * @return true if range is valid for this space
*/ */
public boolean isValidRange(long byteOffset, long length); public boolean isValidRange(long byteOffset, long length);
/** /**
* Tests whether addr2 immediately follows addr1. * {@return true if addr2 immediately follows addr1; otherwise, false}
* @param addr1 the first address. * @param addr1 the first address.
* @param addr2 the second address. * @param addr2 the second address.
*/ */
@ -426,7 +430,9 @@ public interface AddressSpace extends Comparable<AddressSpace> {
public long makeValidOffset(long offset) throws AddressOutOfBoundsException; public long makeValidOffset(long offset) throws AddressOutOfBoundsException;
/** /**
* Returns true if this space represents a memory address. NOTE: It is important to * {@return true if this space represents a memory address.}
* <p>
* NOTE: It is important to
* make the distinction between Loaded and Non-Loaded memory addresses. Program importers * make the distinction between Loaded and Non-Loaded memory addresses. Program importers
* may create memory blocks associated with Non-Loaded file content which are not associated * may create memory blocks associated with Non-Loaded file content which are not associated
* with processor defined memory regions. While Loaded file content is placed into * with processor defined memory regions. While Loaded file content is placed into
@ -438,49 +444,48 @@ public interface AddressSpace extends Comparable<AddressSpace> {
public boolean isMemorySpace(); public boolean isMemorySpace();
/** /**
* Returns true if this space represents a Loaded Memory * {@return true if this space represents a Loaded Memory region (e.g., processor RAM)}
* region (e.g., processor RAM).
*/ */
public boolean isLoadedMemorySpace(); public boolean isLoadedMemorySpace();
/** /**
* Returns true if this space represents a Non-Loaded storage region * {@return true if this space represents a Non-Loaded storage region
* for retaining non-loaded file data (e.g., OTHER) * for retaining non-loaded file data (e.g., OTHER)}
*/ */
public boolean isNonLoadedMemorySpace(); public boolean isNonLoadedMemorySpace();
/** /**
* Returns true if this space represents a register location * {@return true if this space represents a register location}
*/ */
public boolean isRegisterSpace(); public boolean isRegisterSpace();
/** /**
* Returns true if this space represents a variable location * {@return true if this space represents a variable location}
*/ */
public boolean isVariableSpace(); public boolean isVariableSpace();
/** /**
* Returns true if this space represents a stack location * {@return true if this space represents a stack location}
*/ */
public boolean isStackSpace(); public boolean isStackSpace();
/** /**
* Returns true if this space represents a location in the HASH space. * {@return true if this space represents a location in the HASH space}
*/ */
public boolean isHashSpace(); public boolean isHashSpace();
/** /**
* Returns true if this space in the EXTERNAL_SPACE * {@return true if this space in the EXTERNAL_SPACE}
*/ */
public boolean isExternalSpace(); public boolean isExternalSpace();
/** /**
* Returns true if this space in the unique space * {@return true if this space in the unique space}
*/ */
public boolean isUniqueSpace(); public boolean isUniqueSpace();
/** /**
* Returns true if this space in the constant space * {@return true if this space in the constant space}
*/ */
public boolean isConstantSpace(); public boolean isConstantSpace();
@ -493,17 +498,17 @@ public interface AddressSpace extends Comparable<AddressSpace> {
boolean hasMappedRegisters(); boolean hasMappedRegisters();
/** /**
* Returns true if the address should display its addressSpace name. * {@return true if the address should display its addressSpace name}
*/ */
boolean showSpaceName(); boolean showSpaceName();
/** /**
* Returns true if this addressSpace is an OverlayAddressSpace * {@return true if this addressSpace is an overlay address space}
*/ */
boolean isOverlaySpace(); boolean isOverlaySpace();
/** /**
* Returns true if space uses signed offset * {@return true if space uses signed offset}
*/ */
boolean hasSignedOffset(); boolean hasSignedOffset();

View file

@ -47,7 +47,7 @@ public class OldGenericNamespaceAddress extends GenericAddress {
} }
/** /**
* Returns the namespace ID assigned to this address. * {@return the namespace ID assigned to this address.}
* This namespace ID generally corresponds to a Function. * This namespace ID generally corresponds to a Function.
*/ */
public long getNamespaceID() { public long getNamespaceID() {
@ -55,7 +55,7 @@ public class OldGenericNamespaceAddress extends GenericAddress {
} }
/** /**
* Returns global address (i.e., GenericAddress) for this address. * {@return global address (i.e., GenericAddress) for this address.}
*/ */
public Address getGlobalAddress() { public Address getGlobalAddress() {
return addrSpace.getAddress(offset); return addrSpace.getAddress(offset);
@ -65,7 +65,7 @@ public class OldGenericNamespaceAddress extends GenericAddress {
* Returns minimum namespace address within the specified address space for upgrade iterators. * Returns minimum namespace address within the specified address space for upgrade iterators.
* A minimum offset of 0x0 is always assumed. * A minimum offset of 0x0 is always assumed.
* @param addrSpace address space * @param addrSpace address space
* @param namespaceID * @param namespaceID The namespace ID
* @return minimum address * @return minimum address
*/ */
public static Address getMinAddress(AddressSpace addrSpace, long namespaceID) { public static Address getMinAddress(AddressSpace addrSpace, long namespaceID) {
@ -77,7 +77,7 @@ public class OldGenericNamespaceAddress extends GenericAddress {
* For a signed stack space, the negative region is treated as positive for the purpose of * For a signed stack space, the negative region is treated as positive for the purpose of
* identifying the maximum address key encoding. * identifying the maximum address key encoding.
* @param addrSpace address space * @param addrSpace address space
* @param namespaceID * @param namespaceID The namespace ID
* @return maximum address * @return maximum address
*/ */
public static Address getMaxAddress(AddressSpace addrSpace, long namespaceID) { public static Address getMaxAddress(AddressSpace addrSpace, long namespaceID) {

View file

@ -97,20 +97,20 @@ public interface Memory extends AddressSetView {
public static final long MAX_BLOCK_SIZE = (long) MAX_BLOCK_SIZE_GB << GBYTE_SHIFT_FACTOR; public static final long MAX_BLOCK_SIZE = (long) MAX_BLOCK_SIZE_GB << GBYTE_SHIFT_FACTOR;
/** /**
* Returns the program that this memory belongs to. * {@return the program that this memory belongs to}
*/ */
public Program getProgram(); public Program getProgram();
/** /**
* Returns the set of addresses which correspond to all the "loaded" memory blocks that have * {@return the set of addresses which correspond to all the "loaded" memory blocks that have
* initialized data. This does not include initialized memory blocks that contain data from * initialized data.} This does not include initialized memory blocks that contain data from
* the program's file header such as debug sections. * the program's file header such as debug sections.
*/ */
public AddressSetView getLoadedAndInitializedAddressSet(); public AddressSetView getLoadedAndInitializedAddressSet();
/** /**
* Returns the set of addresses which correspond to all memory blocks that have * {@return the set of addresses which correspond to all memory blocks that have
* initialized data. This includes initialized memory blocks that contain data from * initialized data.} This includes initialized memory blocks that contain data from
* the program's file header that are not actually in the running in memory image, * the program's file header that are not actually in the running in memory image,
* such as debug sections. Use {@link #getLoadedAndInitializedAddressSet} if you only want * such as debug sections. Use {@link #getLoadedAndInitializedAddressSet} if you only want
* the addressed of the loaded in memory blocks. * the addressed of the loaded in memory blocks.
@ -118,19 +118,21 @@ public interface Memory extends AddressSetView {
public AddressSetView getAllInitializedAddressSet(); public AddressSetView getAllInitializedAddressSet();
/** /**
* Use {@link #getLoadedAndInitializedAddressSet} instead. * {@return the set of addresses which correspond to all the "loaded" memory blocks that have
* @deprecated * initialized data.} This does not include initialized memory blocks that contain data from
* the program's file header such as debug sections.
* @deprecated Use {@link #getLoadedAndInitializedAddressSet} instead
*/ */
@Deprecated @Deprecated
public AddressSetView getInitializedAddressSet(); public AddressSetView getInitializedAddressSet();
/** /**
* Returns the set of addresses which correspond to the executable memory. * {@return the set of addresses which correspond to the executable memory}
*/ */
public AddressSetView getExecuteSet(); public AddressSetView getExecuteSet();
/** /**
* Returns true if the memory is bigEndian, false otherwise. * {@return true if the memory is bigEndian, false otherwise}
*/ */
public boolean isBigEndian(); public boolean isBigEndian();
@ -429,7 +431,7 @@ public interface Memory extends AddressSetView {
public void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException; public void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException;
/** /**
* Get the memory size in bytes. * {@return the memory size in bytes}
*/ */
public long getSize(); public long getSize();
@ -449,7 +451,7 @@ public interface Memory extends AddressSetView {
public MemoryBlock getBlock(String blockName); public MemoryBlock getBlock(String blockName);
/** /**
* Returns an array containing all the memory blocks. * {@return an array containing all the memory blocks}
*/ */
public MemoryBlock[] getBlocks(); public MemoryBlock[] getBlocks();
@ -500,10 +502,10 @@ public interface Memory extends AddressSetView {
throws LockException, MemoryBlockException, NotFoundException; throws LockException, MemoryBlockException, NotFoundException;
/** /**
* Convert an existing uninitialized block with an * Convert an existing uninitialized block with an initialized block.
* initialized block.
* @param uninitializedBlock uninitialized block to convert * @param uninitializedBlock uninitialized block to convert
* @param initialValue initial value for the bytes * @param initialValue initial value for the bytes
* @return the converted block
* @throws LockException if exclusive lock not in place (see haveLock()) * @throws LockException if exclusive lock not in place (see haveLock())
* @throws MemoryBlockException if there is no block in memory * @throws MemoryBlockException if there is no block in memory
* at the same address as block or if the block lengths are not * at the same address as block or if the block lengths are not
@ -526,6 +528,7 @@ public interface Memory extends AddressSetView {
* if all bits of each byte is to be checked (ie: all mask bytes are 0xff), * if all bits of each byte is to be checked (ie: all mask bytes are 0xff),
* then pass a null for masks. * then pass a null for masks.
* @param forward if true, search in the forward direction. * @param forward if true, search in the forward direction.
* @param monitor the monitor
* *
* @return The address of where the first match is found. Null is returned * @return The address of where the first match is found. Null is returned
* if there is no match. * if there is no match.
@ -547,6 +550,7 @@ public interface Memory extends AddressSetView {
* if all bits of each byte is to be checked (ie: all mask bytes are 0xff), * if all bits of each byte is to be checked (ie: all mask bytes are 0xff),
* then pass a null for masks. * then pass a null for masks.
* @param forward if true, search in the forward direction. * @param forward if true, search in the forward direction.
* @param monitor the monitor
* *
* @return The address of where the first match is found. Null is returned * @return The address of where the first match is found. Null is returned
* if there is no match. * if there is no match.