Misc cleanups of AST node API

- changed field names and a couple accessors to consistently use full words ("statement" instead of "stmt")

- applied several local analyzers (from IntelliJ) to remove redundant modifiers, unnecessary explicit types (yay Java 8), etc.

RELNOTES: None
PiperOrigin-RevId: 161551096
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
index 3ab4e4d..ab68d65 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
@@ -186,24 +186,24 @@
     }
   }
 
-  @Nullable private final Expression obj;
+  @Nullable private final Expression object;
 
-  private final Identifier func;
+  private final Identifier function;
 
-  private final List<Argument.Passed> args;
+  private final List<Argument.Passed> arguments;
 
   private final int numPositionalArgs;
 
-  public FuncallExpression(@Nullable Expression obj, Identifier func,
-                           List<Argument.Passed> args) {
-    this.obj = obj;
-    this.func = func;
-    this.args = args; // we assume the parser validated it with Argument#validateFuncallArguments()
+  public FuncallExpression(@Nullable Expression object, Identifier function,
+                           List<Argument.Passed> arguments) {
+    this.object = object;
+    this.function = function;
+    this.arguments = arguments;
     this.numPositionalArgs = countPositionalArguments();
   }
 
-  public FuncallExpression(Identifier func, List<Argument.Passed> args) {
-    this(null, func, args);
+  public FuncallExpression(Identifier function, List<Argument.Passed> arguments) {
+    this(null, function, arguments);
   }
 
   /**
@@ -211,7 +211,7 @@
    */
   private int countPositionalArguments() {
     int num = 0;
-    for (Argument.Passed arg : args) {
+    for (Argument.Passed arg : arguments) {
       if (arg.isPositional()) {
         num++;
       }
@@ -223,15 +223,16 @@
    * Returns the function expression.
    */
   public Identifier getFunction() {
-    return func;
+    return function;
   }
 
   /**
    * Returns the object the function called on.
    * It's null if the function is not called on an object.
    */
+  @Nullable
   public Expression getObject() {
-    return obj;
+    return object;
   }
 
   /**
@@ -240,7 +241,7 @@
    * getNumPositionalArguments().
    */
   public List<Argument.Passed> getArguments() {
-    return Collections.unmodifiableList(args);
+    return Collections.unmodifiableList(arguments);
   }
 
   /**
@@ -253,14 +254,14 @@
 
    @Override
    public void prettyPrint(Appendable buffer) throws IOException {
-     if (obj != null) {
-       obj.prettyPrint(buffer);
+     if (object != null) {
+       object.prettyPrint(buffer);
        buffer.append('.');
      }
-     func.prettyPrint(buffer);
+     function.prettyPrint(buffer);
      buffer.append('(');
      String sep = "";
-     for (Argument.Passed arg : args) {
+     for (Argument.Passed arg : arguments) {
        buffer.append(sep);
        arg.prettyPrint(buffer);
        sep = ", ";
@@ -271,11 +272,11 @@
   @Override
   public String toString() {
     Printer.LengthLimitedPrinter printer = new Printer.LengthLimitedPrinter();
-    if (obj != null) {
-      printer.append(obj.toString()).append(".");
+    if (object != null) {
+      printer.append(object.toString()).append(".");
     }
-    printer.append(func.toString());
-    printer.printAbbreviatedList(args, "(", ", ", ")", null,
+    printer.append(function.toString());
+    printer.printAbbreviatedList(arguments, "(", ", ", ")", null,
         Printer.SUGGESTED_CRITICAL_LIST_ELEMENTS_COUNT,
         Printer.SUGGESTED_CRITICAL_LIST_ELEMENTS_STRING_LENGTH);
     return printer.toString();
@@ -374,9 +375,7 @@
           argumentListConversionResult = convertArgumentList(args, kwargs, method);
           if (argumentListConversionResult.getArguments() != null) {
             if (matchingMethod == null) {
-              matchingMethod =
-                  new Pair<MethodDescriptor, List<Object>>(
-                      method, argumentListConversionResult.getArguments());
+              matchingMethod = new Pair<>(method, argumentListConversionResult.getArguments());
             } else {
               throw new EvalException(
                   getLocation(),
@@ -516,7 +515,7 @@
 
   private String formatMethod(List<Object> args, Map<String, Object> kwargs) {
     StringBuilder sb = new StringBuilder();
-    sb.append(func.getName()).append("(");
+    sb.append(function.getName()).append("(");
     boolean first = true;
     for (Object obj : args) {
       if (!first) {
@@ -643,7 +642,7 @@
         positionalArgs = positionals;
       }
       return function.call(
-          positionalArgs, ImmutableMap.<String, Object>copyOf(keyWordArgs), call, env);
+          positionalArgs, ImmutableMap.copyOf(keyWordArgs), call, env);
     } else if (fieldValue != null) {
       if (!(fieldValue instanceof BaseFunction)) {
         throw new EvalException(
@@ -651,10 +650,10 @@
       }
       function = (BaseFunction) fieldValue;
       return function.call(
-          positionalArgs, ImmutableMap.<String, Object>copyOf(keyWordArgs), call, env);
+          positionalArgs, ImmutableMap.copyOf(keyWordArgs), call, env);
     } else {
       // When calling a Java method, the name is not in the Environment,
-      // so evaluating 'func' would fail.
+      // so evaluating 'function' would fail.
       Class<?> objClass;
       Object obj;
       if (value instanceof Class<?>) {
@@ -697,7 +696,7 @@
     // or star arguments, because the argument list was already validated by
     // Argument#validateFuncallArguments, as called by the Parser,
     // which should be the only place that build FuncallExpression-s.
-    for (Argument.Passed arg : args) {
+    for (Argument.Passed arg : arguments) {
       Object value = arg.getValue().eval(env);
       if (arg.isPositional()) {
         posargs.add(value);
@@ -714,7 +713,7 @@
         addKeywordArg(kwargs, arg.getName(), value, duplicates);
       }
     }
-    checkDuplicates(duplicates, func.getName(), getLocation());
+    checkDuplicates(duplicates, function.getName(), getLocation());
   }
 
   @VisibleForTesting
@@ -725,14 +724,14 @@
 
   @Override
   Object doEval(Environment env) throws EvalException, InterruptedException {
-    return (obj != null) ? invokeObjectMethod(env) : invokeGlobalFunction(env);
+    return (object != null) ? invokeObjectMethod(env) : invokeGlobalFunction(env);
   }
 
   /**
-   * Invokes obj.func() and returns the result.
+   * Invokes object.function() and returns the result.
    */
   private Object invokeObjectMethod(Environment env) throws EvalException, InterruptedException {
-    Object objValue = obj.eval(env);
+    Object objValue = object.eval(env);
     ImmutableList.Builder<Object> posargs = new ImmutableList.Builder<>();
     posargs.add(objValue);
     // We copy this into an ImmutableMap in the end, but we can't use an ImmutableMap.Builder, or
@@ -740,14 +739,14 @@
     Map<String, Object> kwargs = new LinkedHashMap<>();
     evalArguments(posargs, kwargs, env);
     return invokeObjectMethod(
-        func.getName(), posargs.build(), ImmutableMap.<String, Object>copyOf(kwargs), this, env);
+        function.getName(), posargs.build(), ImmutableMap.copyOf(kwargs), this, env);
   }
 
   /**
-   * Invokes func() and returns the result.
+   * Invokes function() and returns the result.
    */
   private Object invokeGlobalFunction(Environment env) throws EvalException, InterruptedException {
-    Object funcValue = func.eval(env);
+    Object funcValue = function.eval(env);
     return callFunction(funcValue, env);
   }
 
@@ -771,7 +770,7 @@
    */
   @Nullable
   public String getNameArg() {
-    for (Argument.Passed arg : args) {
+    for (Argument.Passed arg : arguments) {
       if (arg != null) {
         String name = arg.getName();
         if (name != null && name.equals("name")) {
@@ -790,12 +789,12 @@
 
   @Override
   void validate(ValidationEnvironment env) throws EvalException {
-    if (obj != null) {
-      obj.validate(env);
+    if (object != null) {
+      object.validate(env);
     } else {
-      func.validate(env);
+      function.validate(env);
     }
-    for (Argument.Passed arg : args) {
+    for (Argument.Passed arg : arguments) {
       arg.getValue().validate(env);
     }
   }