Skip to content

Make Generator an interface #253

Open

Description

@vlsi

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.

Activity

  1. pholser commented on Jan 19, 2020

    @pholser
    Owner

    @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.

  2. vlsi commented on Jan 19, 2020

    @vlsi
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions