Example #1
0
  public static void main(String[] args) throws Exception {
    CommandLineOptionHelper helper = new CommandLineOptionHelper(args);
    GridRole role = GridRole.find(args);

    if (role == null) {
      printInfoAboutRoles(helper);
      return;
    }

    if (helper.isParamPresent("-help") || helper.isParamPresent("-h")) {
      if (launchers.containsKey(role)) {
        launchers.get(role).printUsage();
      } else {
        printInfoAboutRoles(helper);
      }
      return;
    }

    configureLogging(helper);

    if (launchers.containsKey(role)) {
      try {
        launchers.get(role).launch(args, log);
      } catch (Exception e) {
        launchers.get(role).printUsage();
        e.printStackTrace();
      }
    } else {
      throw new GridConfigurationException("Unknown role: " + role);
    }
  }
    public Optional<Long> getArtifactSizeBytes() {
      if (eventInfo.containsKey(ARTIFACT_SIZE_BYTES_KEY)) {
        return Optional.of((long) eventInfo.get(ARTIFACT_SIZE_BYTES_KEY));
      }

      return Optional.absent();
    }
 /**
  * Produces a factory that allows the union of the grants, and intersects policies where they
  * overlap on a particular granted attribute or element name.
  */
 public PolicyFactory and(PolicyFactory f) {
   ImmutableMap.Builder<String, ElementAndAttributePolicies> b = ImmutableMap.builder();
   // Merge this and f into a map of element names to attribute policies.
   for (Map.Entry<String, ElementAndAttributePolicies> e : policies.entrySet()) {
     String elName = e.getKey();
     ElementAndAttributePolicies p = e.getValue();
     ElementAndAttributePolicies q = f.policies.get(elName);
     if (q != null) {
       p = p.and(q);
     } else {
       // Mix in any globals that are not already taken into account in this.
       p = p.andGlobals(f.globalAttrPolicies);
     }
     b.put(elName, p);
   }
   // Handle keys that are in f but not in this.
   for (Map.Entry<String, ElementAndAttributePolicies> e : f.policies.entrySet()) {
     String elName = e.getKey();
     if (!policies.containsKey(elName)) {
       ElementAndAttributePolicies p = e.getValue();
       // Mix in any globals that are not already taken into account in this.
       p = p.andGlobals(f.globalAttrPolicies);
       b.put(elName, p);
     }
   }
   ImmutableSet<String> textContainers;
   if (this.textContainers.containsAll(f.textContainers)) {
     textContainers = this.textContainers;
   } else if (f.textContainers.containsAll(this.textContainers)) {
     textContainers = f.textContainers;
   } else {
     textContainers =
         ImmutableSet.<String>builder()
             .addAll(this.textContainers)
             .addAll(f.textContainers)
             .build();
   }
   ImmutableMap<String, AttributePolicy> allGlobalAttrPolicies;
   if (f.globalAttrPolicies.isEmpty()) {
     allGlobalAttrPolicies = this.globalAttrPolicies;
   } else if (this.globalAttrPolicies.isEmpty()) {
     allGlobalAttrPolicies = f.globalAttrPolicies;
   } else {
     ImmutableMap.Builder<String, AttributePolicy> ab = ImmutableMap.builder();
     for (Map.Entry<String, AttributePolicy> e : this.globalAttrPolicies.entrySet()) {
       String attrName = e.getKey();
       ab.put(
           attrName, AttributePolicy.Util.join(e.getValue(), f.globalAttrPolicies.get(attrName)));
     }
     for (Map.Entry<String, AttributePolicy> e : f.globalAttrPolicies.entrySet()) {
       String attrName = e.getKey();
       if (!this.globalAttrPolicies.containsKey(attrName)) {
         ab.put(attrName, e.getValue());
       }
     }
     allGlobalAttrPolicies = ab.build();
   }
   return new PolicyFactory(b.build(), textContainers, allGlobalAttrPolicies);
 }
