Hi, I started to check if it was possible to have private and protected constructor in Falcon and I have to admit it was tricky especially because I never seen a compiler from inside before but it is apparently possible, I've been able to compile successfully: package myLib { public class CTORTest { private var _p:int;
private function CTORTest(p:int) { _p = p; } private function anotherFct():CTORTest { return new CTORTest(10); } } } and using the compiled lib: <?xml version="1.0"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="creationCompleteHandler(event)"> <fx:Script><![CDATA[ import mx.events.FlexEvent; import myLib.CTORTest; private function creationCompleteHandler(event:FlexEvent):void { var a:CTORTest = new CTORTest(1); } ]]></fx:Script> </s:Application> gives: [Fault] exception, information=VerifyError: Error #1014: La classe myLib:CTORTest::CTORTest est introuvable. (not found) with the legacy compiler and: F:\sources\falconTestDrive\shell\src\Main.mxml:9 Erreur: Appel d'une méthode qui ne semble pas définie CTORTest. (Call to a undefined method) var a:CTORTest = new CTORTest(1); (I will customize the error message later) I still need to check it works in the 3 possible ways to instantiate a Class [1] (at the moment it works only with 1st one), check that works with is / instanceOf, revisit the cast function accordingly and maybe other things not yet in my mind and especially check FP won't complain using it. /* expression = FunctionCallID(KeywordNewID(void), new_type_name, ContainerID(expression*)) */ /* expression = FunctionCallID(KeywordNewID(void), expression, ContainerID(expression*)) */ /* expression = FunctionCallID(KeywordNewID(void), vector_literal, ContainerID(void)) */ In case all this works and I'm far to know it at the moment, I will have to think about implement "method overloading" otherwise I can't see any usage of a protected constructor and therefore will probably require some help for the best way to implement it. Thanks, Frédéric THOMAS > From: webdoubl...@hotmail.com > To: dev@flex.apache.org > Subject: RE: [Falcon] starting up > Date: Wed, 1 Oct 2014 16:57:28 +0100 > > Ah ok, thanks Gordon, I was tearing my hair out :-) > > Frédéric THOMAS > > > Subject: Re: [Falcon] starting up > > From: gsmit...@hotmail.com > > Date: Wed, 1 Oct 2014 08:51:16 -0700 > > To: dev@flex.apache.org > > > > That comment is out of date. Code Model was the part of pre-Falcon Flash > > Builder that built an abstract syntax tree to support intelligent editing. > > We used it as the beginning of Falcon's lexer and parser. The code is just > > looking at the AST to see if the constructor has a non-public namespace. > > > > - Gordon > > > > > On Oct 1, 2014, at 8:33 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > I updated it to v17.0 and check in > > > falcon\compiler\generated\dist\sdk\lib\external, is there. > > > > > > oops, looking better, it has both, just removed the bad one, it runs. > > > > > > Now, looking at internal\as\codegen\ClassDirectiveProcessor.java, I see > > > that: > > > > > > // If a constructor has a namespace as part of it's declaration, it must > > > be declared public. > > > // It is ok to omit the namespace > > > // We must check the AST, as CM treats all ctors as public no matter what > > > the user typed in > > > // so the FunctionDefinition will always be in the public namespace > > > if( node.getActualNamespaceNode() != null && > > > node.getActualNamespaceNode().getName() != > > > IASKeywordConstants.PUBLIC) > > > problems.add(new > > > ConstructorMustBePublicProblem(node.getActualNamespaceNode())); > > > > > > What is the CM or Code Model ? > > > > > > Thanks, > > > Frédéric THOMAS > > > > > >> From: aha...@adobe.com > > >> To: dev@flex.apache.org > > >> Subject: Re: [Falcon] starting up > > >> Date: Wed, 1 Oct 2014 13:36:50 +0000 > > >> > > >> Could you have an old guava.jar? > > >> > > >>> On 10/1/14 4:32 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote: > > >>> > > >>> Hi, > > >>> > > >>> I built it with ANT an ran Falcon compc.bat from the generated/dist/sdk, > > >>> does anyone knows why I get that ? > > >>> > > >>> Exception in thread "main" java.lang.NoClassDefFoundError: > > >>> com/google/common/cache/CacheLoader > > >>> at org.apache.flex.compiler.clients.MXMLC.<init>(MXMLC.java:379) > > >>> at org.apache.flex.compiler.clients.COMPC.<init>(COMPC.java:54) > > >>> at > > >>> org.apache.flex.compiler.clients.COMPC.staticMainNoExit(COMPC.java:75) > > >>> at org.apache.flex.compiler.clients.COMPC.main(COMPC.java:63) > > >>> Caused by: java.lang.ClassNotFoundException: > > >>> com.google.common.cache.CacheLoader > > >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366) > > >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > > >>> at java.security.AccessController.doPrivileged(Native Method) > > >>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354) > > >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > >>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) > > >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > >>> ... 4 more > > >>> > > >>> Thanks, > > >>> Frédéric THOMAS > > > > > > > > > >