Skip to content

Commit dbfc838

Browse files
committed
Log warning and continue on java hint failure
the other hints should have a chance to run too
1 parent 18004f9 commit dbfc838

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

java/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintDescription.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public record HintDescription(
3737

3838
@Override
3939
public String toString() {
40-
return "[HintDescription:" + trigger + "]";
40+
return "[HintDescription:" + metadata + "]";
4141
}
4242

4343
public AdditionalQueryConstraints getAdditionalConstraints() {

java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsInvoker.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,17 @@ private void runAndAdd(TreePath path, List<HintDescription> rules, Map<HintDescr
592592
}
593593
}
594594

595-
HintContext c = SPIAccessor.getINSTANCE().createHintContext(info, settings, hm, path, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap(), Collections.<String, TypeMirror>emptyMap(), new ArrayList<>(), bulkMode, cancel, caret);
596-
Collection<? extends ErrorDescription> errors = runHint(hd, c);
597-
595+
// TODO: keep emptyMap() for now since spi.java.hints.MatcherUtilities mutates the context if fillInVariablesHack=true.
596+
// putAll(empty) works with emptyMap() but Map.of() will throw
597+
HintContext c = SPIAccessor.getINSTANCE().createHintContext(
598+
info, settings, hm, path, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), new ArrayList<>(), bulkMode, cancel, caret
599+
);
600+
Collection<? extends ErrorDescription> errors = null;
601+
try {
602+
errors = runHint(hd, c);
603+
} catch (Exception ex) {
604+
LOG.log(Level.WARNING, hd + " failed", ex);
605+
}
598606
if (errors != null) {
599607
merge(d, hd, errors);
600608
}

0 commit comments

Comments
 (0)