Example #4
0
  private Call.DisconnectCause translateDisconnectCauseFromTelephony(
      Connection.DisconnectCause causeSource) {

    if (CAUSE_MAP.containsKey(causeSource)) {
      return CAUSE_MAP.get(causeSource);
    }

    return Call.DisconnectCause.UNKNOWN;
  }
  @Nullable
  @Override
  public SkyValue compute(SkyKey skyKey, Environment env)
      throws SkyFunctionException, InterruptedException {
    ImmutableMap<Action, ConflictException> badActions = PrecomputedValue.BAD_ACTIONS.get(env);
    ConfiguredTargetValue ctValue =
        (ConfiguredTargetValue)
            env.getValue(ConfiguredTargetValue.key((ConfiguredTargetKey) skyKey.argument()));
    SkyframeDependencyResolver resolver =
        buildViewProvider.getSkyframeBuildView().createDependencyResolver(env);
    if (env.valuesMissing()) {
      return null;
    }

    for (Action action : ctValue.getActions()) {
      if (badActions.containsKey(action)) {
        throw new ActionConflictFunctionException(badActions.get(action));
      }
    }

    ConfiguredTarget ct = ctValue.getConfiguredTarget();
    TargetAndConfiguration ctgValue =
        new TargetAndConfiguration(ct.getTarget(), ct.getConfiguration());

    Set<ConfigMatchingProvider> configConditions =
        getConfigurableAttributeConditions(ctgValue, env);
    if (configConditions == null) {
      return null;
    }

    ListMultimap<Attribute, Dependency> deps;
    try {
      BuildConfiguration hostConfiguration =
          buildViewProvider.getSkyframeBuildView().getHostConfiguration(ct.getConfiguration());
      deps =
          resolver.dependentNodeMap(
              ctgValue, hostConfiguration, /*aspect=*/ null, configConditions);
      if (ct.getConfiguration() != null && ct.getConfiguration().useDynamicConfigurations()) {
        deps =
            ConfiguredTargetFunction.trimConfigurations(
                env, ctgValue, deps, hostConfiguration, ruleClassProvider);
      }
    } catch (EvalException e) {
      throw new PostConfiguredTargetFunctionException(e);
    } catch (ConfiguredTargetFunction.DependencyEvaluationException e) {
      throw new PostConfiguredTargetFunctionException(e);
    }

    env.getValues(Iterables.transform(deps.values(), TO_KEYS));
    if (env.valuesMissing()) {
      return null;
    }

    return new PostConfiguredTargetValue(ct);
  }
Example #6
0
  @Test
  public void testCollectionInitial() {
    ImmutableMap<Integer, Integer> of = ImmutableMap.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    Assert.assertTrue(of.containsKey(1));

    ArrayList<Integer> arrayList = Lists.newArrayList(1, 2, 3, 4);
    Assert.assertTrue(arrayList.contains(1));

    HashSet<Integer> hashSet = Sets.newHashSet(1, 2);
    Assert.assertTrue(hashSet.contains(1));
  }
Example #7
0
 static ImmutableMap<String, String> withDefaults(
     ImmutableMap<String, String> map, ImmutableMap<String, String> defaults) {
   ImmutableMap.Builder<String, String> builder =
       ImmutableMap.<String, String>builder().putAll(map);
   for (ImmutableMap.Entry<String, String> entry : defaults.entrySet()) {
     if (!map.containsKey(entry.getKey())) {
       builder = builder.put(entry.getKey(), entry.getValue());
     }
   }
   return builder.build();
 }
Example #8
0
 /**
  * @return the feature with the given {@code name}.
  * @throws InvalidConfigurationException if no feature with the given name was configured.
  */
 private Feature getFeatureOrFail(String name, String reference)
     throws InvalidConfigurationException {
   if (!featuresByName.containsKey(name)) {
     throw new InvalidConfigurationException(
         "Invalid toolchain configuration: feature '"
             + name
             + "', which is referenced from feature '"
             + reference
             + "', is not defined.");
   }
   return featuresByName.get(name);
 }
 public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part) {
   if (part.isPresent()) {
     if (part.get() instanceof MultiModelPart) {
       MultiModelPart key = (MultiModelPart) part.get();
       if (states.containsKey(key)) {
         return Optional.of(
             states
                 .get(key)
                 .apply(Optional.<IModelPart>absent())
                 .or(TRSRTransformation.identity()));
       }
     } else if (part.get() instanceof PartPart) {
       PartPart partPart = (PartPart) part.get();
       MultiModelPart key = new MultiModelPart(partPart.model, partPart.index);
       if (states.containsKey(key)) {
         return states.get(key).apply(partPart.part);
       }
     }
   }
   return Optional.absent();
 }
