Skip to content

Commit

Permalink
Merge branch 'main' into minor-code-simp
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh authored Nov 11, 2021
2 parents 4c06968 + d1bb7bd commit ff9335d
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,20 @@ static Expr createDefaultValueResourceHelper(
resourceName = findParentResource(resourceName, resnames).orElse(resourceName);
}

boolean hasOnePattern = resourceName.patterns().size() == 1;
if (resourceName.isOnlyWildcard()) {
List<ResourceName> unexaminedResnames = new ArrayList<>(resnames);
for (ResourceName resname : resnames) {
if (resname.isOnlyWildcard()) {
unexaminedResnames.remove(resname);
continue;
}
unexaminedResnames.remove(resname);
return createDefaultValue(resname, false, unexaminedResnames, fieldOrMessageName);
if (!resname.isOnlyWildcard()) {
return createDefaultValue(resname, false, unexaminedResnames, fieldOrMessageName);
}
}

if (unexaminedResnames.isEmpty()) {
return allowAnonResourceNameClass
? createAnonymousResourceNameClass(fieldOrMessageName)
: ValueExpr.withValue(
StringObjectValue.withValue(
String.format("%s%s", fieldOrMessageName, fieldOrMessageName.hashCode())));
}
return allowAnonResourceNameClass
? createAnonymousResourceNameClass(fieldOrMessageName)
: ValueExpr.withValue(
StringObjectValue.withValue(
String.format("%s%s", fieldOrMessageName, fieldOrMessageName.hashCode())));
}

// The cost tradeoffs of new ctors versus distinct() don't really matter here, since this list
Expand All @@ -261,6 +256,7 @@ static Expr createDefaultValueResourceHelper(
}
}

boolean hasOnePattern = resourceName.patterns().size() == 1;
if (!hasOnePattern) {
ofMethodName =
String.format(
Expand Down

0 comments on commit ff9335d

Please sign in to comment.