antlr / antlr/antlr3

@SuppressWarnings("all") on generated Java classes is ineffective

Open
#186 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
253
Forks
178
PR merge metrics
No merged PRs in 30d

Description

javac apparently ignores `@SuppressWarnings("all")`. Therefore, this should be replaced by the list of actual warnings ANTLR's generated code triggers, to actually suppress the warnings.

I'm not exactly aware of the complete set of warnings it can create, but here's the common ones from our build.

QueryParserLexer.java:12, Java Compiler (javac), Priority: Normal
no comment

QueryParserLexer.java:74, Java Compiler (javac), Priority: Normal
no @return

Missing Javadoc, basically. I can't tell what the warning category is for this one (it appears to be blank), but perhaps it could be suppressed by generating some "token" (no pun intended) Javadoc.

QueryParserParser.java:138, Java Compiler (javac), Priority: Normal
redundant cast to Object

This one is a bit more perplexing. You can suppress these with `SuppressWarnings("cast")`. But I get 250 of these "cast" warnings, and it's always to `Object`. If it's always to `Object`, why even cast? i.e., for this one, maybe ANTLR could just generate better code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the javac warnings reported for the generated QueryParserLexer.java and QueryParserParser.java files, including missing Javadoc and redundant casts to Object. Determine the actual warning categories and update generation so the generated classes no longer produce these warnings; done means the reported warnings are suppressed or eliminated.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.