GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] ExcessiveParameterListRule must ignore a private constructor · Issue #2461 · pmd/pmd

[java] ExcessiveParameterListRule must ignore a private constructor #2461

New issue
Copy link
New issue
Copy link
Closed
#2697
Closed
[java] ExcessiveParameterListRule must ignore a private constructor#2461
#2697
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
6.27.0

Description

@rxmicro
rxmicro
opened on May 2, 2020
Issue body actions

Affects PMD Version:

6.23.0

Description:

ExcessiveParameterListRule must ignore a private constructor!
Otherwise, a builder pattern can't be applied to class with large count of parameters.

Code Sample demonstrating the issue:

public class Immutable {

    private final int a1;
    ...
    private final int a9;

    // This case must be ignored by ExcessiveParameterListRule
    private Immutable(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) {
        this.a1 = a1;
        ...
        this.a9 = a9;
    }
    
    public static final class Builder {
        private int a1;
        ...
        private int a9;
        public void setA1(final int a1) {
            this.a1 = a1;
        }
        ...
        public void setA9(final int a9) {
            this.a9 = a9;
        }
        public Immutable build (){
            return new Immutable(a1, ...  ,a9);
        }
    }
}

Running PMD through: Maven

Activity

  1. rxmicro
    added
    a:bugPMD crashes or fails to analyse a file.
    on May 2, 2020
  2. rxmicro
    changed the title [-]java: ExcessiveParameterListRule must ignore a private constructor[/-] [+][java] ExcessiveParameterListRule must ignore a private constructor[/+] on May 27, 2020
  3. adangel
    added
    a:false-positivePMD flags a piece of code that is not problematic
    and removed
    a:bugPMD crashes or fails to analyse a file.
    on Aug 20, 2020
  4. adangel
    added this to the 6.27.0 milestone on Aug 20, 2020
  5. adangel
    closed this as completedin 1a5aab6on Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.27.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.