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

Many warning messages related to errorprone "CompatibleWith" #2721

Closed
enwired opened this issue Jan 20, 2017 · 35 comments
Closed

Many warning messages related to errorprone "CompatibleWith" #2721

enwired opened this issue Jan 20, 2017 · 35 comments
Milestone

Comments

@enwired
Copy link

enwired commented Jan 20, 2017

When compiling code that depends on Guava 21.0, [Edit: I mistakenly said 20.0 originally] using Maven, I get many warning messages like this:

Cannot find annotation method 'value()' in type 'com.google.errorprone.annotations.CompatibleWith': class file for com.google.errorprone.annotations.CompatibleWith not found

I do not use the errorprone library in my code, so this error message is due to its use by Guava.

Obviously, these are only warning messages and are not critical.

@cpovirk
Copy link
Member

cpovirk commented Jan 20, 2017

The reason is that we don't make the Error Prone annotations available to our users at compile time. We could maybe change that, but our understanding has been that it shouldn't be necessary. Do you know if you're using any Maven plugins that might be plugging into the compiler (annotation processors, mainly)?

@enwired
Copy link
Author

enwired commented Jan 20, 2017

These warnings are happening even in some pretty simple packages where there are no exotic maven plugins.

It does not happen on all of my modules that use Guava. But I haven't narrowed-down which Guava class is involved.

The warnings happen during the "default-compile" step from maven-compiler-plugin. I've tried version 3.3 and 3.6 of that plugin.

The warnings appear even if I set <showWarnings>false</showWarnings>

@enwired
Copy link
Author

enwired commented Jan 20, 2017

Ok. So this is related to annotation processors of some basic sort. My standard build involves this:

<build>
  <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <compilerArgs>
            <arg>-Xlint:all</arg>
            <arg>-Xlint:-serial</arg>
          </compilerArgs>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
        </configuration>
      </plugin>
  </plugins>
</build>

The warnings are shown only when I include Xlint along with either of showWarnings or showDeprecation.

Then 9 identical warnings appear if my java code contains one single line like this:
ImmutableTable.Builder<?,?,?> builder = ImmutableTable.builder();

So, I don't know if there is a bug in maven compiler plugin, or in Guava's ImmutableTable or what. But I really shouldn't be seeing these warnings.

Again, not a bug in the program operation, just an annoying set of warning messages.

@stevenschlansker
Copy link

stevenschlansker commented Jan 21, 2017

We ran into this attempting to upgrade the jdbi3 project to Guava 21:
jdbi/jdbi#697

We also don't do anything super fancy with Maven plugins, but we do attempt to set "warnings as errors" everywhere. That said, despite being logged at ERROR level, it doesn't fail the build.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:
testCompile (default-testCompile) on project jdbi3-sqlobject: Compilation failure

[ERROR] /home/travis/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar(com/google/common/collect/Multimap.class):
warning: Cannot find annotation method 'value()' in type 'CompatibleWith': 
class file for com.google.errorprone.annotations.CompatibleWith not found

@cpovirk
Copy link
Member

cpovirk commented Jan 23, 2017

Thanks. I tried pulling the jdbi3 and running mvn clean install. It successes without the CompatibleWith message. Is there a different command I should use or a different commit I should check out?

@stevenschlansker
Copy link

No, sorry, an earlier version of this comment incorrectly stated the build failed.

The actual problem is that the javac output all gets logged at the maximum error level -- so the WARNING that this emits will be represented as an ERROR if there are other build errors, which is confusing. Once you fix the other unrelated build errors this message then gets downgraded to a WARNING. So it does not actually break out build, but it does introduce warnings -- which as soon as "warnings as errors" gets fixed (someday 🤞) it will then actually fail the build

@PhilippWendler
Copy link

