Java 5 inspections should depend on language level

We have just switched our project to Java 5.
But for now we decided to not use any Java 5 features, so language level of the project is still 1.4.
(We want to have the ability to switch back to 1.4 until we are sure that everything works with 1.5: Retroweaver, Installer, automated test setup, webstart, docbook, xslt transforms, ...)

Still I get a lot of inspection warnings like "unnecessary unboxing" and lots of others.
These seem to trigger as soon as JDK 5.0 is configured.

Shouldn't they depend on the language level instead?
Unboxing is definitely not a feature of 1.4 language...

8 comments
Comment actions Permalink

+1

I had to turn off mine because we are in the same position. Once we can
use the features, I have to hunt through and turn them back on.

Stephen Kelvin wrote:

>We have just switched our project to Java 5.
>But for now we decided to not use any Java 5 features, so language level of the project is still 1.4.
>(We want to have the ability to switch back to 1.4 until we are sure that everything works with 1.5: Retroweaver, Installer, automated test setup, webstart, docbook, xslt transforms, ...)
>
>Still I get a lot of inspection warnings like "unnecessary unboxing" and lots of others.
>These seem to trigger as soon as JDK 5.0 is configured.
>
>Shouldn't they depend on the language level instead?
>Unboxing is definitely not a feature of 1.4 language...

>

0
Comment actions Permalink


I'm unable to reproduce this, and the code for "Unnecessary boxing/unboxing" is already checking language level. Note that changes to language level don't occur until you close and reopen a project, but other than that I can't think what might be the problem.

--Dave Griffith

0
Comment actions Permalink

Hm, cannot reproduce in 3368. Maybe I really did not reload the project (though I could swear I had).

Yet, the inspection description should be updated: Currently it says
"For safety, this inspection is disabled unless the project uses J2SDK 5.0."
Should be changed to
"For safety, this inspection is disabled unless the project uses language level 5.0."


Dave Griffith wrote:

I'm unable to reproduce this, and the code for "Unnecessary boxing/unboxing" is already checking language level. Note that changes to language level don't occur until you close and reopen a project, but other than that I can't think what might be the problem.

--Dave Griffith

0
Comment actions Permalink

Yet, the inspection description should be updated: Currently it says
"For safety, this inspection is disabled unless the project uses J2SDK 5.0."
Should be changed to
"For safety, this inspection is disabled unless the project uses language
level 5.0."


And I don't know what is unsafe about it :) I would just say: This
inspection is only enabled when using JDK 5.

ANd it's not project level specific, I believe IDEA needs to also be
running in JDK 5.

R

0
Comment actions Permalink

The inspections for Java 5 work fine in a 1.4 VM, like the one IDEA ships with on Windows.

I agree the wording should be updated to mention language level of the module.

0
Comment actions Permalink

I agree the wording should be updated to mention language level of the module.

If only there were an language level setting for individual modules :(
As far as I can see the language level is a project setting, even though individual modules can have different JDKs.

0
Comment actions Permalink

If only there were an language level setting for
individual modules :(


Sigh... so true. Right now all my projects are composed of modules where some of them use JDK 1.4 and some JDK 1.5. I'm setting the language level to 5.0 and letting the JDK 1.4 compiler catch the errors when I innadvertently use JDK 1.5 features/api's.

0
Comment actions Permalink

You could vote for
http://www.jetbrains.net/jira/browse/IDEABKL-2866

It's sad that there won't be support for multi-language projects
in 5.0 but according to max it represents quite a bit of work.

Vince.


0

Please sign in to leave a comment.