JetBrains/intellij-community · warning · ConfigurationException

replace.constructor.builder.error.invalid.builder.qualified.

Error message

replace.constructor.builder.error.invalid.builder.qualified.class.name

What it means

Thrown by ReplaceConstructorWithBuilderDialog.canRun() (ReplaceConstructorWithBuilderDialog.java:522) in the 'Use existing class' branch when the existing-class field is non-empty but not a valid qualified name (PsiNameHelper.isQualifiedName). Grammar gate only; whether the class actually resolves is not re-checked here in this branch's shown source (unlike IntroduceParameterObjectDialog, there is no findClass follow-up in this snippet).

Source

Thrown at java/java-impl-refactorings/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.java:522

    }
    if (myCreateBuilderClassRadioButton.isSelected()) {
      final String className = myNewClassName.getText().trim();
      if (className.isEmpty()) throw new ConfigurationException(null);
      if (!nameHelper.isQualifiedName(className)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("replace.constructor.builder.error.invalid.builder.class.name", className));
      }
      final String packageName = myPackageTextField.getText().trim();
      if (!packageName.isEmpty() && !nameHelper.isQualifiedName(packageName)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("replace.constructor.builder.error.invalid.builder.package.name", packageName));
      }
    }
    else {
      final String qualifiedName = myExistentClassTF.getText().trim();
      if (qualifiedName.isEmpty()) throw new ConfigurationException(null);
      if (!nameHelper.isQualifiedName(qualifiedName)) {
        throw new ConfigurationException(
          JavaRefactoringBundle.message("replace.constructor.builder.error.invalid.builder.qualified.class.name", qualifiedName));
      }
    }
  }

  private JScrollPane createTablePanel() {
    myTableModel = new MyTableModel();
    myTable = new JBTable(myTableModel);
    myTable.setSurrendersFocusOnKeystroke(true);
    myTable.getTableHeader().setReorderingAllowed(false);

    final TableColumnModel columnModel = myTable.getColumnModel();
    columnModel.getColumn(SKIP_SETTER).setCellRenderer(new BooleanTableCellRenderer());

    myTable.registerKeyboardAction(
      new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

View on GitHub (pinned to be881553f2)

Solutions

  1. Supply the fully qualified name of the existing builder class ('com.acme.FooBuilder') via the class browser if available.
  2. Remove stray spaces, doubled dots, or generic markers from the field.
  3. Pre-check: PsiNameHelper.getInstance(project).isQualifiedName(fqn.trim()).

Example fix

// before
// existing builder: FooBuilder -> invalid qualified name

// after
// existing builder: com.acme.FooBuilder
Defensive patterns

Strategy: validation

Validate before calling

String fqn = myExistentClassTF.getText().trim();
if (!fqn.isEmpty() && !PsiNameHelper.getInstance(project).isQualifiedName(fqn)) {
  // block before OK; require full 'package.Class' form
}

Prevention

When it happens

Trigger: Replace Constructor with Builder with the use-existing radio selected; the field holds 'Builder' (simple name only), 'com..Builder', or text with spaces.

Common situations: Forgetting the package prefix when pointing at an existing builder, pasting from a Javadoc link that includes generics/annotations, or partially deleting an FQN.

Related errors


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