@Override
	public AttributedString createAnnotatedString(AttributedString prototypeString, String[] text,
			Program program) throws AnnotationException {
		// if the text is not of adequate size, then show an error string
		if (text.length <= 1) {
			throw new AnnotationException(INVALID_SYMBOL_TEXT);
		}

		if (program == null) { // this can happen during merge operations
			return createUndecoratedString(prototypeString, text);
		}

		Address address = program.getAddressFactory().getAddress(text[1]);

		if (address == null) {
			return new AttributedString("No address: " + text[1], Messages.ERROR,
				prototypeString.getFontMetrics(0), false, null);
		}

		String addressText = address.toString();
		if (text.length > 2) { // address and display text
			StringBuilder buffer = new StringBuilder();
			for (int i = 2; i < text.length; i++) {
				buffer.append(text[i]).append(" ");
			}
			buffer.deleteCharAt(buffer.length() - 1);  // remove last space
			addressText = buffer.toString();
		}

		return new AttributedString(addressText, prototypeString.getColor(0),
			prototypeString.getFontMetrics(0), true, prototypeString.getColor(0));
	}
Constructs a well-formed Address Annotation comment string.

@param addressOffset destination of the annotation
@param displayText text that will be used as the body of the annotation.  Problematic
characters will be escaped
@return string
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/AddressAnnotatedStringHandler.java