-
Notifications
You must be signed in to change notification settings - Fork 134
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
Turn off UnnecessaryLambda, ThrowSpecificity on Java 13 #1095
Conversation
Generate changelog in
|
@@ -211,6 +211,8 @@ private static void configureErrorProneOptions( | |||
// https://github.com/google/error-prone/issues/1106 | |||
errorProneOptions.check("TypeParameterUnusedInFormals", CheckSeverity.OFF); | |||
errorProneOptions.check("PreferCollectionConstructors", CheckSeverity.OFF); | |||
errorProneOptions.check("UnnecessaryLambda", CheckSeverity.OFF); | |||
errorProneOptions.check("ThrowSpecificity", CheckSeverity.OFF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the two where we've seen failures on java13 projects so far, but all checks using SuggestedFixes.qualifyType and SuggestedFixes.prettyType are impacted:
[gradle-baseline]$ git grep "SuggestedFixes\..*Type"
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/AssertjPrimitiveComparison.java: String cast = '(' + SuggestedFixes.prettyType(state, null, targetType) + ") ";
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/CatchSpecificity.java: .map(type -> SuggestedFixes.prettyType(state, fix, type))
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/LambdaMethodReference.java: return toMethodReference(SuggestedFixes.qualifyType(state, builder, symbol))
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/MoreASTHelpers.java: .sorted(Comparator.comparing(type -> SuggestedFixes.prettyType(state, null, type)))
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferAssertj.java: + SuggestedFixes.qualifyType(state, fix, "org.assertj.core.api.HamcrestCondition")
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferAssertj.java: + SuggestedFixes.qualifyType(state, fix, "org.assertj.core.api.HamcrestCondition")
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferAssertj.java: String qualifiedMap = SuggestedFixes.prettyType(
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferAssertj.java: return SuggestedFixes.qualifyType(state, fix, "org.assertj.core.api.Assertions.assertThat");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferBuiltInConcurrentKeySet.java: String qualifiedType = SuggestedFixes.qualifyType(state, fix, "java.util.concurrent.ConcurrentHashMap");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCollectionConstructors.java: String collectionType = SuggestedFixes.qualifyType(state, fixBuilder, collectionClass.getName());
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCollectionTransform.java: qualifiedType = SuggestedFixes.qualifyType(state, fix, "com.google.common.collect.Lists");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCollectionTransform.java: qualifiedType = SuggestedFixes.qualifyType(state, fix, "com.google.common.collect.Collections2");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferListsPartition.java: String qualifiedType = SuggestedFixes.qualifyType(state, fix, "com.google.common.collect.Lists");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferSafeLoggingPreconditions.java: String logSafeQualifiedClassName = SuggestedFixes.qualifyType(state, fix, "com.palantir.logsafe.Preconditions");
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ReadReturnValueIgnored.java: String qualifiedReference = SuggestedFixes.qualifyType(state, fix, fullyQualifiedReplacement);
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/StreamOfEmpty.java: .addFix(MoreSuggestedFixes.renameInvocationRetainingTypeArguments(tree, "empty", state))
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/StrictCollectionIncompatibleType.java: return SuggestedFixes.prettyType(null, null, type);
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ThrowError.java: String qualifiedName = SuggestedFixes.qualifyType(state, fix, IllegalStateException.class.getName());
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ThrowError.java: String qualifiedName = SuggestedFixes.qualifyType(state, fix,
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ThrowSpecificity.java: .map(checkedException -> SuggestedFixes.prettyType(state, fix, checkedException))
Should we disable all these checks on java13? We should probably migrate our calls to our MoreSuggestedFixes
utility with a fallback for java13 which simply adds an import and returns the class name. It would be nice to get tests running on java13 in this repo so we ca be more confident moving forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that seems much more reasonable - too much late night hacking for Dan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here: #1110
I think we still may want to disable UnnecessaryLambda, UnnecessaryAbstractClass, etc on jdk13 because we can't modify upstream code.
ping? This is blocking latest baseline on java 13 |
This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days. |
Before this PR
A few early adopters internally are building/running with Java13, but the recent error-prone 2.3.4 upgrade seems to have introduced a couple of blockers, seemingly with a similar root cause:
After this PR
==COMMIT_MSG==
When building with Java13, two more error-prone checks (
UnnecessaryLambda
andThrowSpecificity
) are turned off to avoid NoSuchMethodErrors in the compiler. They still run if your project builds on Java8 or 11.==COMMIT_MSG==
Possible downsides?