{"record":{"id":"f8a86830e1c78c12","repo":"JetBrains/intellij-community","slug":"type-migration-dialog-message-void-not-applicable","errorCode":null,"errorMessage":"type.migration.dialog.message.void.not.applicable","messagePattern":"type\\.migration\\.dialog\\.message\\.void\\.not\\.applicable","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"warning","filePath":"java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java","lineNumber":222,"sourceCode":"      init();\n      validateButtons();\n    }\n\n    @Override\n    protected void canRun() throws ConfigurationException {\n      super.canRun();\n      if (isIllegalVarargMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.vararg.type.not.applicable\"));\n      }\n      if (isIllegalDisjunctionTypeMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.disjunction.type.not.applicable\"));\n      }\n      if (isIllegalTypeMigration(getMigrationType())) {\n        throw new ConfigurationException(\n          JavaBundle.message(\"type.migration.dialog.message.invalid.type\", StringUtil.escapeXmlEntities(myTypeCodeFragment.getText())));\n      }\n      if (isIllegalVoidMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.void.not.applicable\"));\n      }\n      if (getMigrationType().equals(getRootType())) {\n        throw new ConfigurationException(null);\n      }\n    }\n\n    @Override\n    public JComponent getPreferredFocusedComponent() {\n      return myToTypeEditor;\n    }\n\n    @Override\n    protected void appendMigrationTypeEditor(JPanel panel, GridBagConstraints gc) {\n      final PsiType type = getRootType();\n      final String typeText = type != null ? type.getPresentableText() : \"<unknown>\";\n      panel.add(new JLabel(getTypeMigrationLabelText(myRoots[0], typeText)), gc);\n      panel.add(myToTypeEditor, gc);\n    }","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n// migrate root 'count' (int field) to: void -> blocked\n\n// after\n// migrate root 'count' to: java.lang.Integer -> proceeds","handlingStrategy":"validation","validationCode":"String typeText = myTypeCodeFragment.getText().trim();\nif (typeText.equals(\"void\") || typeText.equals(\"java.lang.void\")) {\n  // block: void cannot be a migration target; ask for a reference type\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["intellij","refactoring","type-migration","java","void","validation"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}