Example #10
0
 /**
  * Calls {@code expand} on the {@code consumer} for each expansion of the {@code consumer}'s
  * used variable set.
  *
  * <p>The {@code consumer}'s used variable set must contain at most one variable of sequence
  * type; additionally, all of the used variables must be available in the current variable
  * configuration. If any of the preconditions are violated, throws an {@code
  * ExpansionException}.
  */
 void forEachExpansion(ExpansionConsumer consumer) {
   Map<String, String> variableView = new HashMap<>();
   String sequenceName = null;
   for (String name : consumer.getUsedVariables()) {
     if (sequenceVariables.containsKey(name)) {
       if (variables.containsKey(name)) {
         throw new ExpansionException(
             "Internal error: variable '"
                 + name
                 + "' provided both as sequence and standard variable.");
       } else if (sequenceName != null) {
         throw new ExpansionException(
             "Invalid toolchain configuration: trying to expand two variable list in one "
                 + "flag group: '"
                 + sequenceName
                 + "' and '"
                 + name
                 + "'");
       } else {
         sequenceName = name;
       }
     } else if (variables.containsKey(name)) {
       variableView.put(name, variables.get(name));
     } else {
       throw new ExpansionException(
           "Invalid toolchain configuration: unknown variable '"
               + name
               + "' can not be expanded.");
     }
   }
   if (sequenceName != null) {
     for (String value : sequenceVariables.get(sequenceName)) {
       variableView.put(sequenceName, value);
       consumer.expand(variableView);
     }
   } else {
     consumer.expand(variableView);
   }
 }
 private String mathParse(String plainText) {
   String parsedText = plainText;
   if (!TextUtils.isEmpty(parsedText)) {
     // Initialize replacement table.
     initializeReplacementTable();
     for (String operator : sOperators) {
       if (sReplacementTable.containsKey(operator)) {
         parsedText = parsedText.replace(operator, sReplacementTable.get(operator));
       }
     }
   }
   return parsedText;
 }
Example #12
0
  private void markClassTrulyMutable(String className) {
    if (trulyMutableClasses.contains(className)) {
      return;
    }
    if (!allClasses.containsKey(className)) {
      throw new RuntimeException("Tried to mark external class '" + className + "' truly mutable");
    }

    trulyMutableClasses.add(className);
    madeProgress = true;

    markClassAsHavingMutableDescendents(className);
  }
Example #13
0
  @Override
  public ModelFluid process(ImmutableMap<String, String> customData) {
    if (!customData.containsKey("fluid")) return this;

    String fluidStr = customData.get("fluid");
    JsonElement e = new JsonParser().parse(fluidStr);
    String fluid = e.getAsString();
    if (!FluidRegistry.isFluidRegistered(fluid)) {
      FMLLog.severe("fluid '%s' not found", fluid);
      return WATER;
    }
    return new ModelFluid(FluidRegistry.getFluid(fluid));
  }
Example #14
0
 private boolean superClassIsDefinitelyMutable(String superClassName) {
   if (trulyMutableClasses.contains(superClassName)) {
     return true;
   }
   if (EXTERNAL_IMMUTABLE_BASE_CLASSES.contains(superClassName)) {
     return false;
   }
   if (!allClasses.containsKey(superClassName)) {
     // All external classes are assumed to be mutable unless whitelisted.
     return true;
   }
   // Assume internal classes are immutable until proven otherwise (in later rounds).
   return false;
 }
 @RequiresNonNull("sessionAttributeUpdatedValueMap")
 private void addMidRequestSessionAttributeDetail(Map<String, Object> detail) {
   Map<String, /*@Nullable*/ Object> sessionAttributeInitialValuePlusMap = Maps.newHashMap();
   sessionAttributeInitialValuePlusMap.putAll(sessionAttributeInitialValueMap);
   // add empty values into initial values for any updated attributes that are not
   // already present in initial values nested detail map
   for (Entry<String, Optional<String>> entry : sessionAttributeUpdatedValueMap.entrySet()) {
     if (!sessionAttributeInitialValueMap.containsKey(entry.getKey())) {
       sessionAttributeInitialValuePlusMap.put(entry.getKey(), null);
     }
   }
   detail.put(
       "Session attributes (at beginning of this request)", sessionAttributeInitialValuePlusMap);
   detail.put("Session attributes (updated during this request)", sessionAttributeUpdatedValueMap);
 }
