public static ProgramLocation getLocation(Program program, SaveState saveState) {
		String className = saveState.getString("_CLASSNAME", null);
		if (className == null) {
			return null;
		}

		try {
			Class<?> locationClass = Class.forName(className);
			if (locationClass.isInterface()) {
				// This check is needed due to a refactoring that has changed a class into an 
				// interface.  The class name may have been saved into the tool.  Upon restoring we
				// may try to restore that class.  If that class is now an interface, the restore
				// will not work.
				return null;
			}

			ProgramLocation loc = (ProgramLocation) locationClass.getConstructor().newInstance();
			loc.restoreState(program, saveState);
			if (loc.getAddress() != null) {
				return loc;
			}
			// no address, it must be in a removed block; we can't use it
		}
		catch (ClassNotFoundException e) {
			// this can happen for locations created by plugins that are no longer installed
		}
		catch (InstantiationException | IllegalAccessException | NoSuchMethodException e) {
			Msg.showError(ProgramLocation.class, null, "Programming Error",
				"Class " + className + " must have public default constructor!", e);
		}
		catch (InvocationTargetException e) {
			Msg.showError(ProgramLocation.class, null, "Programming Error",
				"Class " + className + " default constructor threw an exception!", e);
		}
		return null;
	}
Get the program location for the given program and save state object.

@param program the program for the location
@param saveState the state to restore
@return the restored program location
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/ProgramLocation.java