static method also used by ConfigDelayedMergeObject
3298
static AbstractConfigValue resolveSubstitutions(ReplaceableMergeStack replaceable,
            List<AbstractConfigValue> stack, ResolveContext context) throws NotPossibleToResolve {
        // to resolve substitutions, we need to recursively resolve
        // the stack of stuff to merge, and merge the stack so
        // we won't be a delayed merge anymore. If restrictToChildOrNull
        // is non-null, we may remain a delayed merge though.

        int count = 0;
        AbstractConfigValue merged = null;
        for (AbstractConfigValue v : stack) {
            if (v instanceof ReplaceableMergeStack)
                throw new ConfigException.BugOrBroken(
                        "A delayed merge should not contain another one: " + replaceable);

            boolean replaced = false;
            // we only replace if we have a substitution, or
            // value-concatenation containing one. The Unmergeable
            // here isn't a delayed merge stack since we can't contain
            // another stack (see assertion above).
            if (v instanceof Unmergeable) {
                // If, while resolving 'v' we come back to the same
                // merge stack, we only want to look _below_ 'v'
                // in the stack. So we arrange to replace the
                // ConfigDelayedMerge with a value that is only
                // the remainder of the stack below this one.

                context.source().replace((AbstractConfigValue) replaceable,
                        replaceable.makeReplacer(count + 1));
                replaced = true;
            }

            AbstractConfigValue resolved;
            try {
                resolved = context.resolve(v);
            } finally {
                if (replaced)
                    context.source().unreplace((AbstractConfigValue) replaceable);
            }

            if (resolved != null) {
                if (merged == null)
                    merged = resolved;
                else
                    merged = merged.withFallback(resolved);
            }
            count += 1;
        }

        return merged;
    }
601454
@SuppressWarnings({"unchecked", "rawtypes"})
    @Override
    public C merge(final C other) {
        return (C) ConfigurationUtils.defaultMerge((ConfigurationComponent) this, (ConfigurationComponent) other);
    }
976513
public JsHandlerRegistration addGeometryMergeStartHandler(final GeometryMergeStartHandler handler) {
		org.geomajas.plugin.editing.client.merge.event.GeometryMergeStartHandler h;
		h = new org.geomajas.plugin.editing.client.merge.event.GeometryMergeStartHandler() {

			public void onGeometryMergingStart(GeometryMergeStartEvent event) {
				org.geomajas.plugin.editing.jsapi.client.merge.event.GeometryMergeStartEvent e;
				e = new org.geomajas.plugin.editing.jsapi.client.merge.event.GeometryMergeStartEvent();
				handler.onGeometryMergeStart(e);
			}
		};
		HandlerRegistration registration = delegate.addGeometryMergeStartHandler(h);
		return new JsHandlerRegistration(new HandlerRegistration[] { registration });
	}
1034828
static void render(List<AbstractConfigValue> stack, StringBuilder sb, int indent, boolean atRoot, String atKey,
            ConfigRenderOptions options) {
        boolean commentMerge = options.getComments();
        if (commentMerge) {
            sb.append("# unresolved merge of " + stack.size() + " values follows (\n");
            if (atKey == null) {
                indent(sb, indent, options);
                sb.append("# this unresolved merge will not be parseable because it's at the root of the object\n");
                indent(sb, indent, options);
                sb.append("# the HOCON format has no way to list multiple root objects in a single file\n");
            }
        }

        List<AbstractConfigValue> reversed = new ArrayList<AbstractConfigValue>();
        reversed.addAll(stack);
        Collections.reverse(reversed);

        int i = 0;
        for (AbstractConfigValue v : reversed) {
            if (commentMerge) {
                indent(sb, indent, options);
                if (atKey != null) {
                    sb.append("#     unmerged value " + i + " for key "
                            + ConfigImplUtil.renderJsonString(atKey) + " from ");
                } else {
                    sb.append("#     unmerged value " + i + " from ");
                }
                i += 1;
                sb.append(v.origin().description());
                sb.append("\n");

                for (String comment : v.origin().comments()) {
                    indent(sb, indent, options);
                    sb.append("# ");
                    sb.append(comment);
                    sb.append("\n");
                }
            }
            indent(sb, indent, options);

            if (atKey != null) {
                sb.append(ConfigImplUtil.renderJsonString(atKey));
                if (options.getFormatted())
                    sb.append(" : ");
                else
                    sb.append(":");
            }
            v.render(sb, indent, atRoot, options);
            sb.append(",");
            if (options.getFormatted())
                sb.append('\n');
        }
        // chop comma or newline
        sb.setLength(sb.length() - 1);
        if (options.getFormatted()) {
            sb.setLength(sb.length() - 1); // also chop comma
            sb.append("\n"); // put a newline back
        }
        if (commentMerge) {
            indent(sb, indent, options);
            sb.append("# ) end of unresolved merge\n");
        }
    }
