diff --git a/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java b/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java index 5942f905..70220739 100644 --- a/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java +++ b/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java @@ -291,6 +291,16 @@ public JavaSourceInfo getTestSourceInfo() { "Test source info not computed. Did you call analyzeProjectRecommendations?"); } + private Entry newLabelEntry(String relativeOrAbsoluteLabel) { + // handle absolute labels first + var mayBeAbsoluteLaybel = Label.createIfValid(relativeOrAbsoluteLabel); + if (mayBeAbsoluteLaybel != null) { + return new LabelEntry(new BazelLabel(mayBeAbsoluteLaybel.toString())); + } + // treat as relative label + return new LabelEntry(bazelPackage.getBazelTarget(relativeOrAbsoluteLabel).getLabel()); + } + /** * Checks whether the specified string is a label pointing into this package of this project and make it relative in * this case. @@ -393,13 +403,7 @@ private Entry toJavaSourceFileOrLabelEntry(String srcFileOrLabel) throws CoreExc // treat as label if it looks like one if (shouldTreatAsLabel(srcFileOrLabel)) { - // handle absolute labels first - var mayBeAbsoluteLaybel = Label.createIfValid(srcFileOrLabel); - if (mayBeAbsoluteLaybel != null) { - return new LabelEntry(new BazelLabel(mayBeAbsoluteLaybel.toString())); - } - // treat as relative label - return new LabelEntry(bazelPackage.getBazelTarget(srcFileOrLabel).getLabel()); + return newLabelEntry(srcFileOrLabel); } // treat as file @@ -411,7 +415,7 @@ private Entry toResourceFileOrLabelEntry(String srcFileOrLabel, String resourceS // treat as label if it looks like one if (shouldTreatAsLabel(srcFileOrLabel)) { - return new LabelEntry(bazelPackage.getBazelTarget(srcFileOrLabel).getLabel()); + return newLabelEntry(srcFileOrLabel); } // treat as file