20 Replies Latest reply on Apr 21, 2010 10:29 AM by Jason San Jose

    Bizarre Compiler Problem

    chris00chris Level 1

      Hi All,

       

      I really hope someone can help me with the following bizarre problem...

       

      I am using Flex Builder Plugin with SDK 3.5 and I have a large-ish Flex project of about 250 files and 17,000 lines of code. All of a sudden, whilst developing, a compile error occurred in some code completely unrelated to the code I was currently working on. This code was also previously compiling perfectly well and was unchanged.

       

      1067: Implicit coercion of a value of type mypackage:MyClass to an unrelated type Object.

       

      The compiler (in Flex Builder) points to the following code:

       

      <mx:VBox
          width="100%" height="100%">
          <mypackage:MyClass                    <--- Error indicator here
              id="myId"
              mode="{myInt}">

          ...

       

      Firstly the error doesn't make any sense at all as far as I can tell. There is no assigment of MyClass to anything (other than the addition of it as a child to the parent VBox).

       

      I then started modifying the code to try to find the problem. I found that if I changed the following line, it compiled:

       

              mode="1">

       

      I then found that if I changed the line to:

       

              mode="{1}">

       

      I got the same error again, despite the fact that this is perfectly legal.

       

      Unable to find a solution I decided to remove the most recent code that I had added, even though this code was totally unrelated to the code that was showing the error. Suprisingly I found that the error went away again. I then cut this code down to an absolute minimum such that it was basically just an empty class, and the started adding it back slowly to try to find the cause of the problem. Bizarrely I found that simply adding a standard line such as:

       

          import mx.rpc.AsyncToken;

       

      ...caused the problem to reappear again (remember, in a completely different file).

       

      I then started to remove other bits of code randomly and found the same effect. By cutting down or adding to the code base, the error appeared and disappeared randomly.

       

      So... I am completely lost on this one. My hunch is that I have hit some sort of "compiler limit", but what I don't know what. I am pretty sure it is not a memory problem as Eclipse shows there is still available memory.

       

      Has anyone else experienced anything like this before? Any help is very much appreciated.


      Thanks in advance,

       

      Chris

        • 1. Re: Bizarre Compiler Problem
          levancho Level 3

          I have exactly same problem, project is also large, and I get this 1067: Implicit coercion  of a value of type mypackage:MyClass to an unrelated type Object.

          it happens intermittenly at least 3 times out of 10 compilations, as far as I can tell error is completly unrelated to the file it reports agains, and even more, if I am able to clear a compiler error markers cache, by introducing some error in other file, that will clear the that bogus error, and t recompiling again  everything compiles fine, even if I did not touch the file.

           

          my line that it complais is following :

           

          <c:ManageTeamsComponent id="controller" dispatcher="{this}" />

           

          IMHO, it is definately problem with flex compiler with large projects, amd its difficult to report as a BUG,  due to proprietory nature of the code.

          so if anyone knows if there is some way to turn on compiler debuggin, or somehow see what is exactly going on, would be greatly appreciated,

          because of this issue many of our dev team members ar loosing half of the day dealing with this. compiling and recompiling it again and again,

          • 2. Re: Bizarre Compiler Problem
            chris00chris Level 1

            Hi,

             

            Thanks for your reply. At least now I know that I am not going mad! Unfortunately for me the problem is not so intermettent as 3 out of 10, however I too can occasionally get it to work, maybe about 1 time in 20, and I think this is due to using incremental compilation. If I use mxmlc instead, which defaults to not using incremental compilation then I seem to get the error every time.

             

            I also cannot easily report the bug as this is also proprietry code, however I will try...

            • 3. Re: Bizarre Compiler Problem
              levancho Level 3

              I tried all kinds of parameters, including : -keep-generated-actionscript , -optimize, etc ...

              I even looked into generated actionscript and it seems to be fine, I think it is the step right after it, and I have a feeling it is realted to Binding and all these extra "stuff" that is generated to make it work. thats what these {} do .

              incremental also does not solve it,

              in our case cruisControl auto build is also breaking which uses ant to compile, so there is no incremental flag

              • 4. Re: Bizarre Compiler Problem
                chris00chris Level 1

                I also looked into the generated code and found the same thing - it's looks reasonably correct (as far as I can understand it).

                 

                I think that your idea that it may be a binding problem could be a valid one.

                 

                I have posted a bug in Jira:
                https://bugs.adobe.com/jira/browse/FB-26261

                 

                Please feel free to add your comments if you like. I have also linked back to this thread.

                • 5. Re: Bizarre Compiler Problem
                  Darrell Loverin Level 4

                  Do the errors go away if you do a clean build?

                   

                   

                  -Darrell

                  • 6. Re: Bizarre Compiler Problem
                    chris00chris Level 1

                    No. Actually, occasionally it will compile successfully (perhaps due to some sort of incremental building) but then a clean build guarentees that it will fail again.

                    • 7. Re: Bizarre Compiler Problem
                      levancho Level 3

                      No,

                       

                       

                       

                      -- Sent from my Palm Pre

                      On Mar 12, 2010 11:05 AM, Darrell Loverin &lt;forums@adobe.com&gt; wrote:

                       

                      Do the errors go away if you do a clean build?

                       

                       

                       

                       

                       

                      -Darrell

                      • 8. Re: Bizarre Compiler Problem
                        chris00chris Level 1

                        Are there no Adobe staff who have seen this before?

                        Surely this must be a fairly common problem?!

                        • 9. Re: Bizarre Compiler Problem
                          Karl_Sigiscar_1971 Level 3

                          A missing semicolon at the end of a line of code can trigger such problems.

                           

                          I have seen that once.

                           

                          Adding the missing semicolon solved the issue.

                          • 10. Re: Bizarre Compiler Problem
                            levancho Level 3

                            A missing semicolon at the end of a line of code can trigger such problems.

                             

                            I have seen that once.

                             

                            Adding the missing semicolon solved the issue.

                             

                            I doubt it,

                            first of all my problem is in MXML file, plus I just went through whole file and all files it is linking to and checked for missing semicolong and its all good.

                            so it is not the solution unfortunately.

                            • 11. Re: Bizarre Compiler Problem
                              chris00chris Level 1

                              Indeed. Particular sections of code will cause the error to randomly "appear" and I have been through these with a fine-tooth comb, including commenting out all the code and adding it back line by line. In every case the trigger for the appearance of the compile error is a perfectly legal and completely unrelated line of code (without any missing semicolons).

                              • 12. Re: Bizarre Compiler Problem
                                Karl_Sigiscar_1971 Level 3

                                No luck for this particular case then. But the missing semicolon thing happens.

                                • 13. Re: Bizarre Compiler Problem
                                  levancho Level 3

                                  I am trying to get it resolved through company support but that will take some time before they contact adobe support etc ... Then I am going  to post the solution with big letters on my blog,

                                  I am still surprised adobe have not  encountered this kind of issue before?

                                   

                                   

                                   

                                  -- Sent from my Palm Pre

                                  • 14. Re: Bizarre Compiler Problem
                                    chris00chris Level 1

                                    Excellent - I look forward to seeing how you get on.

                                    I am still trying to resolve things from my side, but no luck yet.

                                    • 15. Re: Bizarre Compiler Problem
                                      chris00chris Level 1

                                      Hey Levancho,

                                       

                                      I have found a solution to this, so hopefully it will work for you too.

                                      It seems that the problem occurs when running mxmlc with Java 1.6, but not with Java 1.5. Configuring Eclipse to execute under JDK 1.5 in eclipse.ini...

                                       

                                      -vm
                                      C:\Program Files\Java\jdk1.5.0_11\bin

                                       

                                      ...solves the problem. Of couse you can still have 1.6 installed in Eclipse as an optional JDK and configure your projects to use this JDK if you need features from 1.6, however Eclipse must be running under 1.5 so that it invokes mxmlc with 1.5.

                                       

                                      Hope that helps,

                                      Chris.

                                      • 16. Re: Bizarre Compiler Problem
                                        levancho Level 3

                                        I just got results back  basically that solution did not work for us,.

                                        maany of our developers are using java 1.5 anyways, (I just found that out) and updating cruiscontroll to use java 1.5 did not change anything either, so

                                        this, bad showstopper compiler bug, still exists for us.

                                         

                                        altough we do have a proccess started to get officiall adobe support involved in this, but that is going to take loong time .

                                         

                                        I will upadate this thread, once we hear froma adobe support.

                                        • 17. Re: Bizarre Compiler Problem
                                          ewalden

                                          Here is the one thing we've found that seems to be a workaround.

                                           

                                          If you are getting this strange error:

                                           

                                          1067: Implicit coercion of a value of type mypackage:MyClass to an unrelated type Object.

                                           

                                          then try removing the offending bit of code that it's complaining about. Recompile. If there are other ones like this, remove them as well, and repeat until you get a successful build.

                                           

                                          Once you have built successfully, put back the code that you deleted, and recompile. You won't see the erroneous compiler error after this. If you quit FlexBuilder and restart, you may have to go through all of that nonsense again, so try to keep FB running once you've done those steps above.

                                          • 18. Re: Bizarre Compiler Problem
                                            oddsy7

                                            We have recently also started seeing this problem.

                                             

                                            I notice from your code snippet that you are using the Mate framework, as are we.  Is anyone else using the Mate framework?  (Just in case it's something related to that).

                                            • 19. Re: Bizarre Compiler Problem
                                              levancho Level 3

                                              yes, we are also using mate, (I wish we have not been  using it to be

                                              honest, it caused more problems than solved )

                                              • 20. Re: Bizarre Compiler Problem
                                                Jason San Jose Adobe Employee

                                                Moved to SDK https://bugs.adobe.com/jira/browse/SDK-26283.

                                                 

                                                Jason San Jose

                                                Software Engineer, Flash Builder