1014384
private DynamoDBMapperConfig mergeConfig(DynamoDBMapperConfig config) {
        if ( config != this.config )
            config = new DynamoDBMapperConfig(this.config, config);
        return config;
    }
509949
private static void join(ArrayList<AbstractConfigValue> builder, AbstractConfigValue origRight) {
        AbstractConfigValue left = builder.get(builder.size() - 1);
        AbstractConfigValue right = origRight;

        // check for an object which can be converted to a list
        // (this will be an object with numeric keys, like foo.0, foo.1)
        if (left instanceof ConfigObject && right instanceof SimpleConfigList) {
            left = DefaultTransformer.transform(left, ConfigValueType.LIST);
        } else if (left instanceof SimpleConfigList && right instanceof ConfigObject) {
            right = DefaultTransformer.transform(right, ConfigValueType.LIST);
        }

        // Since this depends on the type of two instances, I couldn't think
        // of much alternative to an instanceof chain. Visitors are sometimes
        // used for multiple dispatch but seems like overkill.
        AbstractConfigValue joined = null;
        if (left instanceof ConfigObject && right instanceof ConfigObject) {
            joined = right.withFallback(left);
        } else if (left instanceof SimpleConfigList && right instanceof SimpleConfigList) {
            joined = ((SimpleConfigList)left).concatenate((SimpleConfigList)right);
        } else if (left instanceof ConfigConcatenation || right instanceof ConfigConcatenation) {
            throw new BugOrBroken("unflattened ConfigConcatenation");
        } else if (left instanceof Unmergeable || right instanceof Unmergeable) {
            // leave joined=null, cannot join
        } else {
            // handle primitive type or primitive type mixed with object or list
            String s1 = left.transformToString();
            String s2 = right.transformToString();
            if (s1 == null || s2 == null) {
                throw new WrongType(left.origin(),
                        "Cannot concatenate object or list with a non-object-or-list, " + left
                                + " and " + right + " are not compatible");
            } else {
                ConfigOrigin joinedOrigin = SimpleConfigOrigin.mergeOrigins(left.origin(),
                        right.origin());
                joined = new ConfigString(joinedOrigin, s1 + s2);
            }
        }

        if (joined == null) {
            builder.add(right);
        } else {
            builder.remove(builder.size() - 1);
            builder.add(joined);
        }
    }
548902
function merge (src, dest) {
  if (src != null &&
        dest != null &&
        !Array.isArray(src) &&
        !Array.isArray(dest) &&
        typeof src === 'object' &&
        typeof dest === 'object') {
    Object.getOwnPropertyNames(src)
            .forEach(function (prop) {
              var descriptor = Object.getOwnPropertyDescriptor(src, prop);
              descriptor.value = merge(descriptor.value, dest[prop]);
              Object.defineProperty(dest, prop, descriptor);
            });

    return dest;
  }

  return src;
}
928281
public final ConfigurationModuleBuilder merge(final ConfigurationModule d) {
    if (d == null) {
      throw new NullPointerException("If merge() was passed a static final field that is initialized to non-null, " +
          "then this is almost certainly caused by a circular class dependency.");
    }
    try {
      d.assertStaticClean();
    } catch (final ClassHierarchyException e) {
      throw new ClassHierarchyException(ReflectionUtilities.getFullName(getClass()) +
          ": detected attempt to merge with ConfigurationModule that has had set() called on it", e);
    }
    final ConfigurationModuleBuilder c = deepCopy();
    final ConfigurationModuleBuilder builder = d.getBuilder();
    try {
      c.b.addConfiguration(builder.b.build());
    } catch (final BindException e) {
      throw new ClassHierarchyException(e);
    }
    c.reqDecl.addAll(builder.reqDecl);
    c.optDecl.addAll(builder.optDecl);
    c.reqUsed.addAll(builder.reqUsed);
    c.optUsed.addAll(builder.optUsed);
    c.setOpts.addAll(builder.setOpts);
    c.map.putAll(builder.map);
    c.freeImpls.putAll(builder.freeImpls);
    c.freeParams.putAll(builder.freeParams);
    c.lateBindClazz.putAll(builder.lateBindClazz);

    return c;
  }
