allow overriding of return types.  The SWFOverride metadata specifies what to 
allow and what to do at SWF building time.  The SWCs will contain the metadata, 
then the SWF output scans for the metadata and replaces the return types on the 
method traits as the final SWF is built.  If you don't do that, you'll get a 
verify error at runtime.


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/05054cfc
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/05054cfc
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/05054cfc

Branch: refs/heads/develop
Commit: 05054cfcec44723400f9de4e9152907f766ecf59
Parents: c879d2b
Author: Alex Harui <[email protected]>
Authored: Fri Dec 2 10:36:09 2016 -0800
Committer: Alex Harui <[email protected]>
Committed: Mon Dec 5 09:12:17 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/flex/abc/ABCEmitter.java    |  30 ++++-
 .../org/apache/flex/compiler/clients/ASC.java   |   6 +
 .../constants/IMetaAttributeConstants.java      |   4 +
 .../internal/config/TargetSettings.java         |   9 ++
 .../definitions/FunctionDefinition.java         |   2 +-
 .../internal/projects/CompilerProject.java      |   3 +-
 .../compiler/internal/projects/FlexProject.java |  31 ++++-
 .../internal/targets/FlexLibrarySWFTarget.java  |   1 +
 .../internal/targets/LibrarySWFTarget.java      |   1 +
 .../compiler/internal/targets/SWFTarget.java    | 121 ++++++++++++++++++-
 .../internal/units/ABCCompilationUnit.java      |   7 ++
 .../internal/units/CompilationUnitBase.java     |   7 ++
 .../internal/units/FXGCompilationUnit.java      |   5 +
 .../internal/units/SWCCompilationUnit.java      |   6 +
 .../units/requests/SWFTagsRequestResult.java    |  25 +++-
 .../compiler/projects/ICompilerProject.java     |   4 +-
 .../flex/compiler/targets/ITargetSettings.java  |   9 ++
 .../units/requests/ISWFTagsRequestResult.java   |   9 ++
 18 files changed, 264 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/abc/ABCEmitter.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/ABCEmitter.java 
b/compiler/src/main/java/org/apache/flex/abc/ABCEmitter.java
index 93c9b1a..8cdddf1 100644
--- a/compiler/src/main/java/org/apache/flex/abc/ABCEmitter.java
+++ b/compiler/src/main/java/org/apache/flex/abc/ABCEmitter.java
@@ -176,11 +176,21 @@ public final class ABCEmitter implements IABCVisitor
      */
     final Pool<Name> namePool = new 
Pool<Name>(Pool.DefaultType.HasDefaultZero);
     
+    public Pool<Name> getNamePool()
+    {
+       return namePool;
+    }
+    
     /**
      * String pool, has default zero entry.
      */
     final Pool<String> stringPool = new 
Pool<String>(Pool.DefaultType.HasDefaultZero);
     
+    public Pool<String> getStringPool()
+    {
+       return stringPool;
+    }
+    
     /**
      * int pool, has default zero entry.
      */
@@ -201,6 +211,11 @@ public final class ABCEmitter implements IABCVisitor
      */
     final Pool<Namespace> nsPool = new 
Pool<Namespace>(Pool.DefaultType.HasDefaultZero);
     
+    public Pool<Namespace> getNamespacePool()
+    {
+       return nsPool;
+    }
+
     /**
      * namespace set pool, has default zero entry.
      */
@@ -216,12 +231,21 @@ public final class ABCEmitter implements IABCVisitor
      */
     private Collection<EmitterClassVisitor> definedClasses = new 
ArrayList<EmitterClassVisitor>();
     
+    public Collection<EmitterClassVisitor> getDefinedClasses()
+    {
+       return definedClasses;
+    }
     /**
      * MethodInfos defined in this ABC.  These are stored in a dual-indexed 
store
      * so the method info number of a MethodInfo can be quickly retrieved.
      */
     private final EntryOrderedStore<MethodInfo> methodInfos = new 
