Intention for using accessors

I came across this a couple of days ago when I dealt with a couple of classes like the following

The two lines of the Bar() constructor were correctly marked as errors, and I was surprised that IDEA had no intentions for replacing them with the lines

Would it be too hard to implement something like that?

Regards,
Jens

1 comment

No, it won't be too hard. Sounds like a good candidate for a quickfix
really.

Eugene.

"Jens Voss" <no_mail@jetbrains.com> wrote in message
news:7648731.1100853209523.JavaMail.itn@is.intellij.net...

I came across this a couple of days ago when I dealt with a couple of

classes like the following

 class Foo {
>
>   private int x;
>
>   public int getX() {
>     return x;
>   }
>
>   public void setX(int x) {
>     this.x = x;
>   }
>
> }
>
> public class Bar extends Foo {
>
>   private int y;
>
>   public Bar() {
>     x = 42;
>     y = x + 1;
>   }
>
> }
> ]]>

The two lines of the Bar() constructor were correctly marked as errors,

and I was surprised that IDEA had no intentions for replacing them with the
lines

     setX(42);
>     y = getX() + 1;
> ]]>

Would it be too hard to implement something like that?

>

Regards,
Jens



0

Please sign in to leave a comment.