[java] catch proper exception from JavaParserDefinition EA-252075

GitOrigin-RevId: caa7054f10819cdd0f0782173a086069072718bc
This commit is contained in:
Roman Ivanov
2021-12-29 12:08:28 +01:00
committed by intellij-monorepo-bot
parent 3d6d55204b
commit 548ba0899a
2 changed files with 3 additions and 1 deletions

View File

@@ -75,6 +75,8 @@ public class JavaParserDefinition implements ParserDefinition {
return ((JavaStubElementType<?, ?>)type).createPsi(node);
}
// This exception is caught in com.intellij.psi.impl.source.tree.injected.InjectionRegistrarImpl.findNewInjectionHost
// Please, check that code if you make any changes here
throw new IllegalArgumentException("Not a Java node: " + node + " (" + type + ", " + type.getLanguage() + ")");
}

View File

@@ -758,7 +758,7 @@ class InjectionRegistrarImpl implements MultiHostRegistrar {
}
// JavaParserDefinition.create() throws this.
// DO not over-generalize this exception type to avoid swallowing meaningful exceptions
catch (IllegalStateException e) {
catch (IllegalArgumentException e) {
return null;
}
}