EntryOrderedStore<MethodInfo>();
     
+    public EntryOrderedStore<MethodInfo> getMethodInfos()
+    {
+       return methodInfos;
+    }
+    
     /**
      * Lock used to protect the method info pool stored in the
      * {@link #methodInfos} field.
@@ -1436,7 +1460,7 @@ public final class ABCEmitter implements IABCVisitor
 
     }
 
-    private class EmitterClassVisitor implements IClassVisitor, 
ClassDependencySort.IInstanceInfoProvider
+    public class EmitterClassVisitor implements IClassVisitor, 
ClassDependencySort.IInstanceInfoProvider
     {
         EmitterClassVisitor(InstanceInfo iinfo, ClassInfo cinfo)
         {
@@ -1455,9 +1479,9 @@ public final class ABCEmitter implements IABCVisitor
         }
 
         ClassInfo classInfo;
-        Traits classTraits;
+        public Traits classTraits;
         InstanceInfo instanceInfo;
-        Traits instanceTraits;
+        public Traits instanceTraits;
 
         @Override
         public void visit()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java 
b/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
index d41663c..f8c9cd4 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/clients/ASC.java
@@ -163,6 +163,12 @@ public class ASC
         }
 
         @Override
+        public boolean allowSubclassOverrides()
+        {
+            return false;
+        }
+
+        @Override
         public boolean areVerboseStacktracesEnabled()
         {
             return false;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/constants/IMetaAttributeConstants.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/constants/IMetaAttributeConstants.java
 
b/compiler/src/main/java/org/apache/flex/compiler/constants/IMetaAttributeConstants.java
index 14f7103..3d7913b 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/constants/IMetaAttributeConstants.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/constants/IMetaAttributeConstants.java
@@ -196,6 +196,10 @@ public interface IMetaAttributeConstants
        static final String NAME_STYLE_STATES = "states";
        static final String NAME_STYLE_THEME = "theme";
        
+       // [SWFOverride]
+    static final String ATTRIBUTE_SWFOVERRIDE = "SWFOverride";
+    static final String NAME_SWFOVERRIDE_RETURNS = "returns";
+    
        // [VisualContentHolder]
     static final String ATTRIBUTE_VISUALCONTENTHOLDER = "VisualContentHolder";
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
index 33a5ff9..3776606 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
@@ -116,6 +116,15 @@ public class TargetSettings implements ITargetSettings
     }
 
     /**
+     * @return the allowSubclassOverrides
+     */
+    @Override
+    public boolean allowSubclassOverrides()
+    {
+        return configuration.getCompilerAllowSubclassOverrides();
+    }
+
+    /**
      * @return the keepAllTypeSelectors
      */
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java
index 7a59d80..b99c44e 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java
@@ -455,7 +455,7 @@ public class FunctionDefinition extends 
ScopedDefinitionBase implements IFunctio
         // Compare return types.
         ITypeDefinition returnType1 = resolveReturnType(project);
         ITypeDefinition returnType2 = other.resolveReturnType(project);
-        if (!project.isCompatibleOverrideReturnType(returnType1, returnType2))
+        if (!project.isCompatibleOverrideReturnType(this, returnType1, 
returnType2))
             return false;
             
         // Compare parameters.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/projects/CompilerProject.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/CompilerProject.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/CompilerProject.java
index 400a951..328915e 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/CompilerProject.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/CompilerProject.java
@@ -39,6 +39,7 @@ import org.apache.flex.compiler.common.Multiname;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.constants.IASLanguageConstants.BuiltinType;
 import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import org.apache.flex.compiler.definitions.INamespaceDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.definitions.ClassDefinition;
@@ -998,7 +999,7 @@ public abstract class CompilerProject implements 
ICompilerProject
         this.problems = problems;
     }
     
