JetBrains/intellij-community · warning · ConfigurationException
type.migration.dialog.message.void.not.applicable
Error message
type.migration.dialog.message.void.not.applicable
What it means
Thrown by TypeMigrationDialog.canRun() (TypeMigrationDialog.java:222) when isIllegalVoidMigration() is true — the user set 'void' as the migration target type. void is not a data type: fields, parameters, and variables cannot be void, so Type Migration refuses the run before touching any usage.
Source
Thrown at java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java:222
init();
validateButtons();
}
@Override
protected void canRun() throws ConfigurationException {
super.canRun();
if (isIllegalVarargMigration()) {
throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.vararg.type.not.applicable"));
}
if (isIllegalDisjunctionTypeMigration()) {
throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.disjunction.type.not.applicable"));
}
if (isIllegalTypeMigration(getMigrationType())) {
throw new ConfigurationException(
JavaBundle.message("type.migration.dialog.message.invalid.type", StringUtil.escapeXmlEntities(myTypeCodeFragment.getText())));
}
if (isIllegalVoidMigration()) {
throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.void.not.applicable"));
}
if (getMigrationType().equals(getRootType())) {
throw new ConfigurationException(null);
}
}
@Override
public JComponent getPreferredFocusedComponent() {
return myToTypeEditor;
}
@Override
protected void appendMigrationTypeEditor(JPanel panel, GridBagConstraints gc) {
final PsiType type = getRootType();
final String typeText = type != null ? type.getPresentableText() : "<unknown>";
panel.add(new JLabel(getTypeMigrationLabelText(myRoots[0], typeText)), gc);
panel.add(myToTypeEditor, gc);
}View on GitHub (pinned to be881553f2)
Solutions
- Choose a real reference type as the migration target (e.g. java.lang.Void boxed only if genuinely intended and accepted).
- To change a method's return type, use Change Signature or direct editing instead of Type Migration.
- Re-open the dialog and clear the To-type field, then pick from completion.
Example fix
// before // migrate root 'count' (int field) to: void -> blocked // after // migrate root 'count' to: java.lang.Integer -> proceeds
Defensive patterns
Strategy: validation
Validate before calling
String typeText = myTypeCodeFragment.getText().trim();
if (typeText.equals("void") || typeText.equals("java.lang.void")) {
// block: void cannot be a migration target; ask for a reference type
} Prevention
- Use Change Signature (not Type Migration) when the goal is changing a method's return type.
- Filter 'void' out of completion in custom type-migration UIs.
When it happens
Trigger: Refactoring | Type Migration on any field/local/parameter and typing 'void' (or 'java.lang.Void' resolving to a void-like classification in the editor) into the 'migrate to' field.
Common situations: Exploratory clicking in the dialog; intending to migrate a method's return type and selecting the method element whose migration target was set to void; autocomplete inserting 'Void' where the dialog's classifier treats it as void in a value position.
Related errors
- type.migration.dialog.message.invalid.type
- Invalid package name: {0}
- Nothing found to extract
- ''{0}'' is invalid extracted class name
- Extracted class should have unique name. Name ''{0}'' is alr
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/f8a86830e1c78c12.
Report an issue: GitHub.