diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
7 files changed, 18 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index 79260c980f..0e552a6d96 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -13,6 +13,8 @@ // limitations under the License. package com.google.devtools.build.lib.rules.android; +import static com.google.common.base.Strings.isNullOrEmpty; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Optional; @@ -664,7 +666,7 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { private static String getExpandedMakeVarsForAttr(RuleContext context, String attr) { final String value = context.attributes().get(attr, Type.STRING); - if (value == null || value.isEmpty()) { + if (isNullOrEmpty(value)) { return null; } return context.expandMakeVariables(attr, value); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProvider.java index e3f8f23bd0..520e4c9420 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProvider.java @@ -184,7 +184,7 @@ public final class AndroidResourcesProvider implements TransitiveInfoProvider { @Override public int hashCode() { - return Objects.hash(label); + return Objects.hashCode(label); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java index 896a73d6e7..c97d5b6fd1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java @@ -783,7 +783,7 @@ public final class CppLinkAction extends AbstractAction { } else { // TODO(bazel-team): once the LLVM compiler patches have been finalized, this should // be converted to a crosstool feature configuration instead. - List<String> opts = new ArrayList<String>(linkopts); + List<String> opts = new ArrayList<>(linkopts); opts.add("-flto"); opts.add( "-Wl,-plugin-opt,thin-lto=" diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java index 8f6ebcb283..e89e3a119d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java @@ -874,7 +874,7 @@ public final class LinkCommandLine extends CommandLine { if (ltoMap != null) { Preconditions.checkState( - ltoMap.size() == 0, "Still have LTO objects left: " + ltoMap + ", command-line: " + argv); + ltoMap.size() == 0, "Still have LTO objects left: %s, command-line: %s", ltoMap, argv); } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java index 0285031c7c..c894f2b571 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java @@ -640,10 +640,11 @@ public class JavaCompileAction extends AbstractAction { : "--indirect_dependency"); builder.add(jar.getExecPathString()); Label label = getTargetName(jar); - builder.add(label.getPackageIdentifier().getRepository().isDefault() - ? label.toString() - // Escape '@' prefix for .params file. - : "@" + label.toString()); + builder.add( + label.getPackageIdentifier().getRepository().isDefault() + ? label.toString() + // Escape '@' prefix for .params file. + : "@" + label); } return builder.build(); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/TargetDeviceFamily.java b/src/main/java/com/google/devtools/build/lib/rules/objc/TargetDeviceFamily.java index 2233f965a3..49cac13037 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/TargetDeviceFamily.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/TargetDeviceFamily.java @@ -103,7 +103,7 @@ public enum TargetDeviceFamily { */ public static Set<TargetDeviceFamily> fromBuildSetting(String targetedDevice) { ImmutableSet.Builder<TargetDeviceFamily> result = ImmutableSet.builder(); - for (String numericSetting : Splitter.on(",").split(targetedDevice)) { + for (String numericSetting : Splitter.on(',').split(targetedDevice)) { numericSetting = numericSetting.trim(); switch (numericSetting) { case "1": diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java index fe9c2b6257..23f19a9b34 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java @@ -270,11 +270,12 @@ public final class PyCommon { + "' need to be converted to Python 2 (not yet implemented)"); } } - if (targetVersion == PythonVersion.PY3 || targetVersion == PythonVersion.PY2AND3) { - if (sourceVersion == PythonVersion.PY2ONLY) { - ruleContext.ruleError("Rule '" + source - + "' can only be used with Python 2, and cannot be converted to Python 3"); - } + if ((targetVersion == PythonVersion.PY3 || targetVersion == PythonVersion.PY2AND3) + && sourceVersion == PythonVersion.PY2ONLY) { + ruleContext.ruleError( + "Rule '" + + source + + "' can only be used with Python 2, and cannot be converted to Python 3"); } } |