-    public boolean isCompatibleOverrideReturnType(ITypeDefinition 
overrideDefinition, ITypeDefinition baseDefinition)
+    public boolean isCompatibleOverrideReturnType(IFunctionDefinition func, 
ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition)
     {
         return (baseDefinition == overrideDefinition);
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
index b6c758e..16246c9 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
@@ -23,6 +23,7 @@ import static com.google.common.collect.Lists.transform;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -40,11 +41,13 @@ import org.apache.flex.compiler.common.DependencyTypeSet;
 import org.apache.flex.compiler.common.XMLName;
 import org.apache.flex.compiler.config.RSLSettings;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
+import org.apache.flex.compiler.constants.IMetaAttributeConstants;
 import org.apache.flex.compiler.css.ICSSManager;
 import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IEffectDefinition;
 import org.apache.flex.compiler.definitions.IEventDefinition;
+import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import org.apache.flex.compiler.definitions.IGetterDefinition;
 import org.apache.flex.compiler.definitions.INamespaceDefinition;
 import org.apache.flex.compiler.definitions.IScopedDefinition;
@@ -52,6 +55,8 @@ import org.apache.flex.compiler.definitions.ISetterDefinition;
 import org.apache.flex.compiler.definitions.IStyleDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.definitions.IVariableDefinition;
+import org.apache.flex.compiler.definitions.metadata.IMetaTag;
+import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
 import org.apache.flex.compiler.definitions.references.INamespaceReference;
 import 
org.apache.flex.compiler.definitions.references.IResolvedQualifiersReference;
 import org.apache.flex.compiler.definitions.references.ReferenceFactory;
@@ -64,6 +69,8 @@ import 
org.apache.flex.compiler.internal.definitions.ClassDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.definitions.NamespaceDefinition;
 import org.apache.flex.compiler.internal.definitions.PackageDefinition;
+import org.apache.flex.compiler.internal.definitions.metadata.MetaTag;
+import org.apache.flex.compiler.internal.definitions.metadata.MetaTagAttribute;
 import org.apache.flex.compiler.internal.mxml.MXMLDialect;
 import org.apache.flex.compiler.internal.mxml.MXMLManifestManager;
 import org.apache.flex.compiler.internal.mxml.MXMLNamespaceMapping;
@@ -2195,13 +2202,29 @@ public class FlexProject extends ASProject implements 
IFlexProject
     }
     
     @Override
-    public boolean isCompatibleOverrideReturnType(ITypeDefinition 
overrideDefinition, ITypeDefinition baseDefinition)
+    public boolean isCompatibleOverrideReturnType(IFunctionDefinition func, 
ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition)
     {
         if (baseDefinition == overrideDefinition)
             return true;
-        if (targetSettings != null && 
targetSettings.getAllowSubclassOverrides() && overrideDefinition != null && 
baseDefinition != null &&
-                
overrideDefinition.isInstanceOf(baseDefinition.getQualifiedName(), this))
-            return true;
+        if (targetSettings != null && 
targetSettings.getAllowSubclassOverrides() && overrideDefinition != null && 
baseDefinition != null)
+        {
+               if 
(overrideDefinition.isInstanceOf(baseDefinition.getQualifiedName(), this))
+                       return true;
+               FunctionDefinition f = (FunctionDefinition)func;
+               IMetaTag[] metas = f.getAllMetaTags();
+               for (IMetaTag meta : metas)
+               {
+                       if 
(meta.getTagName().equals(IMetaAttributeConstants.ATTRIBUTE_SWFOVERRIDE))
+                       {
+                               IMetaTagAttribute attr = 
meta.getAttribute(IMetaAttributeConstants.NAME_SWFOVERRIDE_RETURNS);
+                               if (attr != null)
+                               {
+                                       if 
(attr.getValue().equals(baseDefinition.getQualifiedName()))
+                                               return true;
+                               }
+                       }
+               }
+        }
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
index 655786e..823e54d 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/FlexLibrarySWFTarget.java
@@ -57,6 +57,7 @@ public final class FlexLibrarySWFTarget extends 
LibrarySWFTarget
         super(project, targetSettings, rootedCompilationUnits);
         flexProject = project;
         delegate = new FlexDelegate(targetSettings, project);
+        isLibrary = true;
     }
     
     private final FlexProject flexProject;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/targets/LibrarySWFTarget.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/LibrarySWFTarget.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/LibrarySWFTarget.java
