projectlombok/lombok · error · IllegalArgumentException

Not an identifier (provide a fully qualified type for…

Error message

Not an identifier (provide a fully qualified type for custom: nullity annotations): 

What it means

When a CUSTOM: null annotation library is parsed, verifyTypeName checks that each annotation type name is a valid dotted fully-qualified Java type. A name whose first character is not a valid Java identifier start throws this IllegalArgumentException.

Solutions

  1. Provide fully qualified type names with valid Java identifiers, e.g. CUSTOM:my.pkg.NonNull:my.pkg.Nullable.
  2. Remove leading dots, digits, or symbols from the type segments.
  3. Verify colon placement: CUSTOM:[TYPE_USE:]nonnull:nullable — no empty segments.

Example fix

// before
lombok.nullable.annotations = CUSTOM:.checkers.nullness.qual.Nullable
// after
lombok.nullable.annotations = CUSTOM:org.checkerframework.checker.nullness.qual.NonNull:org.checkerframework.checker.nullness.qual.Nullable
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidFqnSegment(String fqn) {
  if (fqn == null || fqn.isEmpty()) return false;
  for (String part : fqn.split("\\.")) {
    if (part.isEmpty() || !Character.isJavaIdentifierStart(part.charAt(0))) return false;
    for (char c : part.substring(1).toCharArray()) if (!Character.isJavaIdentifierPart(c)) return false;
  }
  return true;
}

Try / catch

try {
  NullAnnotationLibrary lib = NullAnnotationLibrary.valueOf("CUSTOM:" + nonNull + ":" + nullable);
} catch (IllegalArgumentException e) {
  // correct the type names before retrying
}

Prevention

When it happens

Trigger: valueOf('CUSTOM:...') where the non-null or nullable annotation type begins with an invalid character (digit, '.', symbol) or is empty at that position — detected at the identifier-start check (atStart still true when a non-start char is found).

Common situations: Writing 'CUSTOM:.util.Nullable', 'CUSTOM:1Nullable:Nullable', or leaving the segment empty due to a misplaced colon in the custom: syntax.

Related errors


AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07). Data as JSON: /api/errors/f3b4c5c1f1e591af. Report an issue: GitHub.

Appendix: source

Thrown at src/core/lombok/core/configuration/NullAnnotationLibrary.java:148

		if (split == -1) {
			String nonNullAnnotation = in.substring(start);
			return custom(verifyTypeName(nonNullAnnotation), null, typeUse);
		}
		String nonNullAnnotation = in.substring(start, split);
		String nullableAnnotation = in.substring(split + 1);
		return custom(verifyTypeName(nonNullAnnotation), verifyTypeName(nullableAnnotation), typeUse);
	}
	
	private static final String MSG = "Not an identifier (provide a fully qualified type for custom: nullity annotations): ";
	private static String verifyTypeName(String fqn) {
		boolean atStart = true;
		for (int i = 0; i < fqn.length(); i++) {
			char c = fqn.charAt(i);
			if (Character.isJavaIdentifierStart(c)) {
				atStart = false;
				continue;
			}
			if (atStart) throw new IllegalArgumentException(MSG + fqn);
			if (c == '.') {
				atStart = true;
				continue;
			}
			if (Character.isJavaIdentifierPart(c)) continue;
			throw new IllegalArgumentException(MSG + fqn);
		}
		if (atStart) throw new IllegalArgumentException(MSG + fqn);
		return fqn;
	}
	
	@Override public String toString() {
		return key;
	}
}

View on GitHub (pinned to 6d6a3e9fec)