google / google/polymorphicDSL

Adjust ANTLR4 to generate a new interface that provides stubbed implementations for rules we don't care about

Open
#36 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
17
Forks
10
PR merge metrics
No merged PRs in 30d

Description

For Gherkin-style tests ANTLR4 gives us two choices for the listener: an abstract class with empty implementations for everything or an interface.

The problem with the abstract class is it is too easy for the grammar to change and other clients will not realize they need to provide an implementation. This can lead to false positives.

The interface requires implementing a lot of methods that have no value (such as the exit methods).

It would be great to have a third option that provided an empty implementation for all exit methods as well as any rules that follow some convention (such as a '_' character at the end of the rule name. In this manner the user will only need to provide implementations for the enter methods of consequence and changes will allow other clients to see they need to add new functionality.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.