766156
private static synchronized Class<?> getMergedClass(ClassInjector injector,
                                                        ClassEntry[] classEntries,
                                                        Class<?>[] interfaces,
                                                        int observerMode)
        throws IllegalArgumentException
    {
        Map<MultiKey, String> classListMap = cMergedMap.get(injector);
        if (classListMap == null) {
            classListMap = new HashMap<MultiKey, String>(7);
            cMergedMap.put(injector, classListMap);
        }

        MultiKey key = generateKey(classEntries);
        String mergedName = classListMap.get(key);
        if (mergedName != null) {
            try {
                return injector.loadClass(mergedName);
            }
            catch (ClassNotFoundException e) {
            }
        }

        ClassFile cf;
        try {
            cf = buildClassFile(injector, null, classEntries, interfaces, 
                                observerMode);
        }
        catch (IllegalArgumentException e) {
            e.fillInStackTrace();
            throw e;
        }

        try {
            OutputStream stream = injector.getStream(cf.getClassName());
            cf.writeTo(stream);
            stream.close();
        }
        catch (Throwable e) {
            String output = outputClassToFile(cf);
            throw new RuntimeException(
                "Error generating merged class, contents saved to: " + output, 
                e
            );
        }

        if (DEBUG) {
            String output = outputClassToFile(cf);
            System.out.println("Saved merged class to: " + output);
        }
        
        Class<?> merged;
        try {
            merged = injector.loadClass(cf.getClassName());
        }
        catch (ClassNotFoundException e) {
            throw new InternalError(e.toString());
        }

        classListMap.put(key, merged.getName());
        return merged;
    }
17398
static ConfigObject fromBasename(NameSource source, String name, ConfigParseOptions options) {
        ConfigObject obj;
        if (name.endsWith(".conf") || name.endsWith(".json") || name.endsWith(".properties")) {
            ConfigParseable p = source.nameToParseable(name, options);

            obj = p.parse(p.options().setAllowMissing(options.getAllowMissing()));
        } else {
            ConfigParseable confHandle = source.nameToParseable(name + ".conf", options);
            ConfigParseable jsonHandle = source.nameToParseable(name + ".json", options);
            ConfigParseable propsHandle = source.nameToParseable(name + ".properties", options);
            boolean gotSomething = false;
            List<ConfigException.IO> fails = new ArrayList<ConfigException.IO>();

            ConfigSyntax syntax = options.getSyntax();

            obj = SimpleConfigObject.empty(SimpleConfigOrigin.newSimple(name));
            if (syntax == null || syntax == ConfigSyntax.CONF) {
                try {
                    obj = confHandle.parse(confHandle.options().setAllowMissing(false)
                            .setSyntax(ConfigSyntax.CONF));
                    gotSomething = true;
                } catch (ConfigException.IO e) {
                    fails.add(e);
                }
            }

            if (syntax == null || syntax == ConfigSyntax.JSON) {
                try {
                    ConfigObject parsed = jsonHandle.parse(jsonHandle.options()
                            .setAllowMissing(false).setSyntax(ConfigSyntax.JSON));
                    obj = obj.withFallback(parsed);
                    gotSomething = true;
                } catch (ConfigException.IO e) {
                    fails.add(e);
                }
            }

            if (syntax == null || syntax == ConfigSyntax.PROPERTIES) {
                try {
                    ConfigObject parsed = propsHandle.parse(propsHandle.options()
                            .setAllowMissing(false).setSyntax(ConfigSyntax.PROPERTIES));
                    obj = obj.withFallback(parsed);
                    gotSomething = true;
                } catch (ConfigException.IO e) {
                    fails.add(e);
                }
            }

            if (!options.getAllowMissing() && !gotSomething) {
                if (ConfigImpl.traceLoadsEnabled()) {
                    // the individual exceptions should have been logged already
                    // with tracing enabled
                    ConfigImpl.trace("Did not find '" + name
                            + "' with any extension (.conf, .json, .properties); "
                            + "exceptions should have been logged above.");
                }

                if (fails.isEmpty()) {
                    // this should not happen
                    throw new ConfigException.BugOrBroken(
                            "should not be reached: nothing found but no exceptions thrown");
                } else {
                    StringBuilder sb = new StringBuilder();
                    for (Throwable t : fails) {
                        sb.append(t.getMessage());
                        sb.append(", ");
                    }
                    sb.setLength(sb.length() - 2);
                    throw new ConfigException.IO(SimpleConfigOrigin.newSimple(name), sb.toString(),
                            fails.get(0));
                }
            } else if (!gotSomething) {
                if (ConfigImpl.traceLoadsEnabled()) {
                    ConfigImpl.trace("Did not find '" + name
                            + "' with any extension (.conf, .json, .properties); but '" + name
                                    + "' is allowed to be missing. Exceptions from load attempts should have been logged above.");
                }
            }
        }

        return obj;
    }
