use ConfigProps in more places Also added two methods to Properties, to simplify callers. No user-visible changes. Change-Id: I706d21130c395f5f81275f443418528c34261750
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java index 122a529..3db96af 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java
@@ -26,10 +26,10 @@ import com.google.gwt.dev.IncrementalBuilder; import com.google.gwt.dev.IncrementalBuilder.BuildResultStatus; import com.google.gwt.dev.cfg.BindingProperty; +import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.cfg.ConfigurationProperty; import com.google.gwt.dev.cfg.ModuleDef; import com.google.gwt.dev.cfg.ModuleDefLoader; -import com.google.gwt.dev.cfg.Property; import com.google.gwt.dev.cfg.ResourceLoader; import com.google.gwt.dev.cfg.ResourceLoaders; import com.google.gwt.dev.javac.UnitCacheSingleton; @@ -63,7 +63,6 @@ private final AtomicReference<CompileDir> lastBuild = new AtomicReference<CompileDir>(); private CompileDir publishedCompileDir; - private boolean listenerFailed; private final AtomicReference<ResourceLoader> resourceLoader = new AtomicReference<ResourceLoader>(); private final CompilerContext.Builder compilerContextBuilder = new CompilerContext.Builder(); @@ -96,7 +95,7 @@ CompileDir compileDir = makeCompileDir(compileId); TreeLogger compileLogger = makeCompileLogger(compileDir); - listenerFailed = false; + boolean listenerFailed = false; try { options.getRecompileListener().startedCompile(originalModuleName, compileId, compileDir); } catch (Exception e) { @@ -274,6 +273,9 @@ logger, compilerContext, originalModuleName, resources, true); compilerContext = compilerContextBuilder.module(moduleDef).build(); + // A snapshot of the module's configuration before we modified it. + ConfigProps config = new ConfigProps(moduleDef); + // We need a cross-site linker. Automatically replace the default linker. if (IFrameLinker.class.isAssignableFrom(moduleDef.getActivePrimaryLinker())) { moduleDef.addLinker("xsiframe"); @@ -288,7 +290,7 @@ } // Print a nice error if the superdevmode hook isn't present - if (moduleDef.getProperties().find("devModeRedirectEnabled") == null) { + if (config.getStrings("devModeRedirectEnabled").isEmpty()) { throw new RuntimeException("devModeRedirectEnabled isn't set for module: " + moduleDef.getName()); } @@ -299,7 +301,7 @@ // Turn off "installCode" if it's on because it makes debugging harder. // (If it's already off, don't change anything.) - if (getBooleanConfig(moduleDef, "installCode", true)) { + if (config.getBoolean("installCode", true)) { overrideConfig(moduleDef, "installCode", "false"); // Make sure installScriptJs is set to the default for compiling without installCode. overrideConfig(moduleDef, "installScriptJs", @@ -343,8 +345,8 @@ logger = logger.branch(TreeLogger.Type.INFO, "binding: " + propName + "=" + newValue); - Property prop = module.getProperties().find(propName); - if (!(prop instanceof BindingProperty)) { + BindingProperty prop = module.getProperties().findBindingProp(propName); + if (prop == null) { logger.log(TreeLogger.Type.WARN, "undefined property: '" + propName + "'"); return; } @@ -392,37 +394,15 @@ * Sets a binding even if it's set to a different value in the GWT application. */ private static void overrideBinding(ModuleDef module, String propName, String newValue) { - Property prop = module.getProperties().find(propName); - if (prop instanceof BindingProperty) { - BindingProperty binding = (BindingProperty) prop; + BindingProperty binding = module.getProperties().findBindingProp(propName); + if (binding != null) { binding.setAllowedValues(binding.getRootCondition(), newValue); } } - /** - * Returns a boolean configuration property. If not defined, returns the default. - */ - private static boolean getBooleanConfig(ModuleDef module, String propName, - boolean defaultValue) { - Property prop = module.getProperties().find(propName); - if (prop instanceof ConfigurationProperty) { - ConfigurationProperty config = (ConfigurationProperty) prop; - String value = config.getValue(); - if (value != null) { - if (value.equalsIgnoreCase("true")) { - return true; - } else if (value.equalsIgnoreCase("false")) { - return false; - } - } - } - return defaultValue; - } - private static boolean maybeOverrideConfig(ModuleDef module, String propName, String newValue) { - Property prop = module.getProperties().find(propName); - if (prop instanceof ConfigurationProperty) { - ConfigurationProperty config = (ConfigurationProperty) prop; + ConfigurationProperty config = module.getProperties().findConfigProp(propName); + if (config != null) { config.setValue(newValue); return true; }
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java index a6e3791..35e0f7a 100644 --- a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java +++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
@@ -29,7 +29,6 @@ import com.google.gwt.core.ext.linker.SelectionProperty; import com.google.gwt.dev.cfg.BindingProperty; import com.google.gwt.dev.cfg.ModuleDef; -import com.google.gwt.dev.cfg.Property; import com.google.gwt.dev.cfg.Script; import com.google.gwt.dev.jjs.InternalCompilerException; import com.google.gwt.dev.jjs.JJSOptions; @@ -196,28 +195,22 @@ CONFIGURATION_PROPERTY_COMPARATOR); SortedSet<SelectionProperty> mutableSelectionProperties = new TreeSet<SelectionProperty>( SELECTION_PROPERTY_COMPARATOR); - for (Property p : module.getProperties()) { - // Create a new view - if (p instanceof com.google.gwt.dev.cfg.ConfigurationProperty) { - StandardConfigurationProperty newProp = new StandardConfigurationProperty( - (com.google.gwt.dev.cfg.ConfigurationProperty) p); - mutableConfigurationProperties.add(newProp); - if (logger.isLoggable(TreeLogger.SPAM)) { - logger.log(TreeLogger.SPAM, - "Added configuration property " + newProp, null); - } - } else if (p instanceof BindingProperty) { - StandardSelectionProperty newProp = new StandardSelectionProperty( - (BindingProperty) p); - mutableSelectionProperties.add(newProp); - propertiesByName.put(newProp.getName(), newProp); - if (logger.isLoggable(TreeLogger.SPAM)) { - logger.log(TreeLogger.SPAM, "Added selection property " + newProp, - null); - } - } else { - logger.log(TreeLogger.ERROR, "Unknown property type " - + p.getClass().getName()); + for (com.google.gwt.dev.cfg.ConfigurationProperty p : module + .getProperties().getConfigurationProperties()) { + StandardConfigurationProperty newProp = new StandardConfigurationProperty(p); + mutableConfigurationProperties.add(newProp); + if (logger.isLoggable(TreeLogger.SPAM)) { + logger.log(TreeLogger.SPAM, + "Added configuration property " + newProp, null); + } + } + for (BindingProperty p : module.getProperties().getBindingProperties()) { + StandardSelectionProperty newProp = new StandardSelectionProperty(p); + mutableSelectionProperties.add(newProp); + propertiesByName.put(newProp.getName(), newProp); + if (logger.isLoggable(TreeLogger.SPAM)) { + logger.log(TreeLogger.SPAM, "Added selection property " + newProp, + null); } } selectionProperties = Collections.unmodifiableSortedSet(mutableSelectionProperties);
diff --git a/dev/core/src/com/google/gwt/dev/DistillerRebindPermutationOracle.java b/dev/core/src/com/google/gwt/dev/DistillerRebindPermutationOracle.java index bae1b5f..bb69320 100644 --- a/dev/core/src/com/google/gwt/dev/DistillerRebindPermutationOracle.java +++ b/dev/core/src/com/google/gwt/dev/DistillerRebindPermutationOracle.java
@@ -56,8 +56,7 @@ generatorContext = new StandardGeneratorContext( compilerContext, compilationState, generatorArtifacts, true); BindingProperty[] orderedProps = perms.getOrderedProperties(); - ConfigProps config = new ConfigProps( - module.getProperties().getConfigurationProperties()); + ConfigProps config = new ConfigProps(module); Rules rules = module.getRules(); for (int i = 0; i < rebindOracles.length; ++i) { BindingProps props = new BindingProps(orderedProps, perms.getOrderedPropertyValues(i), config);
diff --git a/dev/core/src/com/google/gwt/dev/cfg/BindingProps.java b/dev/core/src/com/google/gwt/dev/cfg/BindingProps.java index 328c2c7..0c1799f 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/BindingProps.java +++ b/dev/core/src/com/google/gwt/dev/cfg/BindingProps.java
@@ -155,6 +155,18 @@ return out.toString(); } + boolean hasSameBindingProperties(BindingProps other) { + if (orderedProps.length != other.orderedProps.length) { + return false; + } + for (int i = 0; i < orderedProps.length; i++) { + if (orderedProps[i] != other.orderedProps[i]) { + return false; + } + } + return true; + } + private class SoftPropsOracle implements PropertyOracle { @Override
diff --git a/dev/core/src/com/google/gwt/dev/cfg/ConfigProps.java b/dev/core/src/com/google/gwt/dev/cfg/ConfigProps.java index 76e3989..cc52757 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/ConfigProps.java +++ b/dev/core/src/com/google/gwt/dev/cfg/ConfigProps.java
@@ -59,7 +59,7 @@ private final ImmutableMap<String, List<String>> props; /** - * Construct from internal ConfigurationProperty instances. + * Takes a snapshot of some ConfigurationProperty instances. */ public ConfigProps(Iterable<ConfigurationProperty> props) { Builder<String, List<String>> builder = ImmutableMap.builder(); @@ -70,6 +70,13 @@ } /** + * Takes a snapshot of a module's configuration properties. + */ + public ConfigProps(ModuleDef def) { + this(def.getProperties().getConfigurationProperties()); + } + + /** * Construct from a map (for testing). */ public ConfigProps(Map<String, List<String>> map) {
diff --git a/dev/core/src/com/google/gwt/dev/cfg/DynamicPropertyOracle.java b/dev/core/src/com/google/gwt/dev/cfg/DynamicPropertyOracle.java index 57426d0..0d8f80c 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/DynamicPropertyOracle.java +++ b/dev/core/src/com/google/gwt/dev/cfg/DynamicPropertyOracle.java
@@ -70,12 +70,9 @@ @Override public ConfigurationProperty getConfigurationProperty(String propertyName) throws BadPropertyValueException { - Property property = properties.find(propertyName); - if (property instanceof com.google.gwt.dev.cfg.ConfigurationProperty) { - com.google.gwt.dev.cfg.ConfigurationProperty configurationProperty = - (com.google.gwt.dev.cfg.ConfigurationProperty) property; - return new DefaultConfigurationProperty( - configurationProperty.getName(), configurationProperty.getValues()); + com.google.gwt.dev.cfg.ConfigurationProperty prop = properties.findConfigProp(propertyName); + if (prop != null) { + return new DefaultConfigurationProperty(prop.getName(), prop.getValues()); } throw new BadPropertyValueException(propertyName); } @@ -113,9 +110,9 @@ } private BindingProperty getBindingProperty(String propertyName) throws BadPropertyValueException { - Property property = properties.find(propertyName); - if (property instanceof BindingProperty) { - return (BindingProperty) property; + BindingProperty property = properties.findBindingProp(propertyName); + if (property != null) { + return property; } throw new BadPropertyValueException(propertyName); }
diff --git a/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java b/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java index 731c606..8f7d743 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java +++ b/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java
@@ -906,27 +906,23 @@ // Normalize property providers. // - for (Property current : getProperties()) { - if (current instanceof BindingProperty) { - BindingProperty prop = (BindingProperty) current; + for (BindingProperty prop : properties.getBindingProperties()) { + if (collapseAllProperties) { + prop.addCollapsedValues("*"); + } - if (collapseAllProperties) { - prop.addCollapsedValues("*"); - } + prop.normalizeCollapsedValues(); - prop.normalizeCollapsedValues(); - - /* - * Create a default property provider for any properties with more than - * one possible value and no existing provider. - */ - if (prop.getProvider() == null && prop.getConstrainedValue() == null) { - String src = "{"; - src += "return __gwt_getMetaProperty(\""; - src += prop.getName(); - src += "\"); }"; - prop.setProvider(new PropertyProvider(src)); - } + /* + * Create a default property provider for any properties with more than + * one possible value and no existing provider. + */ + if (prop.getProvider() == null && prop.getConstrainedValue() == null) { + String src = "{"; + src += "return __gwt_getMetaProperty(\""; + src += prop.getName(); + src += "\"); }"; + prop.setProvider(new PropertyProvider(src)); } }
diff --git a/dev/core/src/com/google/gwt/dev/cfg/PermProps.java b/dev/core/src/com/google/gwt/dev/cfg/PermProps.java index 5a5cb59..167a3c0 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/PermProps.java +++ b/dev/core/src/com/google/gwt/dev/cfg/PermProps.java
@@ -31,6 +31,8 @@ public PermProps(Iterable<BindingProps> softProps) { this.props = ImmutableList.copyOf(softProps); assert props.size() >= 1; + assert sameBindingProperties(props) : + "The binding properties should be the same for each soft permutation."; } /** @@ -107,4 +109,14 @@ } return out.toString(); } + + private boolean sameBindingProperties(ImmutableList<BindingProps> props) { + BindingProps expected = props.get(0); + for (BindingProps actual : props.subList(1, props.size())) { + if (!expected.hasSameBindingProperties(actual)) { + return false; + } + } + return true; + } }
diff --git a/dev/core/src/com/google/gwt/dev/cfg/Properties.java b/dev/core/src/com/google/gwt/dev/cfg/Properties.java index 80123da..9ff0a90 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/Properties.java +++ b/dev/core/src/com/google/gwt/dev/cfg/Properties.java
@@ -16,7 +16,6 @@ package com.google.gwt.dev.cfg; import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; @@ -25,7 +24,7 @@ /** * A typed map of deferred binding properties. */ -public class Properties implements Iterable<Property> { +public class Properties { private final SortedSet<BindingProperty> bindingProps = new TreeSet<BindingProperty>(); @@ -67,6 +66,30 @@ } /** + * Returns the property if (and only if) it's a BindingProperty, otherwise null. + */ + public BindingProperty findBindingProp(String propName) { + Property p = map.get(propName); + if (p instanceof BindingProperty) { + return (BindingProperty) p; + } else { + return null; + } + } + + /** + * Returns the property if (and only if) it's a ConfigurationProperty, otherwise null. + */ + public ConfigurationProperty findConfigProp(String propName) { + Property p = map.get(propName); + if (p instanceof ConfigurationProperty) { + return (ConfigurationProperty) p; + } else { + return null; + } + } + + /** * Gets all deferred binding properties in sorted order. */ public SortedSet<BindingProperty> getBindingProperties() { @@ -77,11 +100,6 @@ return configProps; } - @Override - public Iterator<Property> iterator() { - return map.values().iterator(); - } - private <T extends Property> T create(String name, boolean flag, boolean useFlagArgument, Class<T> clazz) { if (clazz == null) { @@ -101,7 +119,7 @@ } } - Exception ex = null; + Exception ex; try { T newInstance; if (useFlagArgument) {
diff --git a/dev/core/src/com/google/gwt/dev/cfg/PropertyPermutations.java b/dev/core/src/com/google/gwt/dev/cfg/PropertyPermutations.java index d1af533..7225587 100644 --- a/dev/core/src/com/google/gwt/dev/cfg/PropertyPermutations.java +++ b/dev/core/src/com/google/gwt/dev/cfg/PropertyPermutations.java
@@ -176,12 +176,13 @@ // Collate property values in this map SortedMap<CollapsedPropertyKey, List<String[]>> map = new TreeMap<CollapsedPropertyKey, List<String[]>>(); + BindingProperty[] propertyKeys = getOrderedProperties(); // Loop over all possible property value permutations for (Iterator<String[]> it = iterator(); it.hasNext();) { String[] propertyValues = it.next(); - assert propertyValues.length == getOrderedProperties().length; + assert propertyValues.length == propertyKeys.length; - BindingProps props = new BindingProps(getOrderedProperties(), propertyValues, + BindingProps props = new BindingProps(propertyKeys, propertyValues, ConfigProps.EMPTY); CollapsedPropertyKey key = new CollapsedPropertyKey(props);
diff --git a/dev/core/src/com/google/gwt/dev/jjs/AstConstructor.java b/dev/core/src/com/google/gwt/dev/jjs/AstConstructor.java index a7ff5bf..24b9eaa 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/AstConstructor.java +++ b/dev/core/src/com/google/gwt/dev/jjs/AstConstructor.java
@@ -19,7 +19,7 @@ import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.dev.CompilerContext; import com.google.gwt.dev.PrecompileTaskOptions; -import com.google.gwt.dev.cfg.Properties; +import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.javac.CompilationState; import com.google.gwt.dev.javac.StandardGeneratorContext; import com.google.gwt.dev.jdt.RebindPermutationOracle; @@ -44,7 +44,7 @@ * {@link JavaToJavaScriptCompiler}. */ public static JProgram construct(TreeLogger logger, final CompilationState state, - PrecompileTaskOptions options, Properties properties) throws UnableToCompleteException { + PrecompileTaskOptions options, ConfigProps config) throws UnableToCompleteException { InternalCompilerException.preload(); @@ -97,8 +97,8 @@ if (options.isRunAsyncEnabled()) { ReplaceRunAsyncs.exec(logger, jprogram); - if (properties != null) { - CodeSplitters.pickInitialLoadSequence(logger, jprogram, properties); + if (config != null) { + CodeSplitters.pickInitialLoadSequence(logger, jprogram, config); } }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java index 1e3509e..eae6151 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -37,7 +37,6 @@ import com.google.gwt.dev.Permutation; import com.google.gwt.dev.PrecompileTaskOptions; import com.google.gwt.dev.cfg.ConfigProps; -import com.google.gwt.dev.cfg.ConfigurationProperty; import com.google.gwt.dev.cfg.EntryMethodHolderGenerator; import com.google.gwt.dev.cfg.LibraryGroup.CollidingCompilationUnitException; import com.google.gwt.dev.cfg.ModuleDef; @@ -872,7 +871,8 @@ } if (module != null && options.isRunAsyncEnabled()) { ReplaceRunAsyncs.exec(logger, jprogram); - CodeSplitters.pickInitialLoadSequence(logger, jprogram, module.getProperties()); + ConfigProps config = new ConfigProps(module); + CodeSplitters.pickInitialLoadSequence(logger, jprogram, config); } ImplementClassLiteralsAsFields.exec(jprogram); @@ -995,10 +995,8 @@ private void obfuscateEnums() { // See if we should run the EnumNameObfuscator if (module != null) { - ConfigurationProperty enumNameObfuscationProp = - (ConfigurationProperty) module.getProperties().find(ENUM_NAME_OBFUSCATION_PROPERTY); - if (enumNameObfuscationProp != null - && Boolean.parseBoolean(enumNameObfuscationProp.getValue())) { + ConfigProps config = new ConfigProps(module); + if (config.getBoolean(ENUM_NAME_OBFUSCATION_PROPERTY, false)) { EnumNameObfuscator.exec(jprogram, logger); } }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java b/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java index c023da4..de92870 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java +++ b/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java
@@ -17,10 +17,7 @@ import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.dev.cfg.ConfigurationProperty; -import com.google.gwt.dev.cfg.Properties; -import com.google.gwt.dev.cfg.Property; -import com.google.gwt.dev.jjs.InternalCompilerException; +import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.jjs.ast.JArrayType; import com.google.gwt.dev.jjs.ast.JExpression; import com.google.gwt.dev.jjs.ast.JMethod; @@ -42,7 +39,6 @@ import com.google.gwt.thirdparty.guava.common.collect.Lists; import com.google.gwt.thirdparty.guava.common.collect.Multimap; - import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashSet; @@ -62,7 +58,7 @@ * @throws UnableToCompleteException If the module specifies a bad load order */ public static void pickInitialLoadSequence(TreeLogger logger, - JProgram program, Properties properties) throws UnableToCompleteException { + JProgram program, ConfigProps config) throws UnableToCompleteException { SpeedTracerLogger.Event codeSplitterEvent = SpeedTracerLogger .start(CompilerEventType.CODE_SPLITTER, "phase", "pickInitialLoadSequence"); @@ -70,21 +66,8 @@ logger.branch(TreeLogger.TRACE, "Looking up initial load sequence for split points"); LinkedHashSet<JRunAsync> asyncsInInitialLoadSequence = new LinkedHashSet<JRunAsync>(); - ConfigurationProperty configurationPropertyInitialSequence; - { - Property property = properties.find(PROP_INITIAL_SEQUENCE); - if (property == null) { - throw new InternalCompilerException("Could not find configuration property " - + PROP_INITIAL_SEQUENCE); - } - if (!(property instanceof ConfigurationProperty)) { - throw new InternalCompilerException(PROP_INITIAL_SEQUENCE - + " is not a configuration property"); - } - configurationPropertyInitialSequence = (ConfigurationProperty) property; - } - - for (String runAsyncReference : configurationPropertyInitialSequence.getValues()) { + List<String> initialSequence = config.getStrings(PROP_INITIAL_SEQUENCE); + for (String runAsyncReference : initialSequence) { JRunAsync runAsync = findRunAsync(runAsyncReference, program, branch); if (asyncsInInitialLoadSequence.contains(runAsync)) { branch.log(TreeLogger.ERROR, "Split point specified more than once: " + runAsyncReference);
diff --git a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java index 1be1ffe..255b738 100644 --- a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java +++ b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
@@ -18,7 +18,7 @@ import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.dev.PrecompileTaskOptions; -import com.google.gwt.dev.cfg.Properties; +import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.javac.CompilationState; import com.google.gwt.dev.javac.testing.impl.JavaResourceBase; import com.google.gwt.dev.javac.testing.impl.MockJavaResource; @@ -322,10 +322,10 @@ }; public static JProgram construct(TreeLogger logger, CompilationState state, - PrecompileTaskOptions options, Properties properties, + PrecompileTaskOptions options, ConfigProps config, String... entryPoints) throws UnableToCompleteException { options.setEnableAssertions(true); - JProgram jprogram = AstConstructor.construct(logger, state, options, properties); + JProgram jprogram = AstConstructor.construct(logger, state, options, config); // Add entry methods for entry points. for (String entryPoint : entryPoints) {
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/FullCompileTestBase.java b/dev/core/test/com/google/gwt/dev/jjs/impl/FullCompileTestBase.java index 9fe8031..c6ed121 100644 --- a/dev/core/test/com/google/gwt/dev/jjs/impl/FullCompileTestBase.java +++ b/dev/core/test/com/google/gwt/dev/jjs/impl/FullCompileTestBase.java
@@ -24,7 +24,6 @@ import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.cfg.ConfigurationProperty; import com.google.gwt.dev.cfg.PermProps; -import com.google.gwt.dev.cfg.Properties; import com.google.gwt.dev.javac.CompilationState; import com.google.gwt.dev.javac.CompilationStateBuilder; import com.google.gwt.dev.javac.testing.impl.MockJavaResource; @@ -36,6 +35,7 @@ import com.google.gwt.dev.js.ast.JsNode; import com.google.gwt.dev.js.ast.JsProgram; import com.google.gwt.dev.util.Pair; +import com.google.gwt.thirdparty.guava.common.collect.Lists; import java.util.Arrays; import java.util.Map; @@ -77,10 +77,10 @@ CompilationState state = CompilationStateBuilder.buildFrom(logger, compilerContext, sourceOracle.getResources(), getAdditionalTypeProviderDelegate()); + ConfigProps config = new ConfigProps(Lists.newArrayList(configProps)); - Properties properties = createPropertiesObject(configProps); jProgram = - JavaAstConstructor.construct(logger, state, compilerContext.getOptions(), properties, + JavaAstConstructor.construct(logger, state, compilerContext.getOptions(), config, "test.EntryPoint", "com.google.gwt.lang.Exceptions"); jProgram.addEntryMethod(findMethod(jProgram, "onModuleLoad")); @@ -97,7 +97,6 @@ Map<StandardSymbolData, JsName> symbolTable = new TreeMap<StandardSymbolData, JsName>(new SymbolData.ClassIdentComparator()); - ConfigProps config = new ConfigProps(Arrays.asList(configProps)); PermProps props = new PermProps(Arrays.asList( new BindingProps(orderedProps, orderedPropValues, config) )); @@ -111,19 +110,6 @@ return new CompilerContext.Builder().build(); } - private static Properties createPropertiesObject(ConfigurationProperty[] propertyArray) { - Properties properties = new Properties(); - for (ConfigurationProperty configurationPropertyFromArray : propertyArray) { - ConfigurationProperty configurationProperty = - properties.createConfiguration(configurationPropertyFromArray.getName(), - configurationPropertyFromArray.allowsMultipleValues()); - for (String value : configurationPropertyFromArray.getValues()) { - configurationProperty.addValue(value); - } - } - return properties; - } - public void setProperties(BindingProperty[] orderedProps, String[] orderedValues, ConfigurationProperty[] configurationProperties) { this.orderedProps = orderedProps;
diff --git a/dev/core/test/com/google/gwt/dev/js/JsStackEmulatorTest.java b/dev/core/test/com/google/gwt/dev/js/JsStackEmulatorTest.java index 5f68821..81c0357 100644 --- a/dev/core/test/com/google/gwt/dev/js/JsStackEmulatorTest.java +++ b/dev/core/test/com/google/gwt/dev/js/JsStackEmulatorTest.java
@@ -27,7 +27,6 @@ import com.google.gwt.dev.cfg.ConfigProps; import com.google.gwt.dev.cfg.ConfigurationProperty; import com.google.gwt.dev.cfg.PermProps; -import com.google.gwt.dev.cfg.Properties; import com.google.gwt.dev.javac.CompilationState; import com.google.gwt.dev.javac.CompilationStateBuilder; import com.google.gwt.dev.javac.testing.impl.MockJavaResource; @@ -230,10 +229,13 @@ options.setRunAsyncEnabled(false); CompilerContext context = new CompilerContext.Builder().options(options).build(); + ConfigProps config = new ConfigProps(Arrays.asList(recordFileNamesProp, + recordLineNumbersProp)); + CompilationState state = CompilationStateBuilder.buildFrom(logger, context, sourceOracle.getResources(), null); - JProgram jProgram = AstConstructor.construct(logger, state, options, new Properties()); + JProgram jProgram = AstConstructor.construct(logger, state, options, config); jProgram.addEntryMethod(findMethod(jProgram, "onModuleLoad")); if (inline) { @@ -256,8 +258,6 @@ BindingProperty stackMode = new BindingProperty("compiler.stackMode"); stackMode.addDefinedValue(new ConditionNone(), "EMULATED"); - ConfigProps config = new ConfigProps(Arrays.asList(recordFileNamesProp, - recordLineNumbersProp)); PermProps props = new PermProps(Arrays.asList( new BindingProps(new BindingProperty[]{stackMode}, new String[]{"EMULATED"}, config) ));