{"record":{"id":"32900738bd7826bf","repo":"JetBrains/intellij-community","slug":"0-is-invalid-parameter-class-name","errorCode":null,"errorMessage":"''{0}'' is invalid parameter class name","messagePattern":"''(.+?)'' is invalid parameter class name","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"warning","filePath":"java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java","lineNumber":490,"sourceCode":"  protected void canRun() throws ConfigurationException {\n    super.canRun();\n    final Project project = mySourceMethod.getProject();\n    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);\n    if (myCreateInnerClassRadioButton.isSelected()) {\n      final String innerClassName = getInnerClassName();\n      if (!nameHelper.isIdentifier(innerClassName)) {\n        throw new ConfigurationException(\n          JavaRefactoringBundle.message(\"introduce.parameter.object.error.invalid.inner.class.name\", innerClassName));\n      }\n      if (mySourceMethod.getContainingClass().findInnerClassByName(innerClassName, false) != null) {\n        throw new ConfigurationException(\n          JavaRefactoringBundle.message(\"introduce.parameter.object.error.inner.class.already.exist\", innerClassName));\n      }\n    }\n    else if (!useExistingClass()) {\n      final String className = getClassName();\n      if (className.isEmpty() || !nameHelper.isIdentifier(className)) {\n        throw new ConfigurationException(\n          JavaRefactoringBundle.message(\"introduce.parameter.object.error.invalid.parameter.class.name\", className));\n      }\n      final String packageName = getPackageName();\n\n      if (packageName.isEmpty() || !nameHelper.isQualifiedName(packageName)) {\n        throw new ConfigurationException(\n          JavaRefactoringBundle.message(\"introduce.parameter.object.error.invalid.parameter.class.package.name\", packageName));\n      }\n    }\n    else {\n      final String className = getExistingClassName();\n      if (className.isEmpty() || !nameHelper.isQualifiedName(className)) {\n        throw new ConfigurationException(\n          JavaRefactoringBundle.message(\"introduce.parameter.object.error.invalid.qualified.parameter.class.name\", className));\n      }\n      if (JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject())) == null) {\n        throw new ConfigurationException(JavaRefactoringBundle.message(\"introduce.parameter.object.error.class.does.not.exist\", className));\n      }","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java#L472-L508","documentation":"Thrown by IntroduceParameterObjectDialog.canRun() (IntroduceParameterObjectDialog.java:490) in the 'Create new class' branch (not inner, not existing) when the class name field is empty or fails PsiNameHelper.isIdentifier(). The parameter-object class to be generated must have a legal simple name; the dialog refuses otherwise. Standard ConfigurationException flow: message shown, dialog stays open.","triggerScenarios":"Introduce Parameter Object with the create-new-class option selected; the class name field is blank or contains a non-identifier ('My Params', 'class', 'Foo.Bar'). Note the qualified-name form is invalid here — this field expects a simple name.","commonSituations":"Pasting a fully qualified name ('com.acme.Params') into the simple-name field, leaving the field empty, or a keyword/typo. The separate package field is validated by the next check (error 244).","solutions":["Enter a valid simple identifier (no dots, no keywords) in the class name field.","Move any package portion into the Package field next to it.","Programmatically, pre-validate: PsiNameHelper.getInstance(project).isIdentifier(className) && !className.isEmpty()."],"exampleFix":"// before\n// class name field: com.acme.RequestParams  -> rejected (dot not allowed)\n\n// after\n// class name field: RequestParams\n// package  field:   com.acme","handlingStrategy":"validation","validationCode":"String className = getClassName().trim();\nPsiNameHelper helper = PsiNameHelper.getInstance(project);\nif (className.isEmpty() || !helper.isIdentifier(className)) {\n  // block: this field takes a SIMPLE name only; move 'com.acme.X' parts to the package field\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split pasted FQNs: last dot-segment goes to the class field, the rest to the package field.","In custom dialogs, show inline validation instead of waiting for canRun()."],"tags":["intellij","refactoring","java","validation","identifier","class-name"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}