Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 380816890
  • Loading branch information
Googler authored and copybara-github committed Jun 22, 2021
1 parent 1d82741 commit 2640745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/google/devtools/build/lib/cmdline/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,15 @@ public int hashCode() {
return hashCode(name, packageIdentifier);
}

/**
* Specialization of {@link Arrays#hashCode()} that does not require constructing a 2-element
* array.
*/
private static final int hashCode(Object obj1, Object obj2) {
int result = 31 + (obj1 == null ? 0 : obj1.hashCode());
return 31 * result + (obj2 == null ? 0 : obj2.hashCode());
}

/** Two labels are equal iff both their name and their package name are equal. */
@Override
public boolean equals(Object other) {
Expand Down Expand Up @@ -696,13 +705,4 @@ public void str(Printer printer) {
public String expandToCommandLine() {
return getCanonicalForm();
}

/**
* Specialization of {@link Arrays#hashCode()} that does not require constructing a 2-element
* array.
*/
private static final int hashCode(Object obj1, Object obj2) {
int result = 31 + (obj1 == null ? 0 : obj1.hashCode());
return 31 * result + (obj2 == null ? 0 : obj2.hashCode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ public static PackageIdentifier createInMainRepo(PathFragment name) {
*
* In this case, this method returns a package identifier for foo/bar, even though that is not a
* package. Callers need to look up the actual package if needed.
*
* @throws LabelSyntaxException if the exec path seems to be for an external repository that does
* not have a valid repository name (see {@link RepositoryName#create})
*/
public static PackageIdentifier discoverFromExecPath(
PathFragment execPath, boolean forFiles, boolean siblingRepositoryLayout) {
Expand Down

0 comments on commit 2640745

Please sign in to comment.