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

Running assertj generator on JDK 11 #128

Open
nickstolwijk opened this issue Nov 26, 2018 · 3 comments
Open

Running assertj generator on JDK 11 #128

nickstolwijk opened this issue Nov 26, 2018 · 3 comments

Comments

@nickstolwijk
Copy link

I am trying to build a library with OpenJDK 11 with the maven-assertj-generator plugin enabled. However, the plugin succeeds, but generates non-compiling code.

Has anyone had any succes on running the assertj-generator with OpenJDK 11?

Generated code:

/**
   * Verifies that the actual Melding's referenties contains the given interface Referentie elements.
   * @param referenties the given elements that should be contained in actual Melding's referenties.
   * @return this assertion object.
   * @throws AssertionError if the actual Melding's referenties does not contain all given interface Referentie elements.
   */
  public MeldingAssert hasReferenties(interface Referentie... referenties) {
    // check that actual Melding we want to make assertions on is not null.
    isNotNull();

    // check that given interface Referentie varargs is not null.
    if (referenties == null) failWithMessage("Expecting referenties parameter not to be null.");

    // check with standard error message, to set another message call: info.overridingErrorMessage("my error message");
    Iterables.instance().assertContains(info, actual.getReferenties(), referenties);

    // return the current assertion for method chaining
    return this;
  }

Wrong line:
public MeldingAssert hasReferenties(interface Referentie... referenties) {
Expected line:
public MeldingAssert hasReferenties(Referentie... referenties) {

To solve the issue, I tried building the assertj-assertions-generator on OpenJDK 11, but I also ran into all kinds of trouble.

  • Tried to build a latest version of com.google.testing.compile:compile-testing
  • Tried to upgrade Guava
  • Needed to upgrade to JDK 8 source code
  • Ran into troubles running JUnit Theories
@joel-costigliola
Copy link
Member

The generator has not been tested on JDK 11 indeed.
It looks like the issue is related to introspection, there might have been differences with JDK 11 as per finding type names.
I haven't much time to spend on the generator but I'm happy to review PRs if you feel like fixing the issue.

@NeoJustin
Copy link

It looks like JDK 11 is not the issue here, since I have the same issue with a JDK 8 installed.
I have made it work with the assertj-assertions-generator-maven-plugin version at 2.0.0 and assertj-core at 3.9.0 (higher version gives other errors) for now.

@joel-costigliola
Copy link
Member

@NeoJustin thanks for the feedback!

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

No branches or pull requests

3 participants