292869
@Deprecated
	public static PointsToPolyline splitMerge(@Nullable ConfigSplitMergeLineFit config ) {
		if( config == null )
			config = new ConfigSplitMergeLineFit();
		config.checkValidity();
		return new SplitMergeLineRefine_to_PointsToPolyline(config);
	}
611181
public void addGeometry(Geometry geometry) throws GeometryMergeException {
		if (!busy) {
			throw new GeometryMergeException("Can't add a geometry if no merging process is active.");
		}
		geometries.add(geometry);
		eventBus.fireEvent(new GeometryMergeAddedEvent(geometry));
	}
1185338
public static void checkMultiMapConfig(MultiMapConfig multiMapConfig,
                                           SplitBrainMergePolicyProvider mergePolicyProvider) {
        checkMergePolicy(multiMapConfig, mergePolicyProvider, multiMapConfig.getMergePolicyConfig().getPolicy());
    }
803960
public static void configureMapper(ObjectMapper mapper, Application.Mode mode) {
        mapper.registerModule(new GuavaModule());
        mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
                .enable(SerializationFeature.WRITE_ENUMS_USING_INDEX)
                .enable(MapperFeature.PROPAGATE_TRANSIENT_MARKER)
                .disable(
                        SerializationFeature.WRITE_NULL_MAP_VALUES,
                        SerializationFeature.FAIL_ON_EMPTY_BEANS
                );
        if (!mode.isDev()) {
            mapper.disable(
                    DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
            );
        }
    }
1360220
private void storeMethod(Method method, Map<Key, Array> methodsMap) {
	Key methodName = KeyImpl.init(method.getName());

	Array methodArgs;
	synchronized (methodsMap) {
	    methodArgs = methodsMap.get(methodName);
	    if (methodArgs == null) {
		methodArgs = new ArrayImpl();
		methodsMap.put(methodName, methodArgs);
	    }
	}

	storeArgs(method, methodArgs);
	// Modifier.isStatic(method.getModifiers());
    }
172324
function(config) {
			if (config.env && typeof config.env === "object") {
				return this.merge(this.createEnvironmentConfig(config.env), config);
			}

			return config;
		}
1117222
function (x, y, settings) {
            /**
             * constant for the overlaps method
             * @public
             * @constant
             * @type String
             * @name CHECKMETHOD_OVERLAP
             * @memberOf me.DroptargetEntity
             */
            this.CHECKMETHOD_OVERLAP = "overlaps";
            /**
             * constant for the contains method
             * @public
             * @constant
             * @type String
             * @name CHECKMETHOD_CONTAINS
             * @memberOf me.DroptargetEntity
             */
            this.CHECKMETHOD_CONTAINS = "contains";
            /**
             * the checkmethod we want to use
             * @public
             * @constant
             * @type String
             * @name checkMethod
             * @memberOf me.DroptargetEntity
             */
            this.checkMethod = null;
            this._super(Entity, "init", [x, y, settings]);
            Event.subscribe(Event.DRAGEND, this.checkOnMe.bind(this));
            this.checkMethod = this[this.CHECKMETHOD_OVERLAP];
        }