Skip to content

Commit 23c2a28

Browse files
committed
Fix condition check for label treatment
1 parent a3858bb commit 23c2a28

File tree

1 file changed

+6
-4
lines changed
  • bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects

1 file changed

+6
-4
lines changed

bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,19 @@ private boolean shouldTreatAsLabel(String srcFileOrLabel) {
331331
* - starts with ':' (relative label) OR
332332
* - starts with '@' or '//' OR
333333
* - it does validate ok as label
334-
* - AND it does not look like a path
335-
* - AND no such a file exists
334+
* OTHERWISE it is treated as file if:
335+
* - it does look like a path OR
336+
* - a file exists
336337
*/
337338

338339
if (srcFileOrLabel.startsWith(BazelLabel.BAZEL_COLON)
339340
|| srcFileOrLabel.startsWith(BazelLabel.BAZEL_ROOT_SLASHES)
340-
|| srcFileOrLabel.startsWith(BazelLabel.BAZEL_EXTERNALREPO_AT)) {
341+
|| srcFileOrLabel.startsWith(BazelLabel.BAZEL_EXTERNALREPO_AT)
342+
|| (Label.validate(srcFileOrLabel) == null)) {
341343
return true;
342344
}
343345

344-
return (Label.validate(srcFileOrLabel) == null) && (srcFileOrLabel.indexOf('/') == -1)
346+
return (srcFileOrLabel.indexOf('/') == -1)
345347
&& !isRegularFile(bazelPackage.getLocation().append(new Path(srcFileOrLabel)).toPath());
346348
}
347349

0 commit comments

Comments
 (0)