Example #16
0
  public static double pValue(final double chiSquare, final int degreesOfFreedom) {
    checkArgument(
        CHI_SQUARE_DISTRIBUTION.containsKey(degreesOfFreedom),
        "degreesOfFreedom must be a key in CHI_SQUARE_DISTRIBUTION table");

    final double[] chiSquares = CHI_SQUARE_DISTRIBUTION.get(degreesOfFreedom);

    checkNotNull(chiSquares, "chiSquares");

    for (int index = 0; index < chiSquares.length; index++) {

      if (chiSquares[index] > chiSquare) {
        return P_VALUES[index];
      }
    }

    return P_VALUES[P_VALUES.length - 1];
  }
    /**
     * Perform the merging and return the result.
     *
     * @return an instance of {@link com.android.manifmerger.MergingReport} that will give access to
     *     all the logging and merging records.
     *     <p>This method can be invoked several time and will re-do the file merges.
     * @throws com.android.manifmerger.ManifestMerger2.MergeFailureException if the merging cannot
     *     be completed successfully.
     */
    public MergingReport merge() throws MergeFailureException {

      // provide some free placeholders values.
      ImmutableMap<SystemProperty, Object> systemProperties = mSystemProperties.build();
      if (systemProperties.containsKey(SystemProperty.PACKAGE)) {
        mPlaceHolders.put(PACKAGE_NAME, systemProperties.get(SystemProperty.PACKAGE));
        mPlaceHolders.put(APPLICATION_ID, systemProperties.get(SystemProperty.PACKAGE));
      }

      ManifestMerger2 manifestMerger =
          new ManifestMerger2(
              mLogger,
              mMainManifestFile,
              mLibraryFilesBuilder.build(),
              mFlavorsAndBuildTypeFiles.build(),
              mFeaturesBuilder.build(),
              mPlaceHolders.build(),
              new MapBasedKeyBasedValueResolver<SystemProperty>(systemProperties),
              mMergeType,
              Optional.fromNullable(mReportFile));
      return manifestMerger.merge();
    }
Example #18
0
 @Override
 public String renderNodeXhtml(Node node) {
   if (NodeUtils.isEmptyNode(node)) {
     return "";
   }
   StringBuilder ret = new StringBuilder();
   if (node.isParameter()) {
     String lang = node.getParameter().trim();
     if (langHash.containsKey(lang)) {
       ret.append("<div class=\"code\"><pre class=\"")
           .append(langHash.get(lang))
           .append("\"><code>");
     } else {
       ret.append("<div class=\"code\"><pre class=\"no-highlight\"><code>");
     }
   } else {
     ret.append("<div class=\"code\"><pre class=\"no-highlight\"><code>");
   }
   ret.append(node.renderChildrenXHtml());
   ret.append("</code></pre></div>");
   return ret.toString();
 }
  @Override
  protected void masterOperation(
      final TypesExistsRequest request,
      final ClusterState state,
      final ActionListener<TypesExistsResponse> listener)
      throws ElasticSearchException {
    String[] concreteIndices =
        state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), false);
    if (concreteIndices.length == 0) {
      listener.onResponse(new TypesExistsResponse(false));
      return;
    }

    for (String concreteIndex : concreteIndices) {
      if (!state.metaData().hasConcreteIndex(concreteIndex)) {
        listener.onResponse(new TypesExistsResponse(false));
        return;
      }

      ImmutableMap<String, MappingMetaData> mappings =
          state.metaData().getIndices().get(concreteIndex).mappings();
      if (mappings.isEmpty()) {
        listener.onResponse(new TypesExistsResponse(false));
        return;
      }

      for (String type : request.types()) {
        if (!mappings.containsKey(type)) {
          listener.onResponse(new TypesExistsResponse(false));
          return;
        }
      }
    }

    listener.onResponse(new TypesExistsResponse(true));
  }
Example #20
0
 public boolean has(String lang) {
   return vals.containsKey(lang);
 }
Example #21
0
 @Override
 public String explain(ESQuery esQuery) {
   return QUERY_RESULTS_MAP.containsKey(esQuery.getQuery()) ? "{}" : null;
 }
 public boolean nodeExists(String nodeId) {
   return nodes.containsKey(nodeId);
 }
Example #23
0
 public boolean hasMapping(String mappingType) {
   return mappers.containsKey(mappingType);
 }
