Partial rollback of unknown commit
PiperOrigin-RevId: 153403092
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
index 60aa028..12e97b8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
@@ -187,7 +187,10 @@
semantics.translate(ruleContext, javaConfig, attributes.getMessages()));
}
- if (attributes.hasSources() || attributes.hasResources()) {
+ // TODO(b/37425618): this should be attributes.hasResources()
+ boolean hasResources =
+ !attributes.getResources().isEmpty() || !attributes.getClassPathResources().isEmpty();
+ if (attributes.hasSources() || hasResources) {
// We only want to add a jar to the classpath of a dependent rule if it has content.
javaArtifactsBuilder.addRuntimeJar(classJar);
}