Tapestry will treat the two as the exact same SessionState since they both
are java.util.List - the Boolean/String type parameters will not help
differentiate between the two.
It is possible to get around this by changing one of them to
Collection/Iterable/ArrayList/etc so that they use two distinct types:
@SessionState(create=false)
private List<Boolean> booleans;
@SessionState(create=false)
private Collection<String> strings;
but I wouldn't recommend that since it's easy to mix them up and have them
reversed in some other page class.
I believe Josh Canfield has been working on better generics support for
Tapestry 5.3, it's possible that his improvements cover this particular
case so that it works as you expect.
On Thu, 06 Jan 2011 15:38:21 +0100, Michael Gentry <mgen...@masslight.net>
wrote:
Hi everyone,
Given the following page class:
public class Bug
{
@Inject
private Logger log;
@SessionState(create=false)
private List<Boolean> booleans;
@SessionState(create=false)
private List<String> strings;
void onActivate()
{
log.debug("booleans = " + booleans);
log.debug("strings = " + strings);
if (booleans == null)
booleans = new ArrayList<Boolean>();
booleans.add(Boolean.TRUE);
log.debug("booleans: " + booleans);
log.debug("strings: " + strings);
log.debug("equal? " + booleans.equals(strings));
}
}
I get this output:
DEBUG 2011-01-06 09:35:24,014 booleans = null
DEBUG 2011-01-06 09:35:24,014 strings = null
DEBUG 2011-01-06 09:35:24,014 booleans: [true]
DEBUG 2011-01-06 09:35:24,014 strings: [true]
DEBUG 2011-01-06 09:35:24,015 equal? true
Even though I don't add anything to the strings list or even allocate
the strings list, it seems to be pointing to the booleans list, which
is, of course, incorrect. This seems to be happening on both 5.1 and
5.2. Am I missing something?
Thanks,
mrg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org