@Override
	public String getDisplayName(int tokenType) {
		if (tokenType >= 0 && tokenType < displayNames.length) {
			String displayName = displayNames[tokenType];
			if (displayName != null) {
				return displayName;
			}
		}

		String literalName = getLiteralName(tokenType);
		if (literalName != null) {
			return literalName;
		}

		String symbolicName = getSymbolicName(tokenType);
		if (symbolicName != null) {
			return symbolicName;
		}

		return Integer.toString(tokenType);
	}
Returns a {@link VocabularyImpl} instance from the specified set of token
names. This method acts as a compatibility layer for the single
{@code tokenNames} array generated by previous releases of ANTLR.

<p>The resulting vocabulary instance returns {@code null} for
{@link #getLiteralName(int)} and {@link #getSymbolicName(int)}, and the
value from {@code tokenNames} for the display names.</p>

@param tokenNames The token names, or {@code null} if no token names are
available.
@return A {@link Vocabulary} instance which uses {@code tokenNames} for
the display names of tokens.
runtime/Java/src/org/antlr/v4/runtime/VocabularyImpl.java