Repository: NationalSecurityAgency/ghidra
File: Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java (Java)

Code before:
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name or null if not found
	 */
	public final Namespace getNamespace(Namespace parent, String namespaceName) {
		return currentProgram.getSymbolTable().getNamespace(namespaceName, parent);
	}
	
	/**
	 * Creates a new namespace with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for namespace to indicate the global namespace.
	 * If the namespace already exists then the existing one will be returned.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name
	 * @throws InvalidInputException if the name is invalid
	 */
	public final Namespace createNamespace(Namespace parent, String namespaceName)
			throws InvalidInputException {
		SymbolTable symbolTable = currentProgram.getSymbolTable();
		Namespace ns = symbolTable.getNamespace(namespaceName, parent);
		if (ns != null) {
			SymbolType type = ns.getSymbol().getSymbolType();
			if (type == SymbolType.NAMESPACE || type == SymbolType.CLASS) {
				return ns;
			}
		}
		try {
			return symbolTable.createNameSpace(parent, namespaceName, SourceType.USER_DEFINED);
		}
		catch (DuplicateNameException e) {
			// impossible
			throw new AssertException(e);
		}
	}

	/**
	 * Creates a fragment in the root folder of the default program tree.
	 * @param fragmentName the name of the fragment
	 * @param start the start address
	 * @param end the end address (NOT INCLUSIVE)
	 * @return the newly created fragment
	 * @throws DuplicateNameException if the given fragment name already exists
	 * @throws NotFoundException if any address in the fragment would be outside of the program
	 * @deprecated This method is deprecated because it did not allow you to include the
	 * largest possible address.  Instead use the one that takes a start address and a length.
	 */
	@Deprecated
	public final ProgramFragment createFragment(String fragmentName, Address start, Address end)
			throws DuplicateNameException, NotFoundException {
		ProgramModule module = currentProgram.getListing().getDefaultRootModule();

Review comment (suggestion):
Javadoc should make it clear that an existing Namespace or GhidraClass could be returned.  Any thoughts on creation of GhidraClass?  You could link to SymbolTable.convertNamespaceToClass which may be useful.

Code after:
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name or null if not found
	 */
	public final Namespace getNamespace(Namespace parent, String namespaceName) {
		return currentProgram.getSymbolTable().getNamespace(namespaceName, parent);
	}
	
/**
	 * Creates a new {@link Namespace} with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for parent to indicate the global namespace.
	 * If a {@link Namespace} or {@link GhidraClass} with the given name already exists, the
	 * existing one will be returned.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name
	 * @throws DuplicateNameException if a {@link Library} symbol exists with the given name
	 * @throws InvalidInputException if the name is invalid
	 */
	public final Namespace createNamespace(Namespace parent, String namespaceName)
			throws DuplicateNameException, InvalidInputException {
		SymbolTable symbolTable = currentProgram.getSymbolTable();
		Namespace ns = symbolTable.getNamespace(namespaceName, parent);
		if (ns != null) {
			SymbolType type = ns.getSymbol().getSymbolType();
			if (type == SymbolType.NAMESPACE || type == SymbolType.CLASS) {
				return ns;
			}
		}
		return symbolTable.createNameSpace(parent, namespaceName, SourceType.USER_DEFINED);
	}
	
	/**
	 * Creates a new {@link GhidraClass} with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for parent to indicate the global namespace.
	 * If a GhidraClass with the given name already exists, the existing one will be returned.
	 * @param parent the parent namespace, or null for global namespace
	 * @param className the requested classes name
	 * @return the GhidraClass with the given name
	 * @throws InvalidInputException if the name is invalid
	 * @throws DuplicateNameException thrown if a {@link Library} or {@link Namespace}
	 * symbol already exists with the given name.
	 * Use {@link SymbolTable#convertNamespaceToClass(Namespace)} for converting an
	 * existing Namespace to a GhidraClass.
	 * @throws IllegalArgumentException if the given parent namespace is not from
	 * the {@link #currentProgram}.
	 * @throws ConcurrentModificationException if the given parent has been deleted
	 * @see SymbolTable#convertNamespaceToClass(Namespace)
	 */
	public final GhidraClass createClass(Namespace parent, String className)