You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Daniel Stieglitz (Jira)" <ji...@apache.org> on 2026/04/28 22:27:00 UTC
[jira] [Comment Edited] (NIFI-15678) Remove PMD rules related to switch statements
[ https://issues.apache.org/jira/browse/NIFI-15678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18076950#comment-18076950 ]
Daniel Stieglitz edited comment on NIFI-15678 at 4/28/26 10:26 PM:
-------------------------------------------------------------------
[~exceptionfactory] [~kdoran] I realize I am a little late to this. But were there many switch statements you had to deal with that exhibited this issue? PMD does allow for disabling rules for blocks of code either with
{code:java}
@SuppressWarnings("PMD.ExhaustiveSwitchHasDefault"){code}
above a methodÂ
or with
{code:java}
// NOPMD{code}
at a specific line.
Couldn't these have been employed instead of the removing the use of these rules entirely?
was (Author: JIRAUSER294662):
[~exceptionfactory] [~kdoran] I realize I am a little late to this. But were there many switch statements you had to deal with that exhibited this issue? PMD does allow for disabling rules for blocks of code either with
{{}}
{code:java}
@SuppressWarnings("PMD.ExhaustiveSwitchHasDefault"){code}
{{}}
above a methodÂ
or with
{code:java}
// NOPMD{code}
at a specific line.
Couldn't these have been employed instead of the removing the use of these rules entirely?
> Remove PMD rules related to switch statements
> ---------------------------------------------
>
> Key: NIFI-15678
> URL: https://issues.apache.org/jira/browse/NIFI-15678
> Project: Apache NiFi
> Issue Type: Task
> Reporter: Kevin Doran
> Assignee: Kevin Doran
> Priority: Minor
> Fix For: 2.9.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> We have some rules that are tricky to adhere to such as ExhaustiveSwitchHasDefault because the enums they operate on come from upstream nifi-api repository, which should be decoupled from nifi. If a developer wants to add a default to an exhaustive switch, it is good defensive programming because a bump in dependency for nifi-api could result in a switch statement that was previously exhaustive no longer being exhaustive, and if there is a reasonable default, that is preferable to having to make code changes in nifi in order to build nifi-api RCs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)