You need to sign in to do that
Don't have an account?
amorgan
bug: accessing innerclass properties more that once don't work
I have here an innerclass with a property that always returns 54. When I try to access the property more than once in a VisualForce Page then I get an unexpected result.
Expected Page Result:
54 - 54
Actual Page Result:
54 -
Notes:
Accessing the property twice in the testmethod works so this makes me think it's a VisualForce issue.
Page:
Controller:
Expected Page Result:
54 - 54
Actual Page Result:
54 -
Notes:
Accessing the property twice in the testmethod works so this makes me think it's a VisualForce issue.
Page:
<apex:page controller="TestPageCon">
{!b.b} - {!b.b}
</apex:page>
Controller:
public class TestPageCon {
public class TestPageCon {
public class B {
public Integer b {
get {return 54;}
}
}
public B getB() {return new B();}
testmethod static void testBug() {
TestPageCon test = new TestPageCon();
System.assertEquals(test.getB().b, 54);
System.assertEquals(test.getB().b, 54);
}
}
Best Answer chosen by Admin (Salesforce Developers)
Suzanyu
I did some change in your code and I get what you want.
The reason is you made the inner property "public" and same name with the B (even that is lower case) . And there are two getB() both public as well. The complier getting confused.
===============test results=====================