Skip to content

Rules do not scan Functional interfaces #15

@maschnetwork

Description

@maschnetwork

Hi,

It seems like the the plugin only detects errors when using the RequestHandler interface. However, when using Spring Cloud Functions you would use the generic java.util.function.Function interface. This will probably also affect other frameworks that are not using the RequestHandler interface.

Examples:

WORKS with RequestHandler (Detects an issue):

@Component
public class LambdaHandler implements RequestHandler<String, String> {

    private final UUID random = UUID.randomUUID();

    @Override
    public String handleRequest(String event, Context context) {
        return random.toString();
    }
}

DOES NOT WORK with Function interface (detects no issues):

@Component
public class LambdaHandler implements Function<String, String> {

    private final UUID random = UUID.randomUUID();

    @Override
    public String apply(String event) {
        return random.toString();
    }
}

Proposal:

I would propose to scan either the entire package or make it configurable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions