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

Fix typos #4568

Closed
wants to merge 11 commits into from
Closed
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 @@ -285,7 +285,7 @@ private boolean isSuppressed(SuppressWarnings suppression) {
public boolean isSuppressed(Tree tree, VisitorState state) {
Symbol sym = getDeclaredSymbol(tree);
/*
* TOOD(cpovirk): At least for @SuppressWarnings, should our suppression checks look for
* TODO(cpovirk): At least for @SuppressWarnings, should our suppression checks look for
* annotations only on the kinds of trees that are covered by SuppressibleTreePathScanner? Or,
* now that @SuppressWarnings has been changed to be applicable to all declaration locations,
* should we generalize SuppressibleTreePathScanner to look on all those locations?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static Optional<Nullness> fromAnnotationsOn(@Nullable TypeMirror type) {
// Note this may be a good candidate for caching
public static Optional<Nullness> fromDefaultAnnotations(@Nullable Element sym) {
while (sym != null) {
// Just look through declaration annotations here for simplicitly; default annotations aren't
// Just look through declaration annotations here for simplicity; default annotations aren't
// type annotations. For now we're just using a hard-coded simple name.
// TODO(b/121272440): Look for existing default annotations
if (sym.getAnnotationMirrors().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,14 +1170,14 @@ public boolean hasNonNullConstantValue() {
.build();

/**
* Maps from non-null test methods to indices of arguments that are comapred against null. These
* Maps from non-null test methods to indices of arguments that are compared against null. These
* methods must guarantee non-nullness if {@code true} <b>and nullness if {@code false}</b>.
*/
private static final ImmutableSetMultimap<MemberName, Integer> NONNULL_IFF_TRUE_PARAMETERS =
ImmutableSetMultimap.of(member(Objects.class, "nonNull"), 0);

/**
* Maps from null test methods to indices of arguments that are comapred against null. These
* Maps from null test methods to indices of arguments that are compared against null. These
* methods must guarantee nullness if {@code true} <b>and non-nullness if {@code false}</b>.
*/
private static final ImmutableSetMultimap<MemberName, Integer> NULL_IFF_TRUE_PARAMETERS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public Description matchMethod(MethodTree tree, VisitorState state) {
}
}

// if a method name contais a banned substring, exit
// if a method name contains a banned substring, exit
for (String methodSubstring : METHOD_SUBSTRINGS_TO_IGNORE) {
if (methodName.contains(methodSubstring)) {
return NO_MATCH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Costs {
/** Formal parameters for the method being called. */
private final ImmutableList<Parameter> formals;

/** Actual parameters (argments) for the method call. */
/** Actual parameters (arguments) for the method call. */
private final ImmutableList<Parameter> actuals;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected Void defaultAction(Tree tree, Void unused) {

/**
* Return an instance of the given type if it receives special handling by {@code String.format}.
* For example, an intance of {@link Integer} will be returned for an input of type {@code int} or
* For example, an instance of {@link Integer} will be returned for an input of type {@code int} or
* {@link Integer}.
*/
private static @Nullable Object getInstance(Tree tree, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.List;

/**
* Warns against suspect looking calls to {@link java.util.Date} APIs. Noteably, {@code Date} uses:
* Warns against suspect looking calls to {@link java.util.Date} APIs. Notably, {@code Date} uses:
*
* <ul>
* <li>1900-based years (negative values permitted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*/
@BugPattern(
summary =
"localDateTime.getNano() only accesss the nanos-of-second field."
"localDateTime.getNano() only access the nanos-of-second field."
+ " It's rare to only use getNano() without a nearby getSecond() call.",
severity = WARNING)
public final class JavaLocalDateTimeGetNano extends BugChecker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void foo() {}

/**
* Class with a method foo() annotated with @com.google.inject.Inject that overrides a method
* annoted with @javax.inject.Inject.
* annotated with @javax.inject.Inject.
*/
public class TestClass4 extends TestClass2 {
@com.google.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ public class MissingRuntimeRetentionNegativeCases {
@Retention(RUNTIME)
public @interface TestAnnotation2 {}

/** A qualifer(@Qualifier) annotation with runtime retention. */
/** A qualifier (@Qualifier) annotation with runtime retention. */
@Qualifier
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface TestAnnotation3 {}

/** A qualifer(@BindingAnnotation) annotation with runtime retention. */
/** A qualifier (@BindingAnnotation) annotation with runtime retention. */
@BindingAnnotation
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface TestAnnotation4 {}

/** A non-qualifer, non-scoping annotation without runtime retention. */
/** A non-qualifier, non-scoping annotation without runtime retention. */
@Retention(SOURCE)
public @interface TestAnnotation5 {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ public class MissingRuntimeRetentionPositiveCases {
@Retention(SOURCE)
public @interface TestAnnotation2 {}

/** A qualifer(@Qualifier) annotation with SOURCE retention. */
/** A qualifier (@Qualifier) annotation with SOURCE retention. */
@Qualifier
@Target({TYPE, METHOD})
// BUG: Diagnostic contains: @Retention(RUNTIME)
@Retention(SOURCE)
public @interface TestAnnotation3 {}

/** A qualifer(@BindingAnnotation) annotation with SOURCE retention. */
/** A qualifier (@BindingAnnotation) annotation with SOURCE retention. */
@BindingAnnotation
@Target({TYPE, METHOD})
// BUG: Diagnostic contains: @Retention(RUNTIME)
@Retention(SOURCE)
public @interface TestAnnotation4 {}

/** A qualifer annotation with default retention. */
/** A qualifier annotation with default retention. */
@BindingAnnotation
@Target({TYPE, METHOD})
// BUG: Diagnostic contains: @Retention(RUNTIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public void arrays() {
}

/**
* Regresion test demonstrating that generic array creation is a compiler error. If it wasn't,
* Regression test demonstrating that generic array creation is a compiler error. If it wasn't,
* we'd want to check element types.
*/
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void nestedTryInFinally2() throws Exception {
// but we don't do exception analysis and have no way of knowing that.
// Xlint:finally doesn't handle this either, since it only reports
// situations where the end of a finally block is unreachable as
// definied by JLS 14.21.
// defined by JLS 14.21.
throw new IOException();
} catch (Exception e) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private List<List<String>> parametersForParamsInIterableOfIterables() {

@Test
@Parameters(
"please\\, escape commas if you use it here and don't want your parameters to be splitted")
"please\\, escape commas if you use it here and don't want your parameters to be split")
public void commasInParametersUsage(String phrase) {}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void checkedCastForIntParameter() {

public void checkedCastMultipleArgs() {
long x = 1;
// The method expects an int for the first parameter and a long for the second paremeter.
// The method expects an int for the first parameter and a long for the second parameter.
acceptsMultipleParams(Ints.checkedCast(x), x);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void longObjectToIntForLongParam() {

public void convertMultipleArgs() {
long x = 1;
// The method expects an int for the first parameter and a long for the second paremeter.
// The method expects an int for the first parameter and a long for the second parameter.
// BUG: Diagnostic contains: UnnecessaryLongToIntConversion
acceptsMultipleParams(Ints.checkedCast(x), Ints.checkedCast(x));
}
Expand Down
2 changes: 1 addition & 1 deletion docs/bugpattern/OptionalNotPresent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Calling `get()` on an `Optional` that is not present will result in a
`NoSuchElementException`.

This check detects cases where `get()` is called whent the optional is
This check detects cases where `get()` is called when the optional is
definitely not present, e.g.:

```java
Expand Down