tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Gusev <dmitry.gu...@gmail.com>
Subject Tapestry 5.5-beta-2 problem: @Parameter field access problem with anonymous classes
Date Thu, 11 Apr 2019 18:29:54 GMT
Hi team!

Just wanted to share an issue I found trying to upgrade to 5.5-beta-2 and
Java 11, maybe anyone have seen anything similar before.

In our pages/components it's quite common to build anonymous classes for
Grid data sources, i.e. say if we have a <t:Grid source="sourceObject"> the
sourceObject can be defined as anonymous class that's referencing some
parameter object:

@Parameter
private Object parameterObject1;

public GridDataSource getSourceObject()
{
    return new GridDataSource()
    {
        @Override
        public int getAvailableRows()
        {
            return count(parameterObject1); // this does not read from
parameter conduit
        }
    };
}

I've found that the read access for the parameterObject1 is not replaced in
this case, and parameterObject1 reads its value from a field instead of a
conduit.

However, if parameter access is factored out from the anonymous class - the
value is read as expected, i.e. this works fine:

public GridDataSource getSourceObject()
{
    return new MyDataSource(parameterObject1); // this reads the value from
conduit as expected
}

public class MyDataSource implements GridDataSource
{
    private final Object valueOfParameterObject1;

    public MyDataSource(Object parameterObject1)
    {
        this.valueOfParameterObject1 = parameterObject1;
    }

    @Override
    public int getAvailableRows()
    {
        return count(valueOfParameterObject1);
    }
}

I haven't dig any further yet, but assume it can be related with some
changes in ASM / byte code.

Just thought I'd ask here before I continue.

Best regards,
Dmitry

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message