I am also seeing this, on a standard javac -Xlint -Werror build with ant.
The messages are

    [javac] .../guava.jar(com/google/common/collect/Multiset.class): warning: Cannot find annotation method 'value()' in type 'CompatibleWith': class file for com.google.errorprone.annotations.CompatibleWith not found
    [javac] .../guava.jar(com/google/common/collect/Multiset.class): warning: Cannot find annotation method 'value()' in type 'CompatibleWith'
    [javac] error: warnings found and -Werror specified

Because we want to use -Werror, this breaks our build and prevents us from upgrading Guava.

@enwired
Copy link
Author

enwired commented Jan 25, 2017

@PhilippWendler thanks for trying javac. Which JDK version is it?

I have found that I can eliminate the warning message in a Maven build by using this flag for the maven-compiler-plugin: <forceJavacCompilerUse>true</forceJavacCompilerUse>. That should make Maven use the javac command in my jdk, which is 1.8.0_66. I don't exactly understand why that removes the warning.

@PhilippWendler
Copy link

I tested with javac 1.8.0_111 from OpenJDK.

@cpovirk
Copy link
Member

cpovirk commented Jan 25, 2017

Running mvn clean install on jdbi3 didn't give me any output that mentions "CompatibleWith" anywhere. I tried with -Dmaven.compiler.forceJavacCompilerUse=true, and I tried introducing a compile error into a file that uses Multimap, and I still don't see it.

If anyone can point me to a repository and a command that I can use to reproduce this, that would be a big help. There's definitely something wrong, but I need to figure out where to point the finger (which might be at us -- I'm not just not sure yet).

@cpovirk
Copy link
Member

cpovirk commented Jan 25, 2017

In the meantime, as a workaround, you can probably add an explicit dependency on:

    <groupId>com.google.errorprone</groupId>
    <artifactId>error_prone_annotations</artifactId>
    <version>2.0.15</version>

@Stephan202
Copy link
Contributor

^ And if you declare that dependency <scope>provided</scope>, then it shouldn't end up in your final aggregate build artifact (WAR, Uber JAR, etc.), meaning there should be no downside to doing so.

@PhilippWendler
Copy link

You should be able to reproduce the problem in branch guava21 of sosy-lab/java-common-lib. You can start a build with javac with ant clean build-project. The definition of the ant target that calls javac is in build/build-compile.xml, you can see the compiler options there.

The problem is reproducible with this branch on AppVeyor (log) and Travis (log).

Btw, we are even using error-prone already (though I disabled it in that branch for easier debugging) and want to upgrade to 2.0.15 at some point anyway, but I think that it would still be good if Guava would not have this problem.

The Eclipse Java Compiler builds our project just fine (ant clean build-project-ecj).

@enwired
Copy link
Author

enwired commented Jan 25, 2017

@cpovirk To reproduce the problem in Maven you must use both Xlint and showWarnings or showDeprecation. @PhilippWendler did something similar with javac -Xlint -Werror. So it may be that the problem is related to lint.

You can then reproduce it with a project containing one single java class like this:

public class GuavaTest {
  private ImmutableTable.Builder table = ImmutableTable.builder();
}

@cpovirk
Copy link
Member

cpovirk commented Jan 25, 2017

@PhilippWendler , thanks, I'm now seeing the error. I'll poke around some more.

@cpovirk
Copy link
Member

cpovirk commented Jan 25, 2017

And thanks @enwired. I can reproduce with that, too.

@jentfoo
Copy link

jentfoo commented Jan 31, 2017

We are also experiencing this issue. The noise makes it hard to want to push Guava 21 forward through all our projects.

@cpovirk
Copy link
Member

cpovirk commented Jan 31, 2017

As far as I can tell, this was our fault. Sorry about that. I've fixed it for 22.0. In the meantime, you can try the workaround above.

@stevenschlansker
Copy link

Any chance of a 21.1 release? Or is 22.0 coming soon?

@cpovirk
Copy link
Member

cpovirk commented Jan 31, 2017

Does the workaround work OK? Knowing that will help us prioritize.

@netdpb for an estimate on 22.0.

