Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Generator an interface #253

Open
vlsi opened this issue Jan 19, 2020 · 2 comments
Open

Make Generator an interface #253

vlsi opened this issue Jan 19, 2020 · 2 comments
Labels

Comments

@vlsi
Copy link
Contributor

vlsi commented Jan 19, 2020

Currently, Generator is a class, and it makes it complicated to implement generators.

For instance, I already have a generator, however, it extends its own class for simplified API.

Base class: https://github.com/apache/calcite/blob/763ec429c951acd5fa251c5d4a2b7780fbf648d4/core/src/test/java/org/apache/calcite/rex/RexProgramBuilderBase.java#L44

Uses in the generator: https://github.com/apache/calcite/blob/763ec429c951acd5fa251c5d4a2b7780fbf648d4/core/src/test/java/org/apache/calcite/test/fuzzer/RexFuzzer.java#L184

It does not hurt much, however, at this point it looks like all the Generator / Shrinker behavior can be implemented with interface default methods.

@pholser
Copy link
Owner

pholser commented Jan 19, 2020

@vlsi Thanks for this. I'm open to having Generator become an interface. My main concern is avoiding breaking existing subclasses of Generator, as you might expect. I'll noodle on this a bit.

@vlsi
Copy link
Contributor Author

vlsi commented Jan 19, 2020

My main concern is avoiding breaking existing subclasses of

I see.

There are two options at least:

  • Just do it :) junit-quickcheck is 0.x, so slight glitches in the backward compatibility are expected by the consumers
  • Add super interface for those who want to implement a generator without having to extend a base class (and use it internally instead of the current Generator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants