Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-4744: Last tweaks and formatting.

Dan78d4d38a808d
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AbstractDBAnnotationValidator.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AbstractDBAnnotationValidator.java
index 3b5886c948..ef5933ebed 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AbstractDBAnnotationValidator.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AbstractDBAnnotationValidator.java
@@ -20,11 +20,13 @@ import java.lang.annotation.Annotation;
import javax.lang.model.element.*;
import javax.tools.Diagnostic.Kind;
+import ghidra.util.database.DBAnnotatedObject;
+
/**
* An abstract class for validating annotations on {@link DBAnnotatedObject}.
+ *
* <p>
- * Performs validation checks on annotated fields and their enclosing types.
- * </p>
+ * Performs validation checks on annotated fields and their enclosing types.
*/
public class AbstractDBAnnotationValidator {
protected final ValidationContext ctx;
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AccessSpec.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AccessSpec.java
index 74c94a03d6..5ab1e43450 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AccessSpec.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/AccessSpec.java
@@ -20,8 +20,8 @@ import java.util.Set;
import javax.lang.model.element.Modifier;
/**
- * An enum to represent different levels of access specifiers
- * (private, package-private, protected, public) with corresponding access levels
+ * An enum to represent different levels of access specifiers (private, package-private, protected,
+ * public) with corresponding access levels
*/
public enum AccessSpec {
PRIVATE(0), PACKAGE(1), PROTECTED(2), PUBLIC(3);
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedColumnValidator.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedColumnValidator.java
index ac128e35a8..04220bb76c 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedColumnValidator.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedColumnValidator.java
@@ -23,10 +23,11 @@ import javax.tools.Diagnostic.Kind;
import ghidra.util.database.annot.DBAnnotatedColumn;
/**
- * A class for validating fields annotated with {@link DBAnnotatedColumn}
+ * A class for validating fields annotated with {@link DBAnnotatedColumn}.
+ *
* <p>
- * To ensure fields annotated with {@link DBAnnotatedColumn}
- * comply with the expected criteria for database columns in Ghidra.
+ * To ensure fields annotated with {@link DBAnnotatedColumn} comply with the expected criteria for
+ * database columns in Ghidra.
* </p>
*/
@@ -34,9 +35,11 @@ public class DBAnnotatedColumnValidator extends AbstractDBAnnotationValidator {
final VariableElement column;
/**
- * Construct a new {@code DBAnnotatedColumnValidator} with the specified validation context and the column element.
- * @param ctx
- * @param column
+ * Construct a new {@code DBAnnotatedColumnValidator} with the specified validation context and
+ * the column element.
+ *
+ * @param ctx the validation context
+ * @param column the field representing the column
*/
public DBAnnotatedColumnValidator(ValidationContext ctx, VariableElement column) {
super(ctx);
@@ -47,14 +50,14 @@ public class DBAnnotatedColumnValidator extends AbstractDBAnnotationValidator {
* Validate the annotated column field.
*
* <p>
- * It performs the following checks to ensure it meets the requirements for database columns:
- * <ul>
- * <li>The field must be of the type specified by {@code ctx.DB_OBJECT_COLUMN_ELEM}.</li>
- * <li>The field must not be declared as {@code final}.</li>
- * <li>The field must be declared as {@code static}.</li>
- * <li>The enclosing type of the field must meet the criteria defined in {@code checkEnclosingType}.</li>
- * </ul>
- * </p>
+ * It performs the following checks to ensure it meets the requirements for database columns:
+ * <ul>
+ * <li>The field must be of the type specified by {@code ctx.DB_OBJECT_COLUMN_ELEM}.</li>
+ * <li>The field must not be declared as {@code final}.</li>
+ * <li>The field must be declared as {@code static}.</li>
+ * <li>The enclosing type of the field must meet the criteria defined in
+ * {@code checkEnclosingType}.</li>
+ * </ul>
*/
public void validate() {
if (!ctx.hasType(column, ctx.DB_OBJECT_COLUMN_ELEM)) {
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedFieldValidator.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedFieldValidator.java
index 49c9857fd9..f58e72ce5d 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedFieldValidator.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedFieldValidator.java
@@ -25,11 +25,11 @@ import ghidra.util.database.annot.DBAnnotatedField;
/**
* A class for validating fields annotated with {@link DBAnnotatedField}
+ *
* <p>
- * To ensure fields annotated with {@link DBAnnotatedField} meet the criteria required for database fields
- * in Ghidra. It extends the {@code AbstractDBAnnotationValidator} to provide additional
- * validation logic specific to database field annotations.
- * </p>
+ * To ensure fields annotated with {@link DBAnnotatedField} meet the criteria required for database
+ * fields in Ghidra. It extends the {@code AbstractDBAnnotationValidator} to provide additional
+ * validation logic specific to database field annotations.
*/
public class DBAnnotatedFieldValidator extends AbstractDBAnnotationValidator {
final VariableElement field;
@@ -48,9 +48,11 @@ public class DBAnnotatedFieldValidator extends AbstractDBAnnotationValidator {
final TypeElement ENUM_CODEC_ELEM;
/**
- * Construct a new {@code DBAnnotatedFieldValidator} with the specified validation context and field element.
- * @param ctx
- * @param field
+ * Construct a new {@code DBAnnotatedFieldValidator} with the specified validation context and
+ * field element.
+ *
+ * @param ctx the validation context
+ * @param field the field to validate
*/
public DBAnnotatedFieldValidator(ValidationContext ctx, VariableElement field) {
super(ctx);
@@ -118,15 +120,16 @@ public class DBAnnotatedFieldValidator extends AbstractDBAnnotationValidator {
/**
* Validate the annotated field to ensure it meets the requirements for database fields.
+ *
* <p>
- * It performs the following checks:
- * <ul>
- * <li>The field must not be declared as {@code final}.</li>
- * <li>The field must not be declared as {@code static}.</li>
- * <li>The enclosing type of the field must meet the criteria defined in {@code checkEnclosingType}.</li>
- * <li>The codec types for the field must be appropriate.</li>
- * </ul>
- * </p>
+ * It performs the following checks:
+ * <ul>
+ * <li>The field must not be declared as {@code final}.</li>
+ * <li>The field must not be declared as {@code static}.</li>
+ * <li>The enclosing type of the field must meet the criteria defined in
+ * {@code checkEnclosingType}.</li>
+ * <li>The codec types for the field must be appropriate.</li>
+ * </ul>
*/
public void validate() {
Set<Modifier> mods = field.getModifiers();
@@ -161,8 +164,8 @@ public class DBAnnotatedFieldValidator extends AbstractDBAnnotationValidator {
}
/**
- * Return the codec type element specified in the {@link DBAnnotatedField} annotation
- * for the field, or the default codec type if none is specified.
+ * Return the codec type element specified in the {@link DBAnnotatedField} annotation for the
+ * field, or the default codec type if none is specified.
*
* @return the codec type element for the field
*/
@@ -182,7 +185,8 @@ public class DBAnnotatedFieldValidator extends AbstractDBAnnotationValidator {
}
/**
- * Check the codec types associated with the field to ensure they meet the necessary requirements.
+ * Check the codec types associated with the field to ensure they meet the necessary
+ * requirements.
*
* @param objectType the type of the enclosing object
*/
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java
index 70b67f3f00..6a77d876f9 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java
@@ -30,11 +30,9 @@ import ghidra.util.database.annot.*;
* A compile-time annotation processor for {@link DBAnnotatedObject}-related annotations.
*
* <p>
- * This processor performs compile-time validation checks on annotations related to
- * {@link DBAnnotatedObject}.
- * Currently just performs compile-time checks. It does not generate any code, but perhaps one day,
- * it will.
- * </p>
+ * This processor performs compile-time validation checks on annotations related to
+ * {@link DBAnnotatedObject}. Currently just performs compile-time checks. It does not generate any
+ * code, but perhaps one day, it will.
*/
//@AutoService(Processor.class) // TODO: Evaluate Google's auto-service as a dependency
public class DBAnnotatedObjectProcessor extends AbstractProcessor {
@@ -60,7 +58,8 @@ public class DBAnnotatedObjectProcessor extends AbstractProcessor {
*
* @param annotations the set of annotations to process
* @param roundEnv the environment for information about the current and prior round
- * @return {@code true} if the annotations are claimed by this processor, {@code false} otherwise
+ * @return {@code true} if the annotations are claimed by this processor, {@code false}
+ * otherwise
*/
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -104,7 +103,6 @@ public class DBAnnotatedObjectProcessor extends AbstractProcessor {
@Override
public Iterable<? extends Completion> getCompletions(Element element,
AnnotationMirror annotation, ExecutableElement member, String userText) {
- // TODO Auto-generated method stub
return super.getCompletions(element, annotation, member, userText);
}
@@ -125,7 +123,8 @@ public class DBAnnotatedObjectProcessor extends AbstractProcessor {
*/
@Override
public Set<String> getSupportedAnnotationTypes() {
- return SUPPORTED_ANNOTATIONS.stream().map(Class::getCanonicalName).collect(
- Collectors.toSet());
+ return SUPPORTED_ANNOTATIONS.stream()
+ .map(Class::getCanonicalName)
+ .collect(Collectors.toSet());
}
}
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectValidator.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectValidator.java
index 5066626206..d48df8b99c 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectValidator.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectValidator.java
@@ -20,15 +20,16 @@ import java.util.*;
import javax.lang.model.element.*;
import javax.tools.Diagnostic.Kind;
+import ghidra.util.database.DBAnnotatedObject;
import ghidra.util.database.annot.*;
/**
* Validate {@link DBAnnotatedObject}-related annotations on a given type element.
+ *
* <p>
- * This class ensures that annotations such as {@link DBAnnotatedField}, {@link DBAnnotatedColumn},
- * and {@link DBAnnotatedObjectInfo} are applied correctly and consistently on the fields and columns
- * of a class.
- * </p>
+ * This class ensures that annotations such as {@link DBAnnotatedField}, {@link DBAnnotatedColumn},
+ * and {@link DBAnnotatedObjectInfo} are applied correctly and consistently on the fields and
+ * columns of a class.
*/
public class DBAnnotatedObjectValidator {
private final ValidationContext ctx;
@@ -71,6 +72,8 @@ public class DBAnnotatedObjectValidator {
/**
* Validate the annotated fields, columns, and the type element itself.
+ *
+ * <p>
* Checks for various annotation constraints and consistency rules.
*/
public void validate() {
@@ -160,6 +163,7 @@ public class DBAnnotatedObjectValidator {
/**
* Check that the access specifiers of the field and column are compatible.
+ *
* @param field the field element
* @param column the column element
* @param name the name of the column
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/ValidationContext.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/ValidationContext.java
index c712382020..59bf346c4b 100644
--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/ValidationContext.java
+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/ValidationContext.java
@@ -74,7 +74,7 @@ public class ValidationContext {
* Check if the field has the specified type.
*
* @param field the field element
- * @param type the type element
+ * @param type the type element
* @return true if the field has the specified type, false otherwise
*/
public boolean hasType(VariableElement field, TypeElement type) {
@@ -85,7 +85,7 @@ public class ValidationContext {
* Check if the field has the specified type.
*
* @param field the field element
- * @param type the type mirror
+ * @param type the type mirror
* @return true if the field has the specified type, false otherwise
*/
public boolean hasType(VariableElement field, TypeMirror type) {
@@ -153,10 +153,9 @@ public class ValidationContext {
}
/**
- * Find the supertype of a set of declared types that matches the specified
- * super type.
+ * Find the supertype of a set of declared types that matches the specified super type.
*
- * @param types the set of declared types
+ * @param types the set of declared types
* @param superType the super type element to match
* @return the matching declared type, or null if no match is found
*/
@@ -180,10 +179,9 @@ public class ValidationContext {
}
/**
- * Find the supertype of a declared type that matches the specified super type
- * element.
+ * Find the supertype of a declared type that matches the specified super type element.
*
- * @param type the declared type
+ * @param type the declared type
* @param superElem the super type element to match
* @return the matching declared type, or null if no match is found
*/
@@ -192,10 +190,9 @@ public class ValidationContext {
}
/**
- * Find the supertype of a type element that matches the specified super type
- * element.
+ * Find the supertype of a type element that matches the specified super type element.
*
- * @param elem the type element
+ * @param elem the type element
* @param superElem the super type element to match
* @return the matching declared type, or null if no match is found
*/
@@ -224,7 +221,7 @@ public class ValidationContext {
/**
* Get the type arguments of a declared type as a map.
*
- * @param type the declared type
+ * @param type the declared type
* @param superElem the super type element
* @return a map of type argument names to their corresponding type mirrors
*/
@@ -235,7 +232,7 @@ public class ValidationContext {
/**
* Get the type arguments of a type element as a map.
*
- * @param elem the type element
+ * @param elem the type element
* @param superElem the super type element
* @return a map of type argument names to their corresponding type mirrors
*/
@@ -263,8 +260,8 @@ class FormatVisitor implements TypeVisitor<Void, Void> {
StringBuffer buf = new StringBuffer();
/**
- * Visit method for {@link TypeMirror}. Delegates to specific visit methods
- * based on the type kind.
+ * Visit method for {@link TypeMirror}. Delegates to specific visit methods based on the type
+ * kind.
*
* @param t the type mirror to visit
* @param p unused parameter (can be {@code null})
@@ -408,7 +405,7 @@ class FormatVisitor implements TypeVisitor<Void, Void> {
}
/**
- * Visit method for {@link WindcardType}.
+ * Visit method for {@link WildcardType}.
*
* @param t the wildcard type to visit
* @param p unused parameter (can be {@code null})