I have a parent controller class with a string variable called source
and two classes, Display
and Basket
, that inherit from it. Basket
is used by a component embedded in the display page. On the display page I have
<apex:inputHidden val='{!source}'/>
and I set the value in Javascript. Now I would imagine the value would be set only in the Display
controller but the logs say it's set in Basket
as well.
Is this a feature or a bug? From my previous experiments I remember that when SF get confused to which variable assign a value (child overrides parent's) it silently errors.
TO prove myself I'm not hallucinating : I click on an image within the component ant this invokes GoToBasket (page) action. (function defined in Parent). When I print out the source it's not null. It looks like SF matched it to both instances of ParentClass it had loaded onto the stack.
(862791000)|CODE_UNIT_FINISHED|DisplayController get(hasError)
(862982000)|CODE_UNIT_STARTED|[EXTERNAL]|01pe00000001eLY|BasketController invoke(GoToBasket)
(863035000)|SYSTEM_MODE_ENTER|false
(864396000)|METHOD_ENTRY|[49]|01pe00000001eDt|ParentController.__sfdc_src()
(864440000)|METHOD_EXIT|[49]|01pe00000001eDt|ParentController.__sfdc_src()
(864472000)|SYSTEM_METHOD_ENTRY|[49]|System.debug(ANY)
(864482000)|USER_DEBUG|[49]|DEBUG|*** PARENT CONTROLLER GO TO BASKET source=myvalue ***
(864489000)|SYSTEM_METHOD_EXIT|[49]|System.debug(ANY)
(864498000)|METHOD_ENTRY|[51]|01pe00000001eDt|ParentController.__sfdc_src()
(864512000)|METHOD_EXIT|[51]|01pe00000001eDt|ParentController.__sfdc_src()
…….. setting up page reference and redirecting…….
(865315000)|SYSTEM_METHOD_EXIT|[63]|System.PageReference.setRedirect(Boolean)
(865322000)|SYSTEM_MODE_EXIT|false
(865356000)|CODE_UNIT_FINISHED|BasketController invoke(GoToBasket)