flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [1/2] git commit: [flex-falcon] [refs/heads/develop] - LinkageChecker: fixed bug where isExternal() would return the wrong result if the externs member variable were non-null, but initExterns() had not finished adding values yet
Date Thu, 22 Oct 2015 22:08:47 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop f94011d6c -> 20a04c5be


LinkageChecker: fixed bug where isExternal() would return the wrong result if the externs
member variable were non-null, but initExterns() had not finished adding values yet


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

Branch: refs/heads/develop
Commit: d0598b34713dc7e758cf395cba47b67e45bf272b
Parents: afe290e
Author: Josh Tynjala <joshtynjala@apache.org>
Authored: Thu Oct 22 15:08:14 2015 -0700
Committer: Josh Tynjala <joshtynjala@apache.org>
Committed: Thu Oct 22 15:08:14 2015 -0700

----------------------------------------------------------------------
 .../compiler/internal/targets/LinkageChecker.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d0598b34/compiler/src/org/apache/flex/compiler/internal/targets/LinkageChecker.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/LinkageChecker.java b/compiler/src/org/apache/flex/compiler/internal/targets/LinkageChecker.java
index 686e503..596d425 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/LinkageChecker.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/LinkageChecker.java
@@ -95,10 +95,15 @@ public class LinkageChecker
      */
     private void initExterns() throws InterruptedException
     {
-        externs = new HashSet<String>(4096);
+        // using a temporary local variable instead of adding to the externs
+        // member variable directly. isExternal() checks if the member variable
+        // is null. since isExternal() may be called by multiple threads, we
+        // don't want to set the member variable before all externs are added,
+        // or the isExternal() method could return the wrong result 
+        HashSet<String> foundExterns = new HashSet<String>(4096);
         
         // first add the user defined externals
-        externs.addAll(targetSettings.getExterns());
+        foundExterns.addAll(targetSettings.getExterns());
         
         // next add all of the symbols from external libraries
         IWorkspace w = project.getWorkspace();
@@ -127,13 +132,14 @@ public class LinkageChecker
                 // the external library path.
                 ICompilationUnit.UnitType type = unit.getCompilationUnitType();
                 if (type != UnitType.EMBED_UNIT)
-                    externs.addAll(unit.getQualifiedNames());
+                    foundExterns.addAll(unit.getQualifiedNames());
             }
         }
         
         // -includes-classes (compc only) is allow to override externs for
         // monkey patching.
-        externs.removeAll(targetSettings.getIncludeClasses());
+        foundExterns.removeAll(targetSettings.getIncludeClasses());
+        externs = foundExterns;
     }
     
 }


Mime
View raw message