@jentfoo
Copy link

jentfoo commented Jan 31, 2017

Does the workaround work OK?

Yes, it does work. However I don't think you should expect that everyone will go to github and search this issue.

To me personally this definitely seems like a defect large enough to warrant a patch release. It causes everyone who may treat warnings as errors to have to either search for this obscure issue, or to modify their projects in a way that is not reasonable (you should be able to reasonably treat warnings aggressively as external libraries should not be causing compiler warnings).

@ahmed-a-e2006
Copy link

ahmed-a-e2006 commented Jun 11, 2017

I'm using guava 22.0
I tried your workaround by adding

    <groupId>com.google.errorprone</groupId>
    <artifactId>error_prone_annotations</artifactId>
    <version>2.0.15</version>

I have a lot of warnings before and after applying the workaround like this

Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.

   Computing all possible rebind results for 'com.google.gwt.useragent.client.UserAgentAsserter'
      Rebinding com.google.gwt.useragent.client.UserAgentAsserter
         Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryGenerator'/>
            [WARN] Unknown type 'com.google.web.bindery.requestfactory.shared.RequestFactory' specified in deferred binding rule
         Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryEditorDriverGenerator'/>
            [WARN] Unknown type 'com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver' specified in deferred binding rule
         Checking rule <generate-with class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/>
            [WARN] Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'.   Are validation-api-<version>.jar and validation-api-<version>-sources.jar on the classpath?
            Specify -logLevel DEBUG to see all errors.
            [WARN] Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule
      Rebinding com.google.gwt.useragent.client.UserAgentAsserter
         Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryGenerator'/>
            [WARN] Unknown type 'com.google.web.bindery.requestfactory.shared.RequestFactory' specified in deferred binding rule
         Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryEditorDriverGenerator'/>
            [WARN] Unknown type 'com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver' specified in deferred binding rule			
   Computing all possible rebind results for 'com.google.gwt.user.client.DocumentModeAsserter'
       Rebinding com.google.gwt.user.client.DocumentModeAsserter
          Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryGenerator'/>
             [WARN] Unknown type 'com.google.web.bindery.requestfactory.shared.RequestFactory' specified in deferred binding rule
          Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryEditorDriverGenerator'/>
             [WARN] Unknown type 'com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver' specified in deferred binding rule
       Rebinding com.google.gwt.user.client.DocumentModeAsserter
          Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryGenerator'/>
             [WARN] Unknown type 'com.google.web.bindery.requestfactory.shared.RequestFactory' specified in deferred binding rule
          Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryEditorDriverGenerator'/>
             [WARN] Unknown type 'com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver' specified in deferred binding rule
    Computing all possible rebind results for 'com.google.gwt.logging.client.LogConfiguration

@cpovirk
Copy link
Member

cpovirk commented Jun 12, 2017

My guess is that those warnings are unrelated -- that they'd be there even if Guava weren't using these annotations at all. I don't know enough about GWT to say what the cause would be, though :(

@prampec
Copy link

prampec commented Jun 30, 2017

The "Cannot find annotation method 'value()' in type 'CompatibleWith'" warning still appears with guava-22.0. Adding error_prone_annotations-2.0.19 to the dependencies helped.

@prampec
Copy link

prampec commented Jul 7, 2017

Update on my comment: When compiling with guava-22.0 and jdk-1.8.0_31 the warning appears without the error_prone_annotations-2.0.19. With jdk-1.8.0_131 no errors, even without the error_prone_annotations jar.

ronshapiro pushed a commit to google/truth that referenced this issue Jun 1, 2018
Such dependencies have caused problems for Guava users, so I'd expect the same here:
google/guava#2721

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198881918
ronshapiro pushed a commit to google/truth that referenced this issue Jun 1, 2018
Such dependencies have caused problems for Guava users, so I'd expect the same here:
google/guava#2721

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198881918
cpovirk added a commit to google/truth that referenced this issue Jul 12, 2018
…nt, thereby bumping Guava to 25.1 in the POMs I'd missed before.

