kelloggm / checkerframework-gradle-plugin

Gradle plugin to use the Checker Framework for Java
Apache License 2.0
64 stars 15 forks source link

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

Open slaout opened 1 year ago

slaout commented 1 year ago

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: