4 comments
Comment actions Permalink

Johannes Schneider wrote:

I have the following code:

if ( ( ( Boolean ) session.getAttribute( "foo" ) ).booleanValue() ) {

}


What is wrong?


The missing check for null or whether getAttribute(String) really
returns a Boolean object?

Tom

0
Comment actions Permalink

Nothing is wrong with that code, although it is a bit verbose for JDK1.5. The "Unnecessary unboxing" inspection lets you know that some code you've written could be simplified (by removing unboxing) if you are compiling under JDK1.5. It will also automatically simplify the code, if you ask it to (either via an intention or the quick-fix in the inspection panel). If you're not compiling under JDK1.5, you shouldn't be using this inspection (it says this in the inspection description).

"Unnecessary unboxing" works the same way, as will the upcoming "for-loop replaceable by for-each". Nothing is wrong with the code they report, just a bit archaic if you're using 1.5.

--Dave Griffith

0
Comment actions Permalink

Thanks for your answer...

I use the latest build and the lates plugins from repository - but all the inspection descriptions are emtpty...


0
Comment actions Permalink


This is a known bug on JetBrains part, and is marked as being fixed in the next EAP build.

--Dave Griffith

0

Please sign in to leave a comment.