I also:
- upgraded to the newest versions of our dependencies, using:
  mvn versions:use-latest-versions -Dexcludes=org.checkerframework,com.google.gwt,com.google.auto.value,com.google.guava
  mvn versions:display-dependency-updates # for manual review of dependencies whose versions are set in properties
- switched to the currently recommended way of depending on AutoValue (possibly outright necessary after the upgrades, but a good idea anyway)
- stopping marking annotations dependencies as <optional>, following our precedent in Guava (google/guava#2721) and even a little already in Truth (CL 198881917)

The switch to dependencyManagement also incidentally bumps some jsr305 and Checker Framework versions for some POMs, but that's much less likely to matter.

Fixes #473

RELNOTES=Made various dependency fixes and upgrades, including fixing #473. Note that some annotations-only dependencies are now no longer `<provided>`. See google/guava#2721 for details, but in short, feel free to exclude them if that works for your setup.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204292747
ZacSweers added a commit to uber/AutoDispose that referenced this issue Oct 12, 2018
0.42
Made various dependency fixes and upgrades, including fixing #473 and #467. Note that some annotations-only dependencies are now no longer <provided>. See google/guava#2721 for details, but in short, feel free to exclude them if that works for your setup.
Fixed NPE in MapSubject.containsExactly (#468).

0.41
Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. (4a51035)
Introduced the new API for building failure messages in a "key: value" format. See Subject.failWithActual and failWithoutActual, which use the new Fact class. (e06ca85)
Changed the old API's failure messages to automatically add a "name: ..." field if the user called named(). In some cases, this adds a name where it was missing before; in others, it duplicates a name that is already present. The long-term fix for this will be to migrate to the new failure API, which always includes the name once, and possibly also to delete named() in favor of withMessage(). (911c939)
Deprecated failWithRawMessageAndCause. Truth automatically attaches the cause if it's part of the assertion chain. If not, see the deprecation docs for the workaround. (3622e9c)
Deprecated failComparing. Use check("foo").that(actual().foo()).isEqualTo(expectedFoo). (2db2a4f)
Deprecated the remaining legacy fail* methods. (1f9b2d6)
Hid protected method IterableSubject.failWithBadResultsAndSuffix() (5becbfe).
Started throwing ComparisonFailure from MapSubject.containsEntry. (4330ec6)
Started throwing ComparisonFailure from assertThat(singleElementIterable).containsExactly(otherSingleElementIterable). (e44edd1)
Added code to remove Runner and Statement frames from the stack trace. (d2bb074)
Added StringSubject.ignoringCase() (13e8054)
Added ignoringExtraRepeatedFieldElements() to ProtoTruth. (f070204)
Added comparingExpectedFieldsOnly() to ProtoTruth. (08908c1)
Removed deprecated MultimapSubject.containsExactly(Multimap). Use containsExactlyEntriesIn(Multimap). (containsExactly(Object k0, Object v0, Object... rest) continues to exist.) (9c80ad5)
Removed deprecated isPartiallyOrdered() methods. Use isOrdered() (5becbfe).
Started throwing UOE from IterableSubject.isNoneOf() and isNotIn(). (46c8d3d)
Switched to Checker Framework @NullableDecl instead of jsr305 @nullable. Tools that read these annotations may need to be updated to recognize the new annotation. (10ee459)
ZacSweers added a commit to uber/AutoDispose that referenced this issue Oct 15, 2018
* Update Truth to 0.42

0.42
Made various dependency fixes and upgrades, including fixing #473 and #467. Note that some annotations-only dependencies are now no longer <provided>. See google/guava#2721 for details, but in short, feel free to exclude them if that works for your setup.
Fixed NPE in MapSubject.containsExactly (#468).

0.41
Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. (4a51035)
Introduced the new API for building failure messages in a "key: value" format. See Subject.failWithActual and failWithoutActual, which use the new Fact class. (e06ca85)
Changed the old API's failure messages to automatically add a "name: ..." field if the user called named(). In some cases, this adds a name where it was missing before; in others, it duplicates a name that is already present. The long-term fix for this will be to migrate to the new failure API, which always includes the name once, and possibly also to delete named() in favor of withMessage(). (911c939)
Deprecated failWithRawMessageAndCause. Truth automatically attaches the cause if it's part of the assertion chain. If not, see the deprecation docs for the workaround. (3622e9c)
Deprecated failComparing. Use check("foo").that(actual().foo()).isEqualTo(expectedFoo). (2db2a4f)
Deprecated the remaining legacy fail* methods. (1f9b2d6)
Hid protected method IterableSubject.failWithBadResultsAndSuffix() (5becbfe).
Started throwing ComparisonFailure from MapSubject.containsEntry. (4330ec6)
Started throwing ComparisonFailure from assertThat(singleElementIterable).containsExactly(otherSingleElementIterable). (e44edd1)
Added code to remove Runner and Statement frames from the stack trace. (d2bb074)
Added StringSubject.ignoringCase() (13e8054)
Added ignoringExtraRepeatedFieldElements() to ProtoTruth. (f070204)
Added comparingExpectedFieldsOnly() to ProtoTruth. (08908c1)
Removed deprecated MultimapSubject.containsExactly(Multimap). Use containsExactlyEntriesIn(Multimap). (containsExactly(Object k0, Object v0, Object... rest) continues to exist.) (9c80ad5)
Removed deprecated isPartiallyOrdered() methods. Use isOrdered() (5becbfe).
Started throwing UOE from IterableSubject.isNoneOf() and isNotIn(). (46c8d3d)
Switched to Checker Framework @NullableDecl instead of jsr305 @nullable. Tools that read these annotations may need to be updated to recognize the new annotation. (10ee459)

* Update NulLAway to 0.6.0

* Update ErrorProne to 2.3.2

Highlights:
Opt-in check AndroidJdkLibsChecker enforces which JDK libraries can be used in Android applications, and, with the -XepOpt:Android:Java8Libs flag, can allow select Java 8 library support via https://developer.android.com/studio/write/java8-support. Look out for this in bazel.build after the next release.
Immutable{Annotation,Enum}Checker now requires the Error Prone @immutable annotation, not the JSR-305 @immutable annotation
New Checks:
Javadoc Checkers: InvalidParam, InvalidTag, InvalidThrows, ReturnFromVoid
API Checkers: AndroidJdkLibsChecker, Java7ApiChecker, ApiDiffChecker
AnnotateFormatMethod
AnnotationPosition
ArrayAsKeyOfSetOrMap
AutoValueFinalMethods
BadInstanceof
BigDecimalEquals
ClassNamedLikeTypeParameter
CloseableProvides
ComparingThisWithNull
DeprecatedThreadMethods
EqualsBrokenForNull
EqualsGetClass
EqualsUnsafeCast
EqualsUsingHashCode
EqualsWrongThing
ExpectedExceptionRefactoring
ExtendingJUnitAssert
FloatingPointAssertionWithinEpsilon
ImmutableRefactoring
InconsistentHashCode
InjectOnMemberAndConstructor
LockNotBeforeTry
MathAbsoluteRandom
MathRoundIntLong
MissingTestCall
ModifiedButNotUsed
NoFunctionalReturnType
NullableDereference
ObjectsHashCodePrimitive
ProtoRedundantSet
ProtosAsKeyOfSetOrMap
SubstringOfZero
SwigMemoryLeak
SystemExitOutsideMain
TestExceptionRefactoring
ThreadPriorityCheck
ToStringReturnsNull
TruthAssertExpected
TypeNameShadowing
UndefinedEquals
UnnecessaryParentheses
UnsafeReflectiveConstructionCast
UnusedException
VariableNameSameAsType

* AGP 3.2.1

* Fix misconfigured errorProne javac
bazel-io pushed a commit to bazelbuild/bazel that referenced this issue Apr 25, 2019
This is necessary for some forthcoming changes that migrate to methods introduced in that version:
https://github.com/google/truth/releases/tag/release_0_44

While here, move diffutils from runtime_deps to deps. This is unlikely to matter in practice, but in principle it's the right thing, and it *might* matter if static analysis or other build tools (-Xlint:all?) went digging into the deps of Truth at compile time. Such problems (albeit when the dependency's API is publicly visible through the using library) are what prompted the creation of java_import#deps (internal Google bug 23781162). For other problems (that might also not apply here), see google/guava#2721
cpovirk added a commit to google/jimfs that referenced this issue Oct 4, 2019
I was going to say that this also paves the way for including the annotation as a non-optional dependency, should we wish to follow our Guava precedent for annotations:
- google/guava#2824
- google/guava#2721

But I see that it's retention=SOURCE anyway, so there isn't much reason to do that -- except maybe consistency with other annotation packages someday. (Maybe it's still a negative then, as it might still let people rely on our transitive dependency?)

I think the relationship of all this to Java 11 was that I might have to set an Automatic-Module-Name on AutoService, and it makes more sense to set it after we've done the processor-vs.-annotation artifact split. Once I was upgrading, it made sense to set up the annotation processor the Right Away, now that we're using a version in which that works. (Or maybe it always worked but now it's nice that it gets the processor off the classpath?) Or maybe there was some other reason for the change to the annotation-processor setup; once again, I forget. It looks like it might have been that AutoService stops running when I switch how we run Error Prone. Hopefully this was the solution :) But it's probably a good idea in any case.

This CL is basically following the "alternatively" instructions in https://github.com/google/auto/blob/master/value/userguide/index.md#in-pomxml

...even though the AutoService instructions haven't been similarly updated yet: https://github.com/google/auto/tree/master/service#download

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272720556
cpovirk added a commit to google/jimfs that referenced this issue Oct 4, 2019
I was going to say that this also paves the way for including the annotation as a non-optional dependency, should we wish to follow our Guava precedent for annotations:
- google/guava#2824
- google/guava#2721

But I see that it's retention=SOURCE anyway, so there isn't much reason to do that -- except maybe consistency with other annotation packages someday. (Maybe it's still a negative then, as it might still let people rely on our transitive dependency?)

I think the relationship of all this to Java 11 was that I might have to set an Automatic-Module-Name on AutoService, and it makes more sense to set it after we've done the processor-vs.-annotation artifact split. Once I was upgrading, it made sense to set up the annotation processor the Right Away, now that we're using a version in which that works. (Or maybe it always worked but now it's nice that it gets the processor off the classpath?) Or maybe there was some other reason for the change to the annotation-processor setup; once again, I forget. It looks like it might have been that AutoService stops running when I switch how we run Error Prone. Hopefully this was the solution :) But it's probably a good idea in any case.

This CL is basically following the "alternatively" instructions in https://github.com/google/auto/blob/master/value/userguide/index.md#in-pomxml

...even though the AutoService instructions haven't been similarly updated yet: https://github.com/google/auto/tree/master/service#download

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272720556
Matt-Hallcok added a commit to Matt-Hallcok/AutoDispose that referenced this issue Dec 28, 2019
* Update Truth to 0.42

0.42
Made various dependency fixes and upgrades, including fixing #473 and #467. Note that some annotations-only dependencies are now no longer <provided>. See google/guava#2721 for details, but in short, feel free to exclude them if that works for your setup.
Fixed NPE in MapSubject.containsExactly (#468).

0.41
Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. (4a51035)
Introduced the new API for building failure messages in a "key: value" format. See Subject.failWithActual and failWithoutActual, which use the new Fact class. (e06ca85)
Changed the old API's failure messages to automatically add a "name: ..." field if the user called named(). In some cases, this adds a name where it was missing before; in others, it duplicates a name that is already present. The long-term fix for this will be to migrate to the new failure API, which always includes the name once, and possibly also to delete named() in favor of withMessage(). (911c939)
Deprecated failWithRawMessageAndCause. Truth automatically attaches the cause if it's part of the assertion chain. If not, see the deprecation docs for the workaround. (3622e9c)
Deprecated failComparing. Use check("foo").that(actual().foo()).isEqualTo(expectedFoo). (2db2a4f)
Deprecated the remaining legacy fail* methods. (1f9b2d6)
Hid protected method IterableSubject.failWithBadResultsAndSuffix() (5becbfe).
Started throwing ComparisonFailure from MapSubject.containsEntry. (4330ec6)
Started throwing ComparisonFailure from assertThat(singleElementIterable).containsExactly(otherSingleElementIterable). (e44edd1)
Added code to remove Runner and Statement frames from the stack trace. (d2bb074)
Added StringSubject.ignoringCase() (13e8054)
Added ignoringExtraRepeatedFieldElements() to ProtoTruth. (f070204)
Added comparingExpectedFieldsOnly() to ProtoTruth. (08908c1)
Removed deprecated MultimapSubject.containsExactly(Multimap). Use containsExactlyEntriesIn(Multimap). (containsExactly(Object k0, Object v0, Object... rest) continues to exist.) (9c80ad5)
Removed deprecated isPartiallyOrdered() methods. Use isOrdered() (5becbfe).
Started throwing UOE from IterableSubject.isNoneOf() and isNotIn(). (46c8d3d)
Switched to Checker Framework @NullableDecl instead of jsr305 @nullable. Tools that read these annotations may need to be updated to recognize the new annotation. (10ee459)

* Update NulLAway to 0.6.0

* Update ErrorProne to 2.3.2

Highlights:
Opt-in check AndroidJdkLibsChecker enforces which JDK libraries can be used in Android applications, and, with the -XepOpt:Android:Java8Libs flag, can allow select Java 8 library support via https://developer.android.com/studio/write/java8-support. Look out for this in bazel.build after the next release.
Immutable{Annotation,Enum}Checker now requires the Error Prone @immutable annotation, not the JSR-305 @immutable annotation
New Checks:
Javadoc Checkers: InvalidParam, InvalidTag, InvalidThrows, ReturnFromVoid
API Checkers: AndroidJdkLibsChecker, Java7ApiChecker, ApiDiffChecker
AnnotateFormatMethod
AnnotationPosition
ArrayAsKeyOfSetOrMap
AutoValueFinalMethods
BadInstanceof
BigDecimalEquals
ClassNamedLikeTypeParameter
CloseableProvides
ComparingThisWithNull
DeprecatedThreadMethods
EqualsBrokenForNull
EqualsGetClass
EqualsUnsafeCast
EqualsUsingHashCode
EqualsWrongThing
ExpectedExceptionRefactoring
ExtendingJUnitAssert
FloatingPointAssertionWithinEpsilon
ImmutableRefactoring
InconsistentHashCode
InjectOnMemberAndConstructor
LockNotBeforeTry
MathAbsoluteRandom
MathRoundIntLong
MissingTestCall
ModifiedButNotUsed
NoFunctionalReturnType
NullableDereference
ObjectsHashCodePrimitive
ProtoRedundantSet
ProtosAsKeyOfSetOrMap
SubstringOfZero
SwigMemoryLeak
SystemExitOutsideMain
TestExceptionRefactoring
ThreadPriorityCheck
ToStringReturnsNull
TruthAssertExpected
TypeNameShadowing
UndefinedEquals
UnnecessaryParentheses
UnsafeReflectiveConstructionCast
UnusedException
VariableNameSameAsType

* AGP 3.2.1

* Fix misconfigured errorProne javac
@cowwoc
Copy link

cowwoc commented May 23, 2024

If anyone runs into this problem while using Java Modules, see #7233 (comment) for a solution.

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