JavaFX Extra Hints - plugin detail

Extra hints and quickfixes for JavaFX.

NetBeans Plugin - JavaFX Extra Hints
Plugin owner: tor
Added: 2010-06-18
License: CDDL
Category: Programming Languages
Downloaded: 3,772 times
 0, by 0 users

Plugin Log Show log

Versions available

Download plugin   Download size: 0.01 MB   Last Update: 2010-06-30

This plugin is also available on the NetBeans Plugin Portal Update Center. Use 'Tools > Plugins' action from the NetBeans IDE main menu for convenient installation of this plugin

What's new in this version

New version, containing 2 more hints and improvements to the implicit type hint (now has autofix, and won't report issues on implicit types with generics or type bounds)

Verifications for NetBeans versions

6.9 verification PASSED See verification details


Extra hints and quickfixes for JavaFX. Currently contains three rules:

(1) Make sure that all non-private functions specify an explicit return type.

This is a good rule to follow because without it you can easily end up with unintended return types (for example, when you intend for a public function to have return type void, but your last statement *happens* to have a type, say of type Number. Now, a subclass wishing to override this function will need to return a Number!

Another, simpler, example is where you for example return "5" from a method and you really intended for it to have return type Number, but since you entered "5" and not "5.0" the inferred type is Integer, and any subclass returning say 4.2 will force rounding.

(2) Detect and fix bound variables.

If you have a variable that is bound, this is a runtime exception waiting to happen (AssignToBoundException). Once you bind the value of a variable, you should make it read only (a def) such that you don't attempt to set it. This hint detects these cases for you and has a fix to correct the code automatically.

(3) Avoid calling BufferedReader.readLine from JavaFX.

JavaFX treats the empty String, "", and null, as identical. This makes it very easy to write incorrect code using BufferedReader.readLine (since it returns null to mean end of file and "" to mean empty line - and JavaFX can't tell the difference). There are many bugs where people have tried reading files etc only to find out that the input is cropped at the first blank line.

[ You have to be logged in to be able to comment. ]

User Comments


More info here

I wrote a blog entry about this here:
Posted by tor on Jun 30, 2010

Project sources, issue tracking, wiki, etc

Source code for this project (and issues etc) are here:
Posted by tor on Jun 23, 2010