This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 0cae7f1 JSClosureCompilerWrapper: avoid duplicate rename mappings
0cae7f1 is described below
commit 0cae7f16b7b8f8256a5b754b517abbc7d9f08e16
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Feb 20 07:47:04 2020 -0800
JSClosureCompilerWrapper: avoid duplicate rename mappings
---
.../compiler/utils/JSClosureCompilerWrapper.java | 28 +++++++++++++---------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
index 382f78b..cb6b644 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java
@@ -156,17 +156,6 @@ public class JSClosureCompilerWrapper
}
Map<String, String> propertyMap = null;
- if (propertyNamesToKeep != null)
- {
- if (propertyMap == null)
- {
- propertyMap = new HashMap<String, String>();
- }
- for (String name : propertyNamesToKeep)
- {
- propertyMap.put(name, name);
- }
- }
if (propertyMapInputPath != null)
{
if (propertyMap == null)
@@ -182,6 +171,23 @@ public class JSClosureCompilerWrapper
e.printStackTrace();
}
}
+ if (propertyNamesToKeep != null)
+ {
+ if (propertyMap == null)
+ {
+ propertyMap = new HashMap<String, String>();
+ }
+ for (String name : propertyNamesToKeep)
+ {
+ //if the propertyMapInputPath has already used this name, we
+ //aren't allowed to add a duplicate.
+ //should there be a warning when there's a duplicate? -JT
+ if (!propertyMap.containsValue(name))
+ {
+ propertyMap.put(name, name);
+ }
+ }
+ }
if (propertyMap != null)
{
VariableMap map = VariableMap.fromMap(propertyMap);