Additional information to catch EA-75872

This commit is contained in:
Mikhail Glukhikh
2015-12-15 12:51:57 +03:00
parent 16f482f723
commit 91621704a2
6 changed files with 21 additions and 6 deletions
@@ -55,7 +55,7 @@ public class DefaultErrorMessages {
DiagnosticFactoryToRendererMap getMap();
}
private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap();
private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("Default");
private static final MappedExtensionProvider<Extension, List<DiagnosticFactoryToRendererMap>> RENDERER_MAPS = MappedExtensionProvider.create(
Extension.EP_NAME,
new Function1<List<? extends Extension>, List<DiagnosticFactoryToRendererMap>>() {
@@ -79,7 +79,8 @@ public class DefaultErrorMessages {
return renderer.render(diagnostic);
}
}
throw new IllegalArgumentException("Don't know how to render diagnostic of type " + diagnostic.getFactory().getName());
throw new IllegalArgumentException("Don't know how to render diagnostic of type " + diagnostic.getFactory().getName() +
" with the following renderer maps: " + RENDERER_MAPS.get());
}
@TestOnly
@@ -30,6 +30,20 @@ public final class DiagnosticFactoryToRendererMap {
private final Map<DiagnosticFactory<?>, DiagnosticRenderer<?>> map = new HashMap<DiagnosticFactory<?>, DiagnosticRenderer<?>>();
private boolean immutable = false;
// TO catch EA-75872
private final String name;
public DiagnosticFactoryToRendererMap(String name) {
this.name = name;
}
public DiagnosticFactoryToRendererMap() {
this("<unnamed>");
}
@Override
public String toString() {
return "DiagnosticFactory#" + name;
}
//
private void checkMutability() {
if (immutable) {
throw new IllegalStateException("factory to renderer map is already immutable");