diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java index c4e7e476282c88..12e0c1ebc9f2cc 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java @@ -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) { @@ -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()); - } } diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java index a772b47df366f1..ba8a8f62815868 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java @@ -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) {