Automatic code cleanup.
PiperOrigin-RevId: 220636130
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
index bfdc795..0d423ed 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
@@ -246,26 +246,6 @@
super.configure(annotation);
}
- // finds the method and makes it accessible (which is needed to find it, and later to use it)
- protected Method findMethod(final String name) {
- Method found = null;
- for (Method method : this.getClass().getDeclaredMethods()) {
- method.setAccessible(true);
- if (name.equals(method.getName())) {
- if (found != null) {
- throw new IllegalArgumentException(String.format(
- "function %s has more than one method named %s", getName(), name));
- }
- found = method;
- }
- }
- if (found == null) {
- throw new NoSuchElementException(String.format(
- "function %s doesn't have a method named %s", getName(), name));
- }
- return found;
- }
-
/** Configure the reflection mechanism */
@Override
protected void configure() {
@@ -279,9 +259,7 @@
throw new IllegalStateException(
String.format(
"bad argument count for %s: method has %s arguments, type list has %s",
- getName(),
- innerArgumentCount,
- parameterTypes.length));
+ getName(), innerArgumentCount, parameterTypes.length));
}
if (enforcedArgumentTypes != null) {
@@ -289,14 +267,18 @@
SkylarkType enforcedType = enforcedArgumentTypes.get(i);
if (enforcedType != null) {
Class<?> parameterType = parameterTypes[i];
- String msg = String.format(
- "fun %s(%s), param %s, enforcedType: %s (%s); parameterType: %s",
- getName(), signature, signature.getSignature().getNames().get(i),
- enforcedType, enforcedType.getType(), parameterType);
+ String msg =
+ String.format(
+ "fun %s(%s), param %s, enforcedType: %s (%s); parameterType: %s",
+ getName(),
+ signature,
+ signature.getSignature().getNames().get(i),
+ enforcedType,
+ enforcedType.getType(),
+ parameterType);
if (enforcedType instanceof SkylarkType.Simple
|| enforcedType instanceof SkylarkFunctionType) {
- Preconditions.checkArgument(
- enforcedType.getType() == parameterType, msg);
+ Preconditions.checkArgument(enforcedType.getType() == parameterType, msg);
// No need to enforce Simple types on the Skylark side, the JVM will do it for us.
enforcedArgumentTypes.set(i, null);
} else if (enforcedType instanceof SkylarkType.Combination) {
@@ -314,9 +296,12 @@
if (returnType != null) {
Class<?> type = returnType;
Class<?> methodReturnType = invokeMethod.getReturnType();
- Preconditions.checkArgument(type == methodReturnType,
+ Preconditions.checkArgument(
+ type == methodReturnType,
"signature for function %s says it returns %s but its invoke method returns %s",
- getName(), returnType, methodReturnType);
+ getName(),
+ returnType,
+ methodReturnType);
}
}
@@ -326,8 +311,8 @@
public void configure(BuiltinFunction.Factory factory) {
// this function must not be configured yet, but the factory must be
Preconditions.checkState(!isConfigured());
- Preconditions.checkState(factory.isConfigured(),
- "function factory is not configured for %s", getName());
+ Preconditions.checkState(
+ factory.isConfigured(), "function factory is not configured for %s", getName());
this.paramDoc = factory.getParamDoc();
this.signature = factory.getSignature();
@@ -336,6 +321,26 @@
configure();
}
+ // finds the method and makes it accessible (which is needed to find it, and later to use it)
+ protected Method findMethod(final String name) {
+ Method found = null;
+ for (Method method : this.getClass().getDeclaredMethods()) {
+ method.setAccessible(true);
+ if (name.equals(method.getName())) {
+ if (found != null) {
+ throw new IllegalArgumentException(
+ String.format("function %s has more than one method named %s", getName(), name));
+ }
+ found = method;
+ }
+ }
+ if (found == null) {
+ throw new NoSuchElementException(
+ String.format("function %s doesn't have a method named %s", getName(), name));
+ }
+ return found;
+ }
+
/**
* A Factory allows for a @SkylarkSignature annotation to be provided and processed in advance
* for a function that will be defined later as a closure (see e.g. in PackageFactory).