JetBrains / Grammar-Kit

Grammar files support & parser/PSI generation for IntelliJ IDEA
Other
715 stars 125 forks source link

Add nullability annotations in generated code #346

Open ris58h opened 1 year ago

ris58h commented 1 year ago

At least a return value of Factory#createElement is always non-null.

// ... enclosing class ...
class Factory {
  public static PsiElement createElement(ASTNode node) {
    IElementType type = node.getElementType();
    // if (type == ...
    throw new AssertionError("Unknown element type: " + type);
  }
}
// ... enclosing class ...