diff options
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java | 10 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProviderSkylarkConverters.java | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java index ce08f4e05e..d16f80bf64 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java @@ -30,6 +30,7 @@ import com.google.devtools.build.lib.rules.cpp.CppModuleMap; import com.google.devtools.build.lib.rules.cpp.LinkerInputs; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.syntax.ClassObject.SkylarkClassObject; +import com.google.devtools.build.lib.syntax.EvalUtils; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.TargetControl; @@ -612,20 +613,23 @@ public final class ObjcProvider extends SkylarkClassObject implements Transitive } /** - * Adds the given providers from skylark. An error is thrown if toAdd is not an iterable of + * Adds the given providers from skylark. An error is thrown if toAdd is not an iterable of * ObjcProvider instances. */ @SuppressWarnings("unchecked") void addProvidersFromSkylark(Object toAdd) { if (!(toAdd instanceof Iterable)) { throw new IllegalArgumentException( - String.format(AppleSkylarkCommon.BAD_PROVIDERS_ITER_ERROR, toAdd.getClass())); + String.format( + AppleSkylarkCommon.BAD_PROVIDERS_ITER_ERROR, EvalUtils.getDataTypeName(toAdd))); } else { Iterable<Object> toAddIterable = (Iterable<Object>) toAdd; for (Object toAddObject : toAddIterable) { if (!(toAddObject instanceof ObjcProvider)) { throw new IllegalArgumentException( - String.format(AppleSkylarkCommon.BAD_PROVIDERS_ELEM_ERROR, toAddObject.getClass())); + String.format( + AppleSkylarkCommon.BAD_PROVIDERS_ELEM_ERROR, + EvalUtils.getDataTypeName(toAddObject))); } else { this.addTransitiveAndPropagate((ObjcProvider) toAddObject); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProviderSkylarkConverters.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProviderSkylarkConverters.java index 1edf0d8b37..36db3185e5 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProviderSkylarkConverters.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProviderSkylarkConverters.java @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.rules.objc.ObjcProvider.Key; +import com.google.devtools.build.lib.syntax.EvalUtils; import com.google.devtools.build.lib.syntax.SkylarkNestedSet; import com.google.devtools.build.lib.syntax.SkylarkType; import com.google.devtools.build.lib.vfs.PathFragment; @@ -121,14 +122,16 @@ public class ObjcProviderSkylarkConverters { */ private static void validateTypes(Object toCheck, Class<?> expectedSetType, String keyName) { if (!(toCheck instanceof SkylarkNestedSet)) { - throw new IllegalArgumentException(String.format(NOT_SET_ERROR, keyName, toCheck.getClass())); + throw new IllegalArgumentException( + String.format(NOT_SET_ERROR, keyName, EvalUtils.getDataTypeName(toCheck))); } else if (!((SkylarkNestedSet) toCheck).getContentType().canBeCastTo(expectedSetType)) { throw new IllegalArgumentException( String.format( BAD_SET_TYPE_ERROR, keyName, - expectedSetType, - ((SkylarkNestedSet) toCheck).getContentType().getType())); + EvalUtils.getDataTypeNameFromClass(expectedSetType), + EvalUtils.getDataTypeNameFromClass( + ((SkylarkNestedSet) toCheck).getContentType().getType()))); } } } |