index dd96f3f..b89f8d2 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/LibrarySWFTarget.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/LibrarySWFTarget.java
@@ -47,6 +47,7 @@ public class LibrarySWFTarget extends SWFTarget implements 
ILibrarySWFTarget
         super(project, targetSettings, null);
 
         this.rootedCompilationUnits = rootedCompilationUnits;
+        this.isLibrary = true;
     }
 
     protected final Set<ICompilationUnit> rootedCompilationUnits;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
index 28827e0..832c116 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
@@ -24,11 +24,24 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+import java.util.Vector;
 
+import org.apache.flex.abc.ABCConstants;
+import org.apache.flex.abc.ABCEmitter;
 import org.apache.flex.abc.ABCLinker;
+import org.apache.flex.abc.ABCParser;
+import org.apache.flex.abc.EntryOrderedStore;
+import org.apache.flex.abc.ABCEmitter.EmitterClassVisitor;
+import org.apache.flex.abc.Pool;
+import org.apache.flex.abc.semantics.Metadata;
+import org.apache.flex.abc.semantics.MethodInfo;
+import org.apache.flex.abc.semantics.Name;
+import org.apache.flex.abc.semantics.Namespace;
+import org.apache.flex.abc.semantics.Trait;
 import org.apache.flex.compiler.config.RSLSettings;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.constants.IMetaAttributeConstants;
@@ -36,18 +49,21 @@ import org.apache.flex.compiler.definitions.IDefinition;
 import 
org.apache.flex.compiler.definitions.references.IResolvedQualifiersReference;
 import org.apache.flex.compiler.definitions.references.ReferenceFactory;
 import org.apache.flex.compiler.exceptions.BuildCanceledException;
+import org.apache.flex.compiler.internal.caches.SWFCache;
 import org.apache.flex.compiler.internal.definitions.ClassDefinition;
 import org.apache.flex.compiler.internal.projects.CompilerProject;
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope;
 import org.apache.flex.compiler.internal.units.SWCCompilationUnit;
 import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.problems.UnexpectedExceptionProblem;
 import org.apache.flex.compiler.targets.ISWFTarget;
 import org.apache.flex.compiler.targets.ITargetProgressMonitor;
 import org.apache.flex.compiler.targets.ITargetReport;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
+import org.apache.flex.compiler.units.requests.ISWFTagsRequestResult;
 import org.apache.flex.swc.ISWC;
 import org.apache.flex.swc.ISWCLibrary;
 import org.apache.flex.swf.ISWF;
@@ -106,7 +122,8 @@ public abstract class SWFTarget extends Target implements 
ISWFTarget
     private Collection<ICompilerProblem> problemCollection;
     private Target.RootedCompilationUnits rootedCompilationUnits;
     protected Set<String> metadataDonators = new HashSet<String>();
-    
+    protected boolean isLibrary = false;
+       
     /** 
      * Cached list of compilation units. This is a performance optimization to 
keep us from
      * making redundant calls to topologicalSort.
@@ -395,7 +412,107 @@ public abstract class SWFTarget extends Target implements 
ISWFTarget
                 
                 if (includeCu)
                 {
-                    boolean tagsAdded = 
cu.getSWFTagsRequest().get().addToFrame(frame);
+                       ISWFTagsRequestResult swfTags = 
cu.getSWFTagsRequest().get();
+                       if (targetSettings.allowSubclassOverrides() && 
!isLibrary)
+                       {
+                               // scan the ABC in each CU for overrides that 
need fixing.
+                               // the override needs to be put back to the 
base override
+                               // otherwise you will get a verify error at 
runtime
+                               boolean changedABC = false;
+                        final DoABCTag doABC = swfTags.getDoABCTag();
+                        ABCParser parser = new ABCParser(doABC.getABCData());
+                        ABCEmitter emitter = new ABCEmitter();
+                        parser.parseABC(emitter);
+                        Collection<EmitterClassVisitor> classes = 
emitter.getDefinedClasses();
+                        for (EmitterClassVisitor clazz : classes)
+                        {
+                               System.out.println("scanning for overrides: " + 
clazz.getInstanceInfo().name.getBaseName());
+                               Iterator<Trait> instanceTraits = 
clazz.instanceTraits.iterator();
+                               while (instanceTraits.hasNext())
+                               {
+                                       Trait trait = instanceTraits.next();
+                                       Vector<Metadata> metas = 
trait.getMetadata();
+                                       metas:
+                                       for (Metadata meta : metas)
+                                       {
+                                               if 
(meta.getName().equals(IMetaAttributeConstants.ATTRIBUTE_SWFOVERRIDE))
+                                               {
+                                        EntryOrderedStore<MethodInfo> methods 
= emitter.getMethodInfos();
+                                        for (MethodInfo method : methods)
+                                        {
+                                               String methodName = 
method.getMethodName();
+                                               if (methodName == null) 
continue;
+                                               if 
(methodName.equals(trait.getName().getBaseName()))
+                                               {
+                                                       String[] keys = 
meta.getKeys();
+                                                       int n = keys.length;
+                                                       for (int i = 0; i < n; 
i++)
+                                                       {
+                                                               if 
(keys[i].equals(IMetaAttributeConstants.NAME_SWFOVERRIDE_RETURNS))
+                                                               {
+                                                                       String 
returnString = meta.getValues()[i];
+                                                                       int c = 
returnString.lastIndexOf(".");
+                                                                       String 
packageName = "";
+                                                                       String 
baseName = returnString;
+                                                                       if (c 
!= -1)
+                                                                       {
+                                                                               
packageName = returnString.substring(0, c);
+                                                                               
baseName = returnString.substring(c + 1);
+                                                                       }
+                                                                       
+                                                                       
Pool<Name> namePool = emitter.getNamePool();
+                                                                       
List<Name> nameList = namePool.getValues();
+                                                                       boolean 
foundName = false;
+                                                                       for 
(Name name : nameList)
+                                                                       {
+                                                                               
String base = name.getBaseName();
+                                                                               
if (base == null) continue;
+                                                                               
Namespace ns = name.getSingleQualifier();
+                                                                               
if (ns == null) continue;
+                                                                               
String nsName = ns.getName();
+                                                                               
if (nsName == null) continue;
+                                                                               
if (base.equals(baseName) &&
+                                                                               
                nsName.equals(packageName))
+                                                                               
{
+                                                                               
method.setReturnType(name);
+                                                                               
foundName = true;
+                                                                               
changedABC = true;
+                                                                               
break metas;
+                                                                               
}
+                                                                       }
+                                                                       if 
(!foundName)
+                                                                       {
+                                                                       
Pool<String> stringPool = emitter.getStringPool();
+                                                                       
stringPool.add(packageName);// theoretically, it won't be added if already there
+                                                                       
stringPool.add(baseName);       // theoretically, it won't be added if already 
there
+                                                                               
Namespace ns = new Namespace(ABCConstants.CONSTANT_PackageNs, packageName);
+                                                                               
Pool<Namespace> nsPool = emitter.getNamespacePool();
+                                                                               
nsPool.add(ns);
+                                                                               
Name name = new Name(ns, baseName);
+                                                                               
namePool.add(name);
+                                                                               
method.setReturnType(name);
+                                                                               
changedABC = true;
+                                                                       break 
metas;
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                        }
+                                               }
+                                       }
+                               }
+                        }
+                        if (changedABC)
+                        {
+                               try {
+                                                               
doABC.setABCData(emitter.emit());
+                                                       } catch (Exception e) {
+                                                               
reportProblem(new UnexpectedExceptionProblem(e));
+                                                               return false;
+                                                       }
+                        }
+                       }
+                    boolean tagsAdded = swfTags.addToFrame(frame);
                     if (!tagsAdded)
                         return false;
                 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/units/ABCCompilationUnit.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/ABCCompilationUnit.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/ABCCompilationUnit.java
index c4aa880..30aa084 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/ABCCompilationUnit.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/ABCCompilationUnit.java
@@ -49,6 +49,7 @@ import 
org.apache.flex.compiler.units.requests.IOutgoingDependenciesRequestResul
 import org.apache.flex.compiler.units.requests.ISWFTagsRequestResult;
 import org.apache.flex.compiler.units.requests.ISyntaxTreeRequestResult;
 import org.apache.flex.swf.SWFFrame;
+import org.apache.flex.swf.tags.DoABCTag;
 
 /**
  * This class represents a compilation unit for an ABC file.
@@ -168,6 +169,12 @@ public class ABCCompilationUnit extends CompilationUnitBase
             {
                 return "";
             }
+            
+            @Override
+            public DoABCTag getDoABCTag()
+            {
+                return null;
+            }
         };
         stopProfile(Operation.GET_SWF_TAGS);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/units/CompilationUnitBase.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/CompilationUnitBase.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/CompilationUnitBase.java
index 8e3f7cd..99d656e 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/CompilationUnitBase.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/CompilationUnitBase.java
@@ -85,6 +85,7 @@ import 
org.apache.flex.compiler.units.requests.ISWFTagsRequestResult;
 import org.apache.flex.compiler.units.requests.ISyntaxTreeRequestResult;
 import org.apache.flex.compiler.workspaces.IWorkspaceProfilingDelegate;
 import org.apache.flex.swf.SWFFrame;
+import org.apache.flex.swf.tags.DoABCTag;
 import org.apache.flex.utils.FilenameNormalization;
 import org.apache.flex.utils.StringEncoder;
 
@@ -360,6 +361,12 @@ public abstract class CompilationUnitBase implements 
ICompilationUnit
                     {
                         return "";
                     }
+                    
+                    @Override
+                    public DoABCTag getDoABCTag()
+                    {
+                        return null;
+                    }
                 };
             }
         };

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/units/FXGCompilationUnit.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/FXGCompilationUnit.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/FXGCompilationUnit.java
index 3f180c8..3fd4703 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/FXGCompilationUnit.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/FXGCompilationUnit.java
@@ -391,6 +391,11 @@ public class FXGCompilationUnit extends CompilationUnitBase
                 return abcTag.getName();
             }
             
+            @Override
+            public DoABCTag getDoABCTag()
+            {
+                return abcTag;
+            }
         };
     }
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/units/SWCCompilationUnit.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/SWCCompilationUnit.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/SWCCompilationUnit.java
index b662636..1d1ddf8 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/SWCCompilationUnit.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/SWCCompilationUnit.java
@@ -310,6 +310,12 @@ public class SWCCompilationUnit extends CompilationUnitBase
             {
                 return script.getName();
             }
+            
+            @Override
+            public DoABCTag getDoABCTag()
+            {
+                return doABC;
+            }
         };
         stopProfile(Operation.GET_SWF_TAGS);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/internal/units/requests/SWFTagsRequestResult.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/requests/SWFTagsRequestResult.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/requests/SWFTagsRequestResult.java
index 8fc87f4..ebcc32d 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/units/requests/SWFTagsRequestResult.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/units/requests/SWFTagsRequestResult.java
@@ -85,6 +85,7 @@ public class SWFTagsRequestResult implements 
ISWFTagsRequestResult
     private final List<ITag> additionalTags;
     private final Map<String, ICharacterTag> assetTags;
     private final Collection<ICompilerProblem> problems;
+    private DoABCTag doABC;
 
     @Override
     public ICompilerProblem[] getProblems()
@@ -98,10 +99,13 @@ public class SWFTagsRequestResult implements 
ISWFTagsRequestResult
         if (abcData == null)
             return false;
 
-        final DoABCTag doABC = new DoABCTag();
-        doABC.setABCData(abcData);
-        doABC.setName(tagName);
-
+        if (doABC == null)
+        {
+               doABC = new DoABCTag();
+               doABC.setABCData(abcData);
+               doABC.setName(tagName);
+        }
+        
         for (ITag tag : additionalTags)
         {
             f.addTag(tag);
@@ -124,4 +128,17 @@ public class SWFTagsRequestResult implements 
ISWFTagsRequestResult
     {
         return tagName;
     }
+    
+    @Override
+    public DoABCTag getDoABCTag()
+    {
+        if (doABC == null)
+        {
+               doABC = new DoABCTag();
+               doABC.setABCData(abcData);
+               doABC.setName(tagName);
+        }        
+        return doABC;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/projects/ICompilerProject.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/projects/ICompilerProject.java
 
b/compiler/src/main/java/org/apache/flex/compiler/projects/ICompilerProject.java
index f7093f7..91bfea8 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/projects/ICompilerProject.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/projects/ICompilerProject.java
@@ -26,6 +26,7 @@ import java.util.Set;
 import org.apache.flex.compiler.common.DependencyTypeSet;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.scopes.ASScope;
@@ -226,11 +227,12 @@ public interface ICompilerProject
     void setProblems(Collection<ICompilerProblem> problems);
     
     /**
+     * @param functionDefinition 
      * @param overrideDefinition The definition overriding the base 
definition.  
      * @param baseDefinition The definition being overridden.  
      * @return True if compatible (default is if they are the same)
      */
-    boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, 
ITypeDefinition baseDefinition);
+    boolean isCompatibleOverrideReturnType(IFunctionDefinition 
functionDefinition, ITypeDefinition overrideDefinition, ITypeDefinition 
baseDefinition);
     
     /**
      * @param node The node being converted.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java 
b/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
index 8d90f31..aed7d9c 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/targets/ITargetSettings.java
@@ -252,6 +252,15 @@ public interface ITargetSettings
     boolean useNetwork();
     
     /**
+     * Returns whether the application is comprised of code that used
+     * subclass overrides.
+     * 
+     * @return true if the application is comprised of code that used
+     * subclass overrides, false otherwise.
+     */
+    boolean allowSubclassOverrides();
+    
+    /**
      * Returns a list of CSS and SWC files to apply as a theme.
      * 
      * @return a list of CSS and SWC files to apply as a theme.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05054cfc/compiler/src/main/java/org/apache/flex/compiler/units/requests/ISWFTagsRequestResult.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/units/requests/ISWFTagsRequestResult.java
 
b/compiler/src/main/java/org/apache/flex/compiler/units/requests/ISWFTagsRequestResult.java
index 06413d7..00ea8d8 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/units/requests/ISWFTagsRequestResult.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/units/requests/ISWFTagsRequestResult.java
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.units.requests;
 
 import org.apache.flex.swf.SWFFrame;
+import org.apache.flex.swf.tags.DoABCTag;
 
 /**
  * Result object for the GET_SWF_TAGS operation on ICompilationUnit.
@@ -37,6 +38,14 @@ public interface ISWFTagsRequestResult extends IRequestResult
     boolean addToFrame(SWFFrame f);
     
     /**
+     * Gets the abc tag that {@link #addToFrame(SWFFrame)} will add to a
+     * frame.
+     * 
+     * @return The abc tag.
+     */
+    DoABCTag getDoABCTag();
+    
+    /**
      * Gets the name of the abc tag that {@link #addToFrame(SWFFrame)} will 
add to a
      * frame.
      * 

Reply via email to