Skip to content

markiewb/nb-additional-hints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Looking for maintainers, who want to take over the development!


Build Status Donate

Plugin page: http://plugins.netbeans.org/plugin/47589/

Additional Java hints for NetBeans IDE

Supported Hints:

  • "Replace '+' with 'MessageFormat.format()'"
  • "Replace '+' with 'new StringBuilder().append()'"
  • "Replace '+' with 'String.format()'"
  • "Join literals"
  • "Copy joined literals to clipboard"
  • "Split at linebreaks"
  • "Split at caret" (since 1.1)
  • "Convert to assertTrue/assertFalse" (since 1.1)
  • "Support transformation to BigDecimal constants" (since 1.1)
  • "Remove "public abstract" modifiers from method declarations within interfaces" (since 1.1)
  • "Remove public/abstract/final modifiers from field declarations within interfaces" (since 1.2)
  • "Change modifiers" (since 1.2)
  • "Convert char to string and back" (since 1.2)
  • "Convert number in literal to number and back" (since 1.2)
  • "Convert to StringUtils.isBlank()/StringUtils.isNotBlank()/StringUtils.isEmpty()" (since 1.2)
  • "Convert from if/else to ternary and back" (since 1.2)
  • "Invert ternary if/else" (since 1.2)
  • "Report methods that have class name" (since 1.2, no transformation)
  • "Add "this." to methods and variables" (since 1.3, disabled by default)
  • "Replace with Optional.isPresent()/Convert return null to return Optional.empty()" (since 1.5)
  • "Replace with null-assignment to Optional with Optional.empty()| (since 1.6)
  • "Convert return xxx to return Optional.ofNullable(xxx)/Optional.of(xxx)/Optional.empty()| (since 1.6)
  • "Convert to assertNull" (since 1.6)
  • "Replace with org.junit.Assert" (since 1.6)

Example:

Updates

1.6.1:

  • [Bugfix]: Fixed: Hints for converting ternary to if and back are missing

1.6.0:

  • [New Fix]: Replace with null-assignment to Optional with Optional.empty()
  • [New Fix]: Convert return xxx to return Optional.ofNullable(xxx)/Optional.of(xxx)/Optional.empty()
  • [New Fix]: Convert to assertNull
  • [New Fix]: Replace with org.junit.Assert
  • [Updated Fix]: "Replace +..." works for more expressions
  • [Updated Fix]: Fixed false positive result from "Convert to Optional.isEmpty()"
  • [Updated Fix]: Make "Change modifiers" hints non-intrusive
  • [Updated Fix]: Make "Change modifiers" hints work for constructors too
  • [Updated Fix ]: java.lang.NullPointerException in "Report methods that have class name"
  • [Updated Fix ]: java.lang.NullPointerException in ReturnForOptional
  • [Removed Fix]: "dead instanceof" hint has been removed
  • [Task]: Update dependencies to NB 8.1
  • [Task]: Reduce dependencies

1.5.0:

  • [Updated Fix]: "Convert to if/else" now supports assignments to new variables
  • [Updated Fix]: "Invert ternary"/"Convert to ternary" now support conditions without brackets
  • [Updated Fix]: "Replace +..." is not proposed for erroneous conditions anymore
  • [Updated Fix]: "Replace +..." works for more expressions
  • [Updated Fix]: Remove false positive detected by "Detect dead instanceof"
  • [New Fix]: Replace with Optional.isPresent()/Convert return null to return Optional.empty()
  • [Task]: Update requirements JDK7 and NB7.4

1.4.0:

  • [New Hint]: Detect dead instanceof-expressions
  • [Updated Fix]: "Replace +..." hints can now supports chars too
  • [Meta]: Add donation link (for those who want to support this project)

1.3.0:

  • [Updated Fix]: "Invert ternary if/else" now supports more patterns
  • [New Hint]: Add "this." to methods and variables (disabled by default)

1.2.0:

  • [New Fix]: Change the modifier of a class/method/field to public/package protected/protected/private (by rasa-silva)
  • [New Fix]: Remove public/abstract/final modifiers from field declarations within interfaces
  • [New Fix]: Convert from char and string and back
  • [New Fix]: Convert number in literal to number and back
  • [New Fix]: Convert to StringUtils.isBlank()/StringUtils.isNotBlank()/StringUtils.isEmpty()
  • [New Fix]: Convert from if/else to ternary and back
  • [New Fix]: Invert ternary if/else
  • [New Hint]: Report methods that have class name
  • [Updated Fix]: "Convert to assertTrue/assertFalse" now supports junit.framework.Assert too
  • [Updated Fix]: "Replace +..." hints can now be configured

1.1.0:

  • [New Fix]: Support transformation to BigDecimal constants
  • [New Fix]: Split a string at caret
  • [New Fix]: Convert to assertTrue/assertFalse
  • [New Fix]: Remove "public abstract" modifiers from method declarations within interfaces
  • [Bugfix]: Literals with quoted Strings won't be copied properly to clipboard
  • [Refactoring]: Convert to maven based module
  • [Refactoring]: Hints should be proposals instead of errors/warnings

1.0.x:

  • [Bugfix]: Literals with quoted Strings create uncompileable code

Further information:

This plugin is orginally based on code from the "I18N Checker" plugin from Jan Lahoda. The original sourcecode can be found at http://hg.netbeans.org/main/contrib/file/tip/editor.hints.i18n

License remains CDDL-GPL-2-CP - http://www.netbeans.org/cddl-gplv2.html

Provide defects, request for enhancements and feedback at https://github.com/markiewb/nb-additional-hints/issues

Compatible to NetBeans 8.1+

btn_donate_SM.gif