[jboss-jira] [JBoss JIRA] (LOGTOOL-81) Log Tool generates class names that violate FindBugs standard rules

David Lloyd (JIRA) issues at jboss.org
Fri Apr 15 11:20:00 EDT 2016


    [ https://issues.jboss.org/browse/LOGTOOL-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192614#comment-13192614 ] 

David Lloyd commented on LOGTOOL-81:
------------------------------------

Generated code often fails to comply with naming conventions (consider lambda class names and anonymous class names, at the least), which is one reason they are conventions and not hard requirements.  In general analyzing generated code is not likely to be helpful since that code doesn't ever have to be maintained by humans (which is in fact the primary motivation for generating it in the first place).

That said, the proposal to capitalize the first letter seems harmless and an easy workaround.

> Log Tool generates class names that violate FindBugs standard rules
> -------------------------------------------------------------------
>
>                 Key: LOGTOOL-81
>                 URL: https://issues.jboss.org/browse/LOGTOOL-81
>             Project: Log Tool
>          Issue Type: Bug
>         Environment: OS X Mavericks, Java 1.7
>            Reporter: Tom Cunningham
>            Assignee: James Perkins
>
> Log Tool generates class names like : 
> ./api/target/generated-sources/annotations/org/switchyard/APILogger_$logger.java
> ./validate/target/generated-sources/annotations/org/switchyard/validate/ValidateMessages_$bundle.java
> When I run findbugs, my project isn't clean anymore because of these generated classes - findbugs complains that these classes do not start with a capital letter.     It looks like this violates the NM_CLASS_NAMING_CONVENTION rule.    
> From Findbugs website : 
> Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
> http://findbugs.sourceforge.net/bugDescriptions.html
> I can probably work around this by providing FindBugs exceptions for "_$logger" and "_$bundle", but it might be good practice if the first letter were upper cased in the generated class (i.e. "_$Logger" and "_$Bundle" .



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list