Simple getter inline intention

public class InlineTest
{
private String s1 = "";

public String getSl()
{
return s1;
}

public void test1()
{
InlineTest t1 = new InlineTest();
String st1 = getSl();
String st2 = t1.getSl();
}
}

I get the intention to convert the simple getter to an inline call for both calls to getS1. I believe the second call(t1.getS1()) should not be inlined, since it is a reference to a new instance of InlineTest.

1 comment

Are you talking of the inspection "Call to simple getter from within class"?
In that case vote for the Jira issue:
http://www.jetbrains.net/jira/browse/IDEA-5254

zmbs wrote:

public class InlineTest
{
private String s1 = "";

public String getSl()
{
return s1;
}

public void test1()
{
InlineTest t1 = new InlineTest();
String st1 = getSl();
String st2 = t1.getSl();
}
}

I get the intention to convert the simple getter to an inline call for both calls to getS1. I believe the second call(t1.getS1()) should not be inlined, since it is a reference to a new instance of InlineTest.

0

Please sign in to leave a comment.