- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.5k
 
[java] Fix #4770: UnusedFormalParameter should ignore public constructor as same as method #5994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…constructors, unless checkall property is set
          
 Instead of suppressing the warning, why not just remove the formal parameter? The constructor is called from one place only.  | 
    
| 
           Because the code says         // topNode is unused, but we'll need it if we want to discount lambdas
        // if we add it later, we break binary compatibility | 
    
| 
           On the other hand, the file is in a package called   | 
    
105455e    to
    ad73e08      
    Compare
  
    | 
          
 Compared to main: (comment created at 2025-08-19 11:27:25+00:00 for ad73e08)  | 
    
| 
           Found the answer myself: If the variable name begins with ignore or unused, there is no violation.  | 
    
…tor as same as method (#5994) Merge branch 'issue-4770-UnusedFormalParameter-should-ignore-public-constructor-as-same-as-method'
          
 Yes, that's what internal means - we could basically remove the parameter. Not sure, what this comment about binary compatibility is about here. The API compatibility is described here: https://docs.pmd-code.org/latest/pmd_projectdocs_decisions_adr_3.html  | 
    
Describe the PR
Treat public constructors the exact same way as public methods.
Related issues
Ready?
I could use some help here. The problem is this line. If it's present, dogfood tells me to remove it. If it's not present, verify tells me to add it. How do I get around this?./mvnw clean verifypasses (checked automatically by github actions)