JetBrains/intellij-community · warning · ConfigurationException

''{0}'' is invalid parameter class name

Error message

''{0}'' is invalid parameter class name

What it means

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.

Source

Thrown at java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java:490

  protected void canRun() throws ConfigurationException {
    super.canRun();
    final Project project = mySourceMethod.getProject();
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
    if (myCreateInnerClassRadioButton.isSelected()) {
      final String innerClassName = getInnerClassName();
      if (!nameHelper.isIdentifier(innerClassName)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.inner.class.name", innerClassName));
      }
      if (mySourceMethod.getContainingClass().findInnerClassByName(innerClassName, false) != null) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("introduce.parameter.object.error.inner.class.already.exist", innerClassName));
      }
    }
    else if (!useExistingClass()) {
      final String className = getClassName();
      if (className.isEmpty() || !nameHelper.isIdentifier(className)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.parameter.class.name", className));
      }
      final String packageName = getPackageName();

      if (packageName.isEmpty() || !nameHelper.isQualifiedName(packageName)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.parameter.class.package.name", packageName));
      }
    }
    else {
      final String className = getExistingClassName();
      if (className.isEmpty() || !nameHelper.isQualifiedName(className)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.qualified.parameter.class.name", className));
      }
      if (JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject())) == null) {
        throw new ConfigurationException(JavaRefactoringBundle.message("introduce.parameter.object.error.class.does.not.exist", className));
      }

View on GitHub (pinned to be881553f2)

Solutions

  1. Enter a valid simple identifier (no dots, no keywords) in the class name field.
  2. Move any package portion into the Package field next to it.
  3. Programmatically, pre-validate: PsiNameHelper.getInstance(project).isIdentifier(className) && !className.isEmpty().

Example fix

// before
// class name field: com.acme.RequestParams  -> rejected (dot not allowed)

// after
// class name field: RequestParams
// package  field:   com.acme
Defensive patterns

Strategy: validation

Validate before calling

String className = getClassName().trim();
PsiNameHelper helper = PsiNameHelper.getInstance(project);
if (className.isEmpty() || !helper.isIdentifier(className)) {
  // block: this field takes a SIMPLE name only; move 'com.acme.X' parts to the package field
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/32900738bd7826bf. Report an issue: GitHub.