Regression Bug?

I am not sure when this bug crept in - but its in idea823.

If I have a "static final" member variable, and I Generate Constructor, I quite correctly dont have that member listed in my "Choose Fields to Initialize by Constructor".

However, if I make it just a "final" member (ie not static) then it is incorrectly listed to be initialized by the constructor (when it cannot be because it is final).

-Nick

6 comments
Comment actions Permalink


"Nick Minutello" <jiveadmin@jetbrains.com> wrote in message news:17059521.1055250435491.JavaMail.itn@is.intellij.net...

(when it cannot be because it is final).


you can (are allowed) to initilize final members in constructor,
-m

0
Comment actions Permalink

Errr.. you are quite right :-S

I was actually thrown off by IntelliJ highlighting it as an error (because I had already initialised it on declaration).

So, the problem is in fact that IntelliJ lists it for initialisation when it has already been initialised...

-Nick

0
Comment actions Permalink

You can instatiate final members in a constructor.

If you have a static final member, you can do this:


0
Comment actions Permalink

You are right of course - but thats not the issue at hand.
(you are initialising it in a static block)

The problem remains that IntelliJ list a final (non static) member for initialisation in a constructor when it has already been initialised (you cant intialise it twice)

Should this be raised as a Bug?

-Nick

0
Comment actions Permalink

In case the final field has been initialized it should not be proposed by the generator. This is a bug, especially because it creates illegal code if you select that field (and immediately displays the error).

0

Please sign in to leave a comment.