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

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -62,7 +62,7 @@ public enum AnalyzerType {
}
/**
* Return the name of this AnalyzerType.
* {@return the name of this AnalyzerType}
*/
public String getName() {
return name;

View file

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,15 +25,15 @@ package ghidra.util.datastruct;
public interface Array {
/**
* 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;
* @param index int index into the array to remove.
*/
* Removes the value at that index. If the array is of primitive type (int, short, etc),
* then "removing" the value is equivalent to setting the value to 0;
* @param index int index into the array to remove.
*/
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();
/**

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -45,18 +45,17 @@ import ghidra.xml.XmlParseException;
* (See {@link SpecExtension}) using
* {@link SpecExtension#addReplaceCompilerSpecExtension(String, TaskMonitor)} or
* {@link SpecExtension#removeCompilerSpecExtension(String, TaskMonitor)}.
*
* <p>
* {@code ProgramCompilerSpec} allows the static evaluation models, described by the underlying
* {@link BasicCompilerSpec} and returned by
* {@link #getPrototypeEvaluationModel(EvaluationModelType)}, to be overridden by Program-specific
* options.
*
* <p>
* {@link #getDecompilerOutputLanguage()} queries the Program-specific language the decompiler
* should use as output.
*
* <p>
* {@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.
*
*/
public class ProgramCompilerSpec extends BasicCompilerSpec {

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -58,6 +58,7 @@ public class AddressMapImpl {
/**
* 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 addrFactory the address factory
*/
public AddressMapImpl(byte mapID, AddressFactory addrFactory) {
this.addrFactory = addrFactory;

View file

@ -31,18 +31,18 @@ import java.math.BigInteger;
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();
/**
* 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();
/**
* 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);
@ -64,13 +64,13 @@ public interface AddressRange extends Comparable<AddressRange>, Iterable<Address
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.
*/
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 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 {
/**
* 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.
*/
@ -57,7 +58,8 @@ public interface AddressSetCollection {
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();

View file

@ -102,7 +102,7 @@ public interface AddressSpace extends Comparable<AddressSpace> {
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.
*/
String getName();
@ -114,14 +114,16 @@ public interface AddressSpace extends Comparable<AddressSpace> {
*/
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.
*/
int getSize();
/**
* Returns the number of data bytes which correspond to each addressable
* location within this space (i.e., word-size in bytes).
* {@return the number of data bytes which correspond to each addressable
* location within this space (i.e., word-size in bytes).}
* <p>
* NOTE: When transforming a byte-offset to an addressable word
* offset the method {@link #getAddressableWordOffset(long)} should
* 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);
/**
* 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
* CompilerSpec store pointer size.
*/
int getPointerSize();
/** Returns the type of this address space
/**
* {@return the type of this address space}
*/
int getType();
/** Returns the unique index for this address space
/**
* {@return the unique index for this address space}
*/
int getUnique();
@ -372,14 +376,14 @@ public interface AddressSpace extends Comparable<AddressSpace> {
/**
* Check the specified address range for validity within this space.
* Segmented spaces will restrict a range to a single segment.
* @param byteOffset
* @param length
* @param byteOffset The offset
* @param length The length
* @return true if range is valid for this space
*/
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 addr2 the second address.
*/
@ -426,7 +430,9 @@ public interface AddressSpace extends Comparable<AddressSpace> {
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
* 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
@ -438,49 +444,48 @@ public interface AddressSpace extends Comparable<AddressSpace> {
public boolean isMemorySpace();
/**
* Returns true if this space represents a Loaded Memory
* region (e.g., processor RAM).
* {@return true if this space represents a Loaded Memory region (e.g., processor RAM)}
*/
public boolean isLoadedMemorySpace();
/**
* Returns true if this space represents a Non-Loaded storage region
* for retaining non-loaded file data (e.g., OTHER)
* {@return true if this space represents a Non-Loaded storage region
* for retaining non-loaded file data (e.g., OTHER)}
*/
public boolean isNonLoadedMemorySpace();
/**
* Returns true if this space represents a register location
* {@return true if this space represents a register location}
*/
public boolean isRegisterSpace();
/**
* Returns true if this space represents a variable location
* {@return true if this space represents a variable location}
*/
public boolean isVariableSpace();
/**
* Returns true if this space represents a stack location
* {@return true if this space represents a stack location}
*/
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();
/**
* Returns true if this space in the EXTERNAL_SPACE
* {@return true if this space in the EXTERNAL_SPACE}
*/
public boolean isExternalSpace();
/**
* Returns true if this space in the unique space
* {@return true if this space in the unique space}
*/
public boolean isUniqueSpace();
/**
* Returns true if this space in the constant space
* {@return true if this space in the constant space}
*/
public boolean isConstantSpace();
@ -493,17 +498,17 @@ public interface AddressSpace extends Comparable<AddressSpace> {
boolean hasMappedRegisters();
/**
* Returns true if the address should display its addressSpace name.
* {@return true if the address should display its addressSpace name}
*/
boolean showSpaceName();
/**
* Returns true if this addressSpace is an OverlayAddressSpace
* {@return true if this addressSpace is an overlay address space}
*/
boolean isOverlaySpace();
/**
* Returns true if space uses signed offset
* {@return true if space uses signed offset}
*/
boolean hasSignedOffset();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -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.
*/
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() {
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.
* A minimum offset of 0x0 is always assumed.
* @param addrSpace address space
* @param namespaceID
* @param namespaceID The namespace ID
* @return minimum address
*/
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
* identifying the maximum address key encoding.
* @param addrSpace address space
* @param namespaceID
* @param namespaceID The namespace ID
* @return maximum address
*/
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;
/**
* Returns the program that this memory belongs to.
* {@return the program that this memory belongs to}
*/
public Program getProgram();
/**
* Returns 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
* {@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
* the program's file header such as debug sections.
*/
public AddressSetView getLoadedAndInitializedAddressSet();
/**
* Returns the set of addresses which correspond to all memory blocks that have
* initialized data. This includes initialized memory blocks that contain data from
* {@return the set of addresses which correspond to all memory blocks that have
* 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,
* such as debug sections. Use {@link #getLoadedAndInitializedAddressSet} if you only want
* the addressed of the loaded in memory blocks.
@ -118,19 +118,21 @@ public interface Memory extends AddressSetView {
public AddressSetView getAllInitializedAddressSet();
/**
* Use {@link #getLoadedAndInitializedAddressSet} instead.
* @deprecated
* {@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
* the program's file header such as debug sections.
* @deprecated Use {@link #getLoadedAndInitializedAddressSet} instead
*/
@Deprecated
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();
/**
* Returns true if the memory is bigEndian, false otherwise.
* {@return true if the memory is bigEndian, false otherwise}
*/
public boolean isBigEndian();
@ -429,7 +431,7 @@ public interface Memory extends AddressSetView {
public void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException;
/**
* Get the memory size in bytes.
* {@return the memory size in bytes}
*/
public long getSize();
@ -449,7 +451,7 @@ public interface Memory extends AddressSetView {
public MemoryBlock getBlock(String blockName);
/**
* Returns an array containing all the memory blocks.
* {@return an array containing all the memory blocks}
*/
public MemoryBlock[] getBlocks();
@ -500,10 +502,10 @@ public interface Memory extends AddressSetView {
throws LockException, MemoryBlockException, NotFoundException;
/**
* Convert an existing uninitialized block with an
* initialized block.
* Convert an existing uninitialized block with an initialized block.
* @param uninitializedBlock uninitialized block to convert
* @param initialValue initial value for the bytes
* @return the converted block
* @throws LockException if exclusive lock not in place (see haveLock())
* @throws MemoryBlockException if there is no block in memory
* 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),
* then pass a null for masks.
* @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
* 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),
* then pass a null for masks.
* @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
* if there is no match.