I don't think that this code is compiled incorrectly. I think that we
haven't found the proper code to reproduce your original issue. As best I
can tell, the list.presentationModel getter is where the
IListPresentationModel is created, so returning null is the correct
behavior for getBeadByType() in this particular code. Clearly, this is not
the right way to reproduce the issue that you described (which involved the
release build not behaving the same as the debug build), so I need your
help to find out how to reproduce it.

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>


On Wed, Sep 2, 2020 at 12:01 PM Carlos Rovira <[email protected]>
wrote:

> Hi Josh,
>
> If I change that function to this code:
>
> /**
> * @private
> */
> protected function configureColumnListPresentationModel(event:Event):void
> {
> var list:IDataGridColumnList = event.target as IDataGridColumnList;
> var zzz:Object = (list as IStrand).getBeadByType(IListPresentationModel);
> COMPILE::JS {
> console.log(zzz, zzz as DataGridColumnListPresentationModel);
> }
> //var pm:DataGridColumnListPresentationModel =
> list.getBeadByType(IListPresentationModel) as
> DataGridColumnListPresentationModel; --> this line doesn't work
> var pm:DataGridColumnListPresentationModel = list.presentationModel as
> DataGridColumnListPresentationModel;
> pm.rowHeight = _presentationModel.rowHeight;
> pm.variableRowHeight = false;
> pm.align = list.columnInfo.align;
> }
>
> I get null, null too
>
> I think it's ok with the current problem, instead of getting the IBead, we
> are getting null, so I guess something is compiling wrongly
>
> The compiled code I get is this:
>
> /**
> * @asprivate
> * @protected
> * @param {org.apache.royale.events.Event} event
> */
> org.apache.royale.jewel.beads.views.DataGridView.prototype.
> configureColumnListPresentationModel = function(event) {
> var /** @type
> {org.apache.royale.jewel.supportClasses.datagrid.IDataGridColumnList} */
> list = org.apache.royale.utils.Language.as(event.target,
> org.apache.royale.
> jewel.supportClasses.datagrid.IDataGridColumnList);
> var /** @type {Object} */ zzz = org.apache.royale.utils.Language.as(list,
> org.apache.royale.core.IStrand).getBeadByType(org.apache.royale.jewel.
> supportClasses.list.IListPresentationModel);
> console.log(zzz, org.apache.royale.utils.Language.as(zzz,
> org.apache.royale.
> jewel.beads.models.DataGridColumnListPresentationModel));
> var /** @type
> {org.apache.royale.jewel.beads.models.DataGridColumnListPresentationModel}
> */ pm = org.apache.royale.utils.Language.as(list.presentationModel, org.
> apache.royale.jewel.beads.models.DataGridColumnListPresentationModel);
> pm.rowHeight = this.
> org_apache_royale_jewel_beads_views_DataGridView__presentationModel.
> rowHeight;
> pm.variableRowHeight = false;
> pm.align = list.columnInfo.align;
> };
>
>
> El mié., 2 sept. 2020 a las 19:44, Josh Tynjala (<
> [email protected]>)
> escribió:
>
> > I had a free moment to look into this, but I'm having trouble reproducing
> > the same behavior.
> >
> > I added the following code inside
> > DataGridView.configureColumnListPresentationModel():
> >
> > var zzz:Object = list.getBeadByType(IListPresentationModel);
> > COMPILE::JS {
> >     console.log(zzz, zzz as DataGridColumnListPresentationModel);
> > }
> >
> > If I build and run TourDeJewel, it prints "null null" to the debug
> console.
> > There's no difference between debug and release builds, so I guess I'm
> > doing something wrong.
> >
> > Can you put together some simple code that will reproduce the issue?
> >
> > --
> > Josh Tynjala
> > Bowler Hat LLC <https://bowlerhat.dev>
> >
> >
> > On Wed, Sep 2, 2020 at 9:27 AM Josh Tynjala <[email protected]>
> > wrote:
> >
> > > In a release build, what gets returned by
> > > getBeadByType(IListPresentationModel) if you don't cast it with "as
> > > DataGridColumnListPresentationModel"? Is it the correct object? Or is
> it
> > > also null?
> > >
> > > --
> > > Josh Tynjala
> > > Bowler Hat LLC <https://bowlerhat.dev>
> > >
> > >
> > > On Wed, Sep 2, 2020 at 6:43 AM Carlos Rovira <[email protected]>
> > > wrote:
> > >
> > >> Hi,
> > >>
> > >> I did some more testing and it's not a timing issue.
> > >> I refactored the PM code to "beadsAdded" since is the right place to
> > >> configure it (or was retrieved from the beads array or it's created
> from
> > >> scratch).
> > >> Trying to use the "getBeadByType" line fails the same way, so the
> > problem
> > >> is clearly a compiler issue, from my point of view.
> > >>
> > >> El mié., 2 sept. 2020 a las 14:17, Carlos Rovira (<
> > >> [email protected]>)
> > >> escribió:
> > >>
> > >> > Hi,
> > >> >
> > >> > I just committed a fix to solve an issue Piotr was getting in
> > DataGrid.
> > >> >
> > >> > The issue only can be seen in release mode, in debug works, so it
> > seems
> > >> a
> > >> > compiler bug so hope others like Greg or Josh with more knowledge in
> > >> that
> > >> > field can see what could be wrong, or if maybe it is just some issue
> > in
> > >> the
> > >> > code.
> > >> >
> > >> > Problem is in DataGridView line 239:
> > >> >
> > >> > // var pm:DataGridColumnListPresentationModel =
> > >> > list.getBeadByType(IListPresentationModel) as
> > >> > DataGridColumnListPresentationModel;
> > >> > var pm:DataGridColumnListPresentationModel = list.presentationModel
> as
> > >> > DataGridColumnListPresentationModel;
> > >> > Commented line does not work, I need to refactor to the next one.
> > >> >
> > >> > in the commit I added missed coercions and need to make
> > >> > IDataGridColumnList implement "IListWithPresentationModel" (what I
> > think
> > >> > is ok since that is needed for all column lists.
> > >> >
> > >> > So the problem is: Why can't I retrieve the bead from the list?
> > >> >
> > >> > I'm thinking this could be a timing issue, since the list needs to
> be
> > >> > added to the parent to process the beads and be able to retrieve the
> > >> one.
> > >> > I'll try one more test now trying to put some time out after
> > addElement.
> > >> >
> > >> >
> > >> >
> > >> > ---------- Forwarded message ---------
> > >> > De: Piotr Zarzycki <[email protected]>
> > >> > Date: mié., 2 sept. 2020 a las 12:48
> > >> > Subject: Re: NPE in DataGridView - release build of application
> > >> > To: Apache Royale Development <[email protected]>
> > >> >
> > >> >
> > >> > I have sent you.
> > >> >
> > >> > śr., 2 wrz 2020 o 12:41 Carlos Rovira <[email protected]>
> > >> > napisał(a):
> > >> >
> > >> > > cool :)
> > >> > > yeah send me :)
> > >> > >
> > >> >
> > >> > --
> > >> > Carlos Rovira
> > >> > http://about.me/carlosrovira
> > >> >
> > >> >
> > >> >
> > >> >
> > >>
> > >> --
> > >> Carlos Rovira
> > >> http://about.me/carlosrovira
> > >>
> > >
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>

Reply via email to