Skip to content

Instantly share code, notes, and snippets.

@mebigfatguy
Created July 15, 2025 15:03
Show Gist options
  • Select an option

  • Save mebigfatguy/377dc1b7bac1b4bbf4f54422ff961c81 to your computer and use it in GitHub Desktop.

Select an option

Save mebigfatguy/377dc1b7bac1b4bbf4f54422ff961c81 to your computer and use it in GitHub Desktop.
public class ZeroSpaceCheck extends AbstractCheck {
@Override
public int[] getAcceptableTokens() {
return getRequiredTokens();
}
@Override
public int[] getDefaultTokens() {
return getRequiredTokens();
}
@Override
public int[] getRequiredTokens() {
return new int[] { TokenTypes.IDENT };
}
@Override
public void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.IDENT) {
String id = ast.getText();
int index = id.indexOf("\u200B");
if (index >= 0) {
log(ast, "Zero Space Character found in " + id + " at position " + index);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment