Skip to content

[java] MissingStaticMethodInNonInstantiatableClass: False positive with Lombok Builder on Constructor #1488

Closed
@mrclmh

Description

@mrclmh

Affects PMD Version:
6.9.0+
7.0.0

Rule: MissingStaticMethodInNonInstantiatableClass

Description:
Using Lomboks Builder annotation on a private constructor triggers MissingStaticMethodInNonInstantiatableClass altough the static builder() method is generated and can be used normally.

Code Sample demonstrating the issue:

package org.example.foo;

import lombok.Builder;

/**
 * TestClass.
 */
public class TestClass {
    @Builder
    private TestClass(final String foo, final Integer bar) {
    }
}

Running PMD through: [Gradle 3.5]

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions