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

Moe Sync #1547

Merged
merged 5 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public class Description {
new Description(
null, "<no match>", "<no match>", "<no match>", ImmutableList.<Fix>of(), SUGGESTION);

private static final String UNDEFINED_CHECK_NAME = "Undefined";

/** The position of the match. */
public final DiagnosticPosition position;

Expand Down Expand Up @@ -94,24 +92,11 @@ public String getMessageWithoutCheckName() {
: String.format("%s", rawMessage);
}

/** TODO(cushon): Remove this constructor and ensure that there's always a check name. */
@Deprecated
public Description(
Tree node, String message, Fix suggestedFix, BugPattern.SeverityLevel severity) {
this(
(DiagnosticPosition) node,
UNDEFINED_CHECK_NAME,
message,
message,
ImmutableList.of(suggestedFix),
severity);
}

private Description(
DiagnosticPosition position,
String checkName,
String rawMessage,
String linkUrl,
@Nullable String linkUrl,
List<Fix> fixes,
SeverityLevel severity) {
this.position = position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,9 @@ public static MethodSymbol resolveExistingMethod(
}

/**
* Returns the value of the {@code @Generated} annotation on encosing classes, if present.
* Returns the value of the {@code @Generated} annotation on enclosing classes, if present.
*
* <p>Although {@code @Generated} can be applied to non-class progam elements, there are no known
* <p>Although {@code @Generated} can be applied to non-class program elements, there are no known
* cases of that happening, so it isn't supported here.
*/
public static ImmutableSet<String> getGeneratedBy(VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ private enum JumpType {
}

public FinallyJumpMatcher(JCContinue jcContinue) {
this.label = jcContinue.label;
this.label = jcContinue.getLabel();
this.jumpType = JumpType.CONTINUE;
}

public FinallyJumpMatcher(JCBreak jcBreak) {
this.label = jcBreak.label;
this.label = jcBreak.getLabel();
this.jumpType = JumpType.BREAK;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@
import com.google.errorprone.bugpatterns.nullness.FieldMissingNullable;
import com.google.errorprone.bugpatterns.nullness.NullableDereference;
import com.google.errorprone.bugpatterns.nullness.ParameterNotNullable;
import com.google.errorprone.bugpatterns.nullness.ReturnMissingNullable;
import com.google.errorprone.bugpatterns.nullness.UnnecessaryCheckNotNull;
import com.google.errorprone.bugpatterns.overloading.InconsistentOverloads;
import com.google.errorprone.bugpatterns.threadsafety.DoubleCheckedLocking;
Expand Down Expand Up @@ -639,6 +638,7 @@ public static ScannerSupplier errorChecks() {
/** A list of all checks with severity WARNING that are on by default. */
public static final ImmutableSet<BugCheckerInfo> ENABLED_WARNINGS =
getSuppliers(
AlmostJavadoc.class,
AmbiguousMethodReference.class,
AnnotateFormatMethod.class,
ArrayAsKeyOfSetOrMap.class,
Expand Down Expand Up @@ -676,10 +676,12 @@ public static ScannerSupplier errorChecks() {
DefaultCharset.class,
DoubleBraceInitialization.class,
DoubleCheckedLocking.class,
EmptyBlockTag.class,
EqualsGetClass.class,
EqualsIncompatibleType.class,
EqualsUnsafeCast.class,
EqualsUsingHashCode.class,
EscapedEntity.class,
ExtendingJUnitAssert.class,
FallThrough.class,
Finally.class,
Expand All @@ -696,10 +698,16 @@ public static ScannerSupplier errorChecks() {
InconsistentCapitalization.class,
InconsistentHashCode.class,
IncrementInForLoopAndHeader.class,
InheritDoc.class,
InjectOnConstructorOfAbstractClass.class,
InputStreamSlowMultibyteRead.class,
InstanceOfAndCastMatchWrongType.class,
IntLongMath.class,
InvalidBlockTag.class,
InvalidInlineTag.class,
InvalidLink.class,
InvalidParam.class,
InvalidThrows.class,
IterableAndIterator.class,
JavaDurationGetSecondsGetNano.class,
JavaDurationWithNanos.class,
Expand Down Expand Up @@ -730,6 +738,7 @@ public static ScannerSupplier errorChecks() {
MissingCasesInEnumSwitch.class,
MissingFail.class,
MissingOverride.class,
MissingSummary.class,
MixedDescriptors.class,
MixedMutabilityReturnType.class,
ModifiedButNotUsed.class,
Expand Down Expand Up @@ -769,6 +778,7 @@ public static ScannerSupplier errorChecks() {
ReachabilityFenceUsage.class,
ReferenceEquality.class,
RequiredModifiersChecker.class,
ReturnFromVoid.class,
RxReturnValueIgnored.class,
SameNameButDifferent.class,
ShortCircuitBoolean.class,
Expand All @@ -793,6 +803,7 @@ public static ScannerSupplier errorChecks() {
TypeParameterShadowing.class,
TypeParameterUnusedInFormals.class,
UndefinedEquals.class,
UnescapedEntity.class,
UnnecessaryAnonymousClass.class,
UnnecessaryLambda.class,
UnnecessaryMethodInvocationMatcher.class,
Expand All @@ -813,7 +824,6 @@ public static ScannerSupplier errorChecks() {
/** A list of all checks that are off by default. */
public static final ImmutableSet<BugCheckerInfo> DISABLED_CHECKS =
getSuppliers(
AlmostJavadoc.class,
AndroidJdkLibsChecker.class,
AnnotationPosition.class,
AssertFalse.class,
Expand All @@ -834,12 +844,10 @@ public static ScannerSupplier errorChecks() {
DepAnn.class,
DescribeMatch.class,
DivZero.class,
EmptyBlockTag.class,
EmptyIfStatement.class,
EmptySetMultibindingContributions.class,
EmptyTopLevelDeclaration.class,
EqualsBrokenForNull.class,
EscapedEntity.class,
ExpectedExceptionChecker.class,
ExpectedExceptionRefactoring.class,
FieldCanBeFinal.class,
Expand All @@ -852,17 +860,11 @@ public static ScannerSupplier errorChecks() {
ImmutableRefactoring.class,
ImplementAssertionWithChaining.class,
InconsistentOverloads.class,
InheritDoc.class,
InjectedConstructorAnnotations.class,
InsecureCipherMode.class,
InterfaceWithOnlyStatics.class,
InterruptedExceptionSwallowed.class,
InvalidBlockTag.class,
InvalidInlineTag.class,
InvalidLink.class,
InvalidParam.class,
InvalidTargetingOnScopingAnnotation.class,
InvalidThrows.class,
IterablePathParameter.class,
JMockTestWithoutRunWithOrRuleAnnotation.class,
Java7ApiChecker.class,
Expand All @@ -872,7 +874,6 @@ public static ScannerSupplier errorChecks() {
LongLiteralLowerCaseSuffix.class,
MethodCanBeStatic.class,
MissingDefault.class,
MissingSummary.class,
MixedArrayDimensions.class,
MoreThanOneQualifier.class,
MultiVariableDeclaration.class,
Expand All @@ -898,8 +899,6 @@ public static ScannerSupplier errorChecks() {
RedundantOverride.class,
RedundantThrows.class,
RemoveUnusedImports.class,
ReturnFromVoid.class,
ReturnMissingNullable.class,
ScopeAnnotationOnInterfaceOrAbstractClass.class,
ScopeOnModule.class,
ScopeOrQualifierAnnotationRetention.class,
Expand All @@ -917,7 +916,6 @@ public static ScannerSupplier errorChecks() {
TransientMisuse.class,
TryFailRefactoring.class,
TypeParameterNaming.class,
UnescapedEntity.class,
UngroupedOverloads.class,
UnlockMethodChecker.class,
UnnecessaryBoxedAssignment.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,33 +220,4 @@ public void erroneousFixTag() {
"}")
.doTest();
}

@Test
public void nestedNewClass() {
testHelper
.addSourceLines(
"ExampleChecker.java",
"import com.google.errorprone.BugPattern;",
"import com.google.errorprone.BugPattern.SeverityLevel;",
"import com.google.errorprone.VisitorState;",
"import com.google.errorprone.bugpatterns.BugChecker;",
"import com.google.errorprone.bugpatterns.BugChecker.ClassTreeMatcher;",
"import com.google.errorprone.fixes.SuggestedFix;",
"import com.google.errorprone.matchers.Description;",
"import com.sun.source.tree.ClassTree;",
"// BUG: Diagnostic contains: ProvidesFix",
"@BugPattern(name = \"Example\", summary = \"\", severity = SeverityLevel.ERROR)",
"public class ExampleChecker extends BugChecker implements ClassTreeMatcher {",
" @Override public Description matchClass(ClassTree tree, VisitorState s) {",
" Helper wrapper = new Helper(new Description(",
" tree, \"\", SuggestedFix.builder().build(), SeverityLevel.ERROR));",
" return wrapper.d;",
" }",
" static class Helper {",
" public Description d;",
" public Helper(Description d) { this.d = d; }",
" }",
"}")
.doTest();
}
}
Loading