From b616bb71dab29972a20dcf280bdddfa22212907f Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Thu, 30 Mar 2023 16:56:12 -0400 Subject: [PATCH] Fix javadoc errors and add explicit constructors * add missing @param Signed-off-by: Keith W. Campbell --- .../diagnostics/utils/ContextFactory.java | 32 ++++++++----- .../utils/commands/BaseCommand.java | 47 ++++++++++--------- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/ContextFactory.java b/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/ContextFactory.java index fdb4ced1c06..48a8ec6aefb 100644 --- a/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/ContextFactory.java +++ b/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/ContextFactory.java @@ -28,32 +28,38 @@ import com.ibm.dtfj.java.JavaRuntime; /** - * Factory for creating different types of context - * - * @author adam + * Factory for creating different types of contexts. * + * @author adam */ public class ContextFactory { - + + private ContextFactory() { + /* no instances needed */ + } + /** - * Create a DTFJ context - * + * Create a DTFJ context. + * * @param major DTFJ API major version to be supported * @param minor DTFJ minor version to be supported + * @param image the source image for the context * @param space address space for this context (cannot be null) - * @param process in this address space - * @param rt Java runtime for this context (may be null) + * @param process process in this address space + * @param runtime Java runtime for this context (may be null) * @return the context */ - public static IDTFJContext getContext(final int major, final int minor,final Image image, final ImageAddressSpace space, final ImageProcess proc, final JavaRuntime rt) { - DTFJContext ctx = new DTFJContext(major, minor, image, space, proc, rt); + public static IDTFJContext getContext(final int major, final int minor, final Image image, final ImageAddressSpace space, final ImageProcess process, final JavaRuntime runtime) { + DTFJContext ctx = new DTFJContext(major, minor, image, space, process, runtime); ctx.refresh(); return ctx; } - + /** - * Create a stub DTFJ context which just contains the global commands - * + * Create a stub DTFJ context which just contains the global commands. + * + * @param major DTFJ API major version to be supported + * @param minor DTFJ minor version to be supported * @return the context */ public static IDTFJContext getEmptyContext(final int major, final int minor) { diff --git a/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/commands/BaseCommand.java b/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/commands/BaseCommand.java index 60d468ee7b4..fb4c33086ab 100644 --- a/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/commands/BaseCommand.java +++ b/jcl/src/openj9.dtfj/share/classes/com/ibm/java/diagnostics/utils/commands/BaseCommand.java @@ -32,35 +32,38 @@ import com.ibm.java.diagnostics.utils.plugins.PluginConfig; /** - * Base command which supplies basic support - * - * @author adam + * Base command which supplies basic support. * + * @author adam */ public abstract class BaseCommand implements ICommand { + protected static final String nl = System.getProperty("line.separator"); protected static final String COMMAND_FORMAT = "%-25s %-20s %s\n"; protected static final String SUBCOMMAND_FORMAT = "%25s %-20s %s\n"; private static final String KEY_ID = ":"; - private Map _commands = new LinkedHashMap(); - private Map _subCommands = new LinkedHashMap(); - - private boolean isDirty = false; //indicates if a command or subcommand has been added - - private Set descriptions = new LinkedHashSet(); - protected PluginConfig config; //configuration used to generate this command - + private final Map _commands = new LinkedHashMap<>(); + private final Map _subCommands = new LinkedHashMap<>(); + + private boolean isDirty = false; // indicates if a command or subcommand has been added + + private final Set descriptions = new LinkedHashSet<>(); + protected PluginConfig config; // configuration used to generate this command + + protected BaseCommand() { + super(); + } + /** - * + * * @param name Command Name - * @param argDescription Brief name of any optional or required arguments - * @param helpDescription One-liner Description of the command - * - * argDescription should be a word describing the argument name. - * e.g:
to specify an address argument that is mandatory - * [address] to specify an address argument that is optional - * + * @param argDescription brief description of any optional or required arguments + * @param helpDescription one-line description of the command + * + * argDescription should be a word describing the argument name, + * e.g: <address> to specify an address argument that is mandatory, or + * [address] to specify an address argument that is optional */ public CommandDescription addCommand(String name, String argDescription, String helpDescription) { @@ -69,7 +72,7 @@ public CommandDescription addCommand(String name, String argDescription, String _commands.put(name.toLowerCase(), description); return description; } - + public void addSubCommand(String cmdname, String subname, String argDescription, String help) { isDirty = true; @@ -81,7 +84,7 @@ public void addSubCommand(String cmdname, String subname, String argDescription, } _subCommands.put(cmdname + KEY_ID + subname, subCommand); } - + public boolean recognises(String command, IContext context) { return _commands.containsKey(command.toLowerCase()); } @@ -109,7 +112,7 @@ public Collection getCommandNames() { public PluginConfig getConfig() { return config; } - + public void setConfig(PluginConfig config) { this.config = config; }