Closed shevek closed 4 years ago
@graememorgan have you seen anything like this?
Additional annoyance was that `@SuppressWarnings("MixedMutabilityReturnType") did not work around the bug, and we actually had to downgrade errorprone. If we suppress a warning, can we also suppress the checker, and associated costs and bugs?
It's not a real day's coding unless I get an unexpected internal error out of some compiler or other.
I haven't seen anything like this, and I would have expected to while developing it.
Do you have a repro of any sort?
I'm sorry, we're on a proprietary codebase and I have no insight whatsoever into how to construct something for this. I can give you the fragment in question, which uses jgrapht APIs:
public Set<E> getEdges(V sourceVertex, V targetVertex) {
// ...
if (edge == null)
return Collections.emptySet();
else
return new ArrayUnenforcedSet<>(Collections.singleton(edge));
}
Closing since I don't think we can do much more than https://github.com/google/error-prone/commit/97767bbe295dfe3bd5a346ba0b086f043a950259 without a repro.
I got the same error on the latest release.
error-prone version: 2.5.1
BugPattern: MixedMutabilityReturnType
Stack Trace:
java.lang.IllegalArgumentException: Replacement{range=[439..445), replaceWith=ImmutableMap.copyOf(result)} conflicts with existing replacement Replacement{range=[439..445), replaceWith=ImmutableBiMap.copyOf(result)}
at com.google.errorprone.fixes.Replacements.add(Replacements.java:109)
at com.google.errorprone.fixes.SuggestedFix.getReplacements(SuggestedFix.java:92)
at com.google.errorprone.fixes.AppliedFix$Applier.apply(AppliedFix.java:71)
at com.google.errorprone.JavacErrorDescriptionListener.lambda$new$1(JavacErrorDescriptionListener.java:86)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747)
at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
Minimally reproducible with
private BiMap<String, String> triggerMixedMutabilityReturnTypeCrash(Collection<String> input) {
if (input.isEmpty()) {
return ImmutableBiMap.of();
}
HashBiMap<String, String> result = HashBiMap.create();
return result;
}
Description of the problem / feature request:
ErrorProne crashed
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
We don't have anything self-contained, we just can't build our code.
What version of Error Prone are you using?