JetBrains/intellij-community · warning · ConfigurationException

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

Error message

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

What it means

Thrown by IntroduceParameterObjectDialog.canRun() (IntroduceParameterObjectDialog.java:496) in the create-new-class branch when the package field is empty or fails PsiNameHelper.isQualifiedName. A generated class must live in a syntactically valid package, so the dialog validates the package name grammar (dot-separated identifiers). It is purely syntactic — it does not check that the package exists on disk or in sources.

Source

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

      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));
      }
    }
  }

  private @NotNull String getInnerClassName() {
    return myInnerClassNameTextField.getText().trim();
  }

View on GitHub (pinned to be881553f2)

Solutions

  1. Type/select a well-formed dotted package name ('com.acme.refactoring') with no empty segments.
  2. Use the package chooser (...) button instead of typing to avoid typos.
  3. Pre-validate programmatically: PsiNameHelper.getInstance(project).isQualifiedName(packageName) && !packageName.isEmpty().

Example fix

// before
String pkg = "com.acme."; // trailing dot -> rejected

// after
String pkg = "com.acme";
assert PsiNameHelper.getInstance(project).isQualifiedName(pkg);
Defensive patterns

Strategy: validation

Validate before calling

String pkg = getPackageName().trim();
PsiNameHelper helper = PsiNameHelper.getInstance(project);
if (pkg.isEmpty() || !helper.isQualifiedName(pkg)) {
  // block before running: package name must be dot-separated identifiers
}

Prevention

When it happens

Trigger: Introduce Parameter Object, create-new-class option, package field blank or containing 'com..acme', '.com.acme', 'com.acme.', 'my pkg', or a keyword segment like 'com.int'.

Common situations: Trailing dot from autocompletion, doubled dots after editing, spaces from pasting, or leaving the package empty when the refactoring requires a destination package.

Related errors


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