Example #24
0
 protected String getAntPropertyName(String fieldName) {
   if (FIELD_NAMES_TO_ANT_PROPERTIES.containsKey(fieldName)) {
     return FIELD_NAMES_TO_ANT_PROPERTIES.get(fieldName);
   }
   return fieldName;
 }
 private void addCompoundSortField(
     XContentParser parser, SearchContext context, List<SortField> sortFields) throws Exception {
   XContentParser.Token token;
   while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
     if (token == XContentParser.Token.FIELD_NAME) {
       String fieldName = parser.currentName();
       boolean reverse = false;
       String missing = null;
       String innerJsonName = null;
       boolean ignoreUnmapped = false;
       SortMode sortMode = null;
       Filter nestedFilter = null;
       String nestedPath = null;
       token = parser.nextToken();
       if (token == XContentParser.Token.VALUE_STRING) {
         String direction = parser.text();
         if (direction.equals("asc")) {
           reverse = SCORE_FIELD_NAME.equals(fieldName);
         } else if (direction.equals("desc")) {
           reverse = !SCORE_FIELD_NAME.equals(fieldName);
         } else {
           throw new ElasticSearchIllegalArgumentException(
               "sort direction [" + fieldName + "] not supported");
         }
         addSortField(
             context,
             sortFields,
             fieldName,
             reverse,
             ignoreUnmapped,
             missing,
             sortMode,
             nestedPath,
             nestedFilter);
       } else {
         if (parsers.containsKey(fieldName)) {
           sortFields.add(parsers.get(fieldName).parse(parser, context));
         } else {
           while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
             if (token == XContentParser.Token.FIELD_NAME) {
               innerJsonName = parser.currentName();
             } else if (token.isValue()) {
               if ("reverse".equals(innerJsonName)) {
                 reverse = parser.booleanValue();
               } else if ("order".equals(innerJsonName)) {
                 if ("asc".equals(parser.text())) {
                   reverse = SCORE_FIELD_NAME.equals(fieldName);
                 } else if ("desc".equals(parser.text())) {
                   reverse = !SCORE_FIELD_NAME.equals(fieldName);
                 }
               } else if ("missing".equals(innerJsonName)) {
                 missing = parser.textOrNull();
               } else if ("ignore_unmapped".equals(innerJsonName)
                   || "ignoreUnmapped".equals(innerJsonName)) {
                 ignoreUnmapped = parser.booleanValue();
               } else if ("sort_mode".equals(innerJsonName)
                   || "sortMode".equals(innerJsonName)
                   || "mode".equals(innerJsonName)) {
                 sortMode = SortMode.fromString(parser.text());
               } else if ("nested_path".equals(innerJsonName)
                   || "nestedPath".equals(innerJsonName)) {
                 nestedPath = parser.text();
               } else {
                 throw new ElasticSearchIllegalArgumentException(
                     "sort option [" + innerJsonName + "] not supported");
               }
             } else if (token == XContentParser.Token.START_OBJECT) {
               if ("nested_filter".equals(innerJsonName) || "nestedFilter".equals(innerJsonName)) {
                 nestedFilter = context.queryParserService().parseInnerFilter(parser);
               } else {
                 throw new ElasticSearchIllegalArgumentException(
                     "sort option [" + innerJsonName + "] not supported");
               }
             }
           }
           addSortField(
               context,
               sortFields,
               fieldName,
               reverse,
               ignoreUnmapped,
               missing,
               sortMode,
               nestedPath,
               nestedFilter);
         }
       }
     }
   }
 }
 public boolean has(String param) {
   return params.containsKey(param);
 }
 /**
  * @param key
  * @return true if the property exists.
  */
 public boolean hasProperty(String key) {
   if (updatedContent.containsKey(key)) {
     return !(updatedContent.get(key) instanceof RemoveProperty);
   }
   return content.containsKey(key) && !(content.get(key) instanceof RemoveProperty);
 }
Example #28
0
  /**
   * Takes a map of directory fragments to root paths, and creates a symlink forest under an
   * existing linkRoot to the corresponding source dirs or files. Symlink are made at the highest
   * dir possible, linking files directly only when needed with nested packages.
   */
  public static void plantLinkForest(ImmutableMap<PathFragment, Path> packageRootMap, Path linkRoot)
      throws IOException {
    Path emptyPackagePath = null;

    // Create a sorted map of all dirs (packages and their ancestors) to sets of their roots.
    // Packages come from exactly one root, but their shared ancestors may come from more.
    // The map is maintained sorted lexicographically, so parents are before their children.
    Map<PathFragment, Set<Path>> dirRootsMap = Maps.newTreeMap();
    for (Map.Entry<PathFragment, Path> entry : packageRootMap.entrySet()) {
      PathFragment pkgDir = entry.getKey();
      Path pkgRoot = entry.getValue();
      if (pkgDir.segmentCount() == 0) {
        emptyPackagePath = entry.getValue();
      }
      for (int i = 1; i <= pkgDir.segmentCount(); i++) {
        PathFragment dir = pkgDir.subFragment(0, i);
        Set<Path> roots = dirRootsMap.get(dir);
        if (roots == null) {
          roots = Sets.newHashSet();
          dirRootsMap.put(dir, roots);
        }
        roots.add(pkgRoot);
      }
    }
    // Now add in roots for all non-pkg dirs that are in between two packages, and missed above.
    for (Map.Entry<PathFragment, Set<Path>> entry : dirRootsMap.entrySet()) {
      PathFragment dir = entry.getKey();
      if (!packageRootMap.containsKey(dir)) {
        PathFragment pkgDir = longestPathPrefix(dir, packageRootMap.keySet());
        if (pkgDir != null) {
          entry.getValue().add(packageRootMap.get(pkgDir));
        }
      }
    }
    // Create output dirs for all dirs that have more than one root and need to be split.
    for (Map.Entry<PathFragment, Set<Path>> entry : dirRootsMap.entrySet()) {
      PathFragment dir = entry.getKey();
      if (entry.getValue().size() > 1) {
        if (LOG_FINER) {
          LOG.finer("mkdir " + linkRoot.getRelative(dir));
        }
        createDirectoryAndParents(linkRoot.getRelative(dir));
      }
    }
    // Make dir links for single rooted dirs.
    for (Map.Entry<PathFragment, Set<Path>> entry : dirRootsMap.entrySet()) {
      PathFragment dir = entry.getKey();
      Set<Path> roots = entry.getValue();
      // Simple case of one root for this dir.
      if (roots.size() == 1) {
        if (dir.segmentCount() > 1 && dirRootsMap.get(dir.getParentDirectory()).size() == 1) {
          continue; // skip--an ancestor will link this one in from above
        }
        // This is the top-most dir that can be linked to a single root. Make it so.
        Path root = roots.iterator().next(); // lone root in set
        if (LOG_FINER) {
          LOG.finer("ln -s " + root.getRelative(dir) + " " + linkRoot.getRelative(dir));
        }
        linkRoot.getRelative(dir).createSymbolicLink(root.getRelative(dir));
      }
    }
    // Make links for dirs within packages, skip parent-only dirs.
    for (Map.Entry<PathFragment, Set<Path>> entry : dirRootsMap.entrySet()) {
      PathFragment dir = entry.getKey();
      if (entry.getValue().size() > 1) {
        // If this dir is at or below a package dir, link in its contents.
        PathFragment pkgDir = longestPathPrefix(dir, packageRootMap.keySet());
        if (pkgDir != null) {
          Path root = packageRootMap.get(pkgDir);
          try {
            Path absdir = root.getRelative(dir);
            if (absdir.isDirectory()) {
              if (LOG_FINER) {
                LOG.finer("ln -s " + absdir + "/* " + linkRoot.getRelative(dir) + "/");
              }
              for (Path target : absdir.getDirectoryEntries()) {
                PathFragment p = target.relativeTo(root);
                if (!dirRootsMap.containsKey(p)) {
                  // LOG.finest("ln -s " + target + " " + linkRoot.getRelative(p));
                  linkRoot.getRelative(p).createSymbolicLink(target);
                }
              }
            } else {
              LOG.fine("Symlink planting skipping dir '" + absdir + "'");
            }
          } catch (IOException e) {
            e.printStackTrace();
          }
          // Otherwise its just an otherwise empty common parent dir.
        }
      }
    }

    if (emptyPackagePath != null) {
      // For the top-level directory, generate symlinks to everything in the directory instead of
      // the directory itself.
      for (Path target : emptyPackagePath.getDirectoryEntries()) {
        String baseName = target.getBaseName();
        // Create any links that don't exist yet and don't start with bazel-.
        if (!baseName.startsWith(Constants.PRODUCT_NAME + "-")
            && !linkRoot.getRelative(baseName).exists()) {
          linkRoot.getRelative(baseName).createSymbolicLink(target);
        }
      }
    }
  }
 @Override
 public boolean containsKey(@Nullable Object key) {
   return delegate.containsKey(key);
 }