It sounds like there are two things that could be improved. 1) The compiler must not be giving a warning for a missing return type on a method. I'm pretty sure that the Flex compiler had a warning.
2) At runtime, Crux is failing to handle the situation where a method doesn't have a return type. Even if the compiler issues a warning, the method is still not actually required to have a return type. Crux should probably handle that situation more gracefully. -- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Tue, Sep 22, 2020 at 1:36 AM Carlos Rovira <[email protected]> wrote: > Hi Chris, > > you're right. I think this is in the "compiler side" of royale. I'm not an > expert on the compiler, but I guess there should be best practices to > detect this kind of issue and report to the user with a compiler error > message that is far better. > > Maybe just adding a few will improve a lot the compiler quality for > newcomers (even people working full day and mastering Royale). > > Maybe Josh knows more about this and can give some thoughts. If the rest of > us know how to do this, I think we all could add up to make the compiler > better. But I think we need to go over some lessons to learn so we can > apply... > > Thanks > > > > El mar., 22 sept. 2020 a las 10:15, Christofer Dutz (< > [email protected]>) escribió: > > > Hi all, > > > > so I have been trying to port my flex application to Royale and am > > currently working on learning Crux. > > Here I was having a problem, that was extremely difficult to trace down. > > > > The effect was, that my Application was giving me the following error in > > the browser: > > > > getDefinitionByName.js:59 Uncaught ReferenceError: Error #1065: Variable > > is not defined. > > at Object.org.apache.royale.reflection.getDefinitionByName > > (getDefinitionByName.js:59) > > at > > > Function.org.apache.royale.crux.factories.MetadataHostFactory.getMetadataHost > > (MetadataHostFactory.as:71) > > at org.apache.royale.crux.reflection.TypeDescriptor.getMetadataHost > > (TypeDescriptor.as:149) > > at org.apache.royale.crux.reflection.TypeDescriptor.getMetadataHosts > > (TypeDescriptor.as:115) > > at > org.apache.royale.crux.reflection.TypeDescriptor.fromTypeDefinition > > (TypeDescriptor.as:170) > > at > > Function.org.apache.royale.crux.reflection.TypeCache.getTypeDescriptor > > (TypeCache.as:60) > > at Function.org.apache.royale.crux.BeanFactory.constructBean > > (BeanFactory.as:616) > > at > > > de.cware.cweb.frontend.config.Beans.org.apache.royale.crux.BeanProvider.initializeBeans > > (BeanProvider.as:70) > > at > > > de.cware.cweb.frontend.config.Beans.org.apache.royale.crux.BeanProvider.initialize > > (BeanProvider.as:62) > > at org.apache.royale.crux.Crux.constructProviders (Crux.as:288) > > > > When setting a breakpoint in getDefinitionByName.js:59 I could see that > > “name” is simply set to the empty string. > > Also did the stacktrace not really give me any hint to what might be > > causing the problem. So I did a debugging session with Carlos. > > Effectively we commented out stuff till the application “worked” again. > > Today I finally found out what was causing the problem. > > > > In my code I had the following statement: > > > > [EventHandler(event="LoginEvent.LOGIN")] > > public function userLogin() { > > > > > //serviceHelper.executeServiceCall(remoteModuleService.listModulesForCurrentUser(), > > handleListModulesForCurrentUser); > > } > > > > I really tried everything, till I noticed I didn’t define a return type, > > so as soon as I changed that to: > > > > > > [EventHandler(event="LoginEvent.LOGIN")] > > public function userLogin():void { > > > > > //serviceHelper.executeServiceCall(remoteModuleService.listModulesForCurrentUser(), > > handleListModulesForCurrentUser); > > } > > > > My application worked. > > > > So would there be a way to make sure this sort of problem doesn’t occur > or > > to give some output that makes tracking down the issue simpler? > > > > Chris > > > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira >
