antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.12k stars 3.28k forks source link

Support Java 8 default interface methods instead of ...BaseListener or ...BaseVisitor classes #2988

Open rlwhitcomb opened 3 years ago

rlwhitcomb commented 3 years ago

Java 8+ supports default interface methods which could be used instead of generating separate BaseListener or BaseVisitor classes. Could this be an option when generating for Java 8+?

ericvergnaud commented 3 years ago

It could be an option if we decide to drop Java 7, but imho default interface methods are convenient for hand written code, but do not add value to computer generated code

KvanTTT commented 3 years ago

It is also actual for C# 8 that have default interface methods feature.

Maybe it makes sense to add an option -Dversion that defines the language version of the generated code.