It would be better to assert type of diagnostic.getFactory() at the begining, and cast diagnostic to DiagnosticWithParameters1<JetElement, Collection<ClassDescriptor>>. See AddStarProjectionsFix. Don't forget to supress unchecked warning in this case.