Nope, currently the criterion is different: it bases only on the name of the getter, so any method that is considered as "getter" will be skipped if the option is on. Getters like the one from your example are inlined by javac, so they are skipped "automatically", they simply do not exist in the bytecode :) Anyway, Thomas correctly mentioned that debugger's notion of "simple getters" should be revised.
-- Best regards, Eugene Zhuravlev Software Developer JetBrains Inc. http://www.jetbrains.com "Develop with pleasure!"
Note that the inspection for "call to simple getter or setter within class" does check for the structure of the method contents, not just the name. If you're looking for code to fix the debugger, feel free to borrow.
Note that the inspection for "call to simple getter or setter within class" does check for the structure of the method contents, not just the name. If you're looking for code to fix the debugger, feel free to borrow.
The inspection is only for calling simple getters/setters from within their own class, a very fussy style of coding. Thus, no questions about libraries.
No one at JB knows it?
Tom
I'm pretty sure that a simple getter is a method similar to the following:
Cannot be, because for me much more difficult getter will be skipped as well.
Tom
Nope, currently the criterion is different: it bases only on the name of the getter, so any method that is considered as "getter"
will be skipped if the option is on.
Getters like the one from your example are inlined by javac, so they are skipped "automatically", they simply do not exist in the
bytecode :)
Anyway, Thomas correctly mentioned that debugger's notion of "simple getters" should be revised.
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Hi Eugene,
Thanks for the answer.
Always? I always compile with optimization=off and detected such behaviour.
Tom
afaik the optimizations key doesn't affect javac's output.
And as for simple getters inlining - I think it's done always since jdk 1.4
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Thomas Singer (MoTJ)" <nomail@nodomain.com> wrote in message news:d5f197$b1k$1@is.intellij.net...
>
>
>> Getters like the one from your example are inlined by javac,
>
>
Hmm, I've tried it with JDK 1.5.0_03 and this example:
public class InlineGetter {
private int number;
public InlineGetter(int number) {
this.number = number;
}
public int getNumber() {
return number;
}
public void print() {
System.out.println("number = " + getNumber());
}
}
After compilation and un-"jad"ding I get:
public class InlineGetter
{
public InlineGetter(int number)
{
this.number = number;
}
public int getNumber()
{
return number;
}
public void print()
{
System.out.println((new StringBuilder()).append("number =
").append(getNumber()).toString());
}
private int number;
}
To me it looks like the getter is not inlined.
Tom
Then it is inlined by hotspot on runtime - I was wrong saying that it is missing from the bytecode.
Anyway, debugger acts as if there is no method.
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Thomas Singer (MoTJ)" <nomail@nodomain.com> wrote in message news:d5fj9f$43e$1@is.intellij.net...
>
>
>
>
>
>
>
>
>
>
>
>
Note that the inspection for "call to simple getter or setter within class" does check for the structure of the method contents, not just the name. If you're looking for code to fix the debugger, feel free to borrow.
--Dave Griffith
Thanks Dave,
but what to do with getters from libraries?
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Dave Griffith" <dave.griffith@cnn.com> wrote in message news:23320205.1115379254731.JavaMail.itn@is.intellij.net...
>
The inspection is only for calling simple getters/setters from within their own class, a very fussy style of coding. Thus, no questions about libraries.
--Dave Griffith