checkerframework-gradle-plugin icon indicating copy to clipboard operation
checkerframework-gradle-plugin copied to clipboard

Need to configure an additional .astub file for "test" and/or "testFixtures"

Open slaout opened this issue 2 years ago • 0 comments

In our checker-framework.astub, we have stubs for test classes like this:

package org.assertj.core.api;
public class AbstractAssert<SELF extends AbstractAssert<SELF, ACTUAL>, ACTUAL> implements Assert<SELF, ACTUAL> {
  public SELF isNotEqualTo(@Nullable Object other);
  public SELF isEqualTo(@Nullable Object other);
}

But at the "compileJava" phase, we get this warning:

warning: .../checker-framework.astub:(line 20,col 1): Type not found: org.assertj.core.api.AbstractAssert

The test classes are not known from the point of view of src/main/java, thus the warning.

We declare the astub file like this:

checkerFramework {
    extraJavacArgs += [
          // toString: avoid "Unable to deserialize the dev mode context ... ClassNotFoundException ... GStringImpl"
          // Because Quarkus serialize in the compilation phase and this GStringImpl class in not found
          // when deserialized during Dev-Mode execution
          "-Astubs=${projectDir}/checker-framework.astub".toString()
    ]
}

(not sure if there is a better way about the toString(), but this has no importance here)

I'd like to have either:

  • an option to separate javacArgs for tests or
  • be able to separate the whole checkerFramework configuration for tests or
  • a better way to declare stub files in the plugin configuration, with several keys based on the compilation context:
    • compileAstubFiles = "..."
    • testFixturesCompileAstubFiles = "..."
    • testCompileAstubFiles = "..."

slaout avatar Nov 10 '22 08:11 slaout