http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/plus/src/main/java/org/apache/calcite/chinook/EnvironmentFairy.java
----------------------------------------------------------------------
diff --git 
a/plus/src/main/java/org/apache/calcite/chinook/EnvironmentFairy.java 
b/plus/src/main/java/org/apache/calcite/chinook/EnvironmentFairy.java
index 34c005f..4896512 100644
--- a/plus/src/main/java/org/apache/calcite/chinook/EnvironmentFairy.java
+++ b/plus/src/main/java/org/apache/calcite/chinook/EnvironmentFairy.java
@@ -26,11 +26,8 @@ package org.apache.calcite.chinook;
  */
 public class EnvironmentFairy {
 
-  private static final ThreadLocal<User> USER = new ThreadLocal<User>() {
-    @Override protected User initialValue() {
-      return User.ADMIN;
-    }
-  };
+  private static final ThreadLocal<User> USER =
+      ThreadLocal.withInitial(() -> User.ADMIN);
 
   private EnvironmentFairy() {
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
----------------------------------------------------------------------
diff --git 
a/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java 
b/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
index 50e80b7..a2d7f78 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/os/OsAdapterTest.java
@@ -24,23 +24,20 @@ import org.apache.calcite.test.CalciteAssert;
 import org.apache.calcite.util.Holder;
 import org.apache.calcite.util.Util;
 
-import com.google.common.base.Function;
-
 import org.hamcrest.CoreMatchers;
 import org.junit.Assume;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.nio.charset.StandardCharsets;
-import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.function.Consumer;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
@@ -76,12 +73,7 @@ public class OsAdapterTest {
         return false; // abandon hope
       }
       File[] files =
-          f.listFiles(
-              new FilenameFilter() {
-                public boolean accept(File dir, String name) {
-                  return name.equals(".git");
-                }
-              });
+          f.listFiles((dir, name) -> name.equals(".git"));
       if (files != null && files.length == 1) {
         return true; // there is a ".git" subdirectory
       }
@@ -93,20 +85,16 @@ public class OsAdapterTest {
     Assume.assumeFalse("Skip: the 'du' table does not work on Windows",
         isWindows());
     sql("select * from du")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  assertThat(r.getInt(1), notNullValue());
-                  assertThat(r.getString(2), CoreMatchers.startsWith("./"));
-                  assertThat(r.wasNull(), is(false));
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            assertThat(r.getInt(1), notNullValue());
+            assertThat(r.getString(2), CoreMatchers.startsWith("./"));
+            assertThat(r.wasNull(), is(false));
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testDuFilterSortLimit() {
@@ -114,22 +102,18 @@ public class OsAdapterTest {
         isWindows());
     sql("select * from du where path like '%/src/test/java/%'\n"
         + "order by 1 limit 2")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  assertThat(r.getInt(1), notNullValue());
-                  assertThat(r.getString(2), CoreMatchers.startsWith("./"));
-                  assertThat(r.wasNull(), is(false));
-                  assertThat(r.next(), is(true));
-                  assertThat(r.next(), is(false)); // because of "limit 2"
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            assertThat(r.getInt(1), notNullValue());
+            assertThat(r.getString(2), CoreMatchers.startsWith("./"));
+            assertThat(r.wasNull(), is(false));
+            assertThat(r.next(), is(true));
+            assertThat(r.next(), is(false)); // because of "limit 2"
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testFiles() {
@@ -144,61 +128,49 @@ public class OsAdapterTest {
     Assume.assumeFalse("Skip: the 'ps' table does not work on Windows",
         isWindows());
     sql("select * from ps")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  final StringBuilder b = new StringBuilder();
-                  final int c = r.getMetaData().getColumnCount();
-                  for (int i = 0; i < c; i++) {
-                    b.append(r.getString(i + 1)).append(';');
-                    assertThat(r.wasNull(), is(false));
-                  }
-                  assertThat(b.toString(), notNullValue());
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            final StringBuilder b = new StringBuilder();
+            final int c = r.getMetaData().getColumnCount();
+            for (int i = 0; i < c; i++) {
+              b.append(r.getString(i + 1)).append(';');
+              assertThat(r.wasNull(), is(false));
+            }
+            assertThat(b.toString(), notNullValue());
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testPsDistinct() {
     Assume.assumeFalse("Skip: the 'ps' table does not work on Windows",
         isWindows());
     sql("select distinct `user` from ps")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  assertThat(r.getString(1), notNullValue());
-                  assertThat(r.wasNull(), is(false));
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            assertThat(r.getString(1), notNullValue());
+            assertThat(r.wasNull(), is(false));
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testGitCommits() {
     Assume.assumeTrue("no git", hasGit());
     sql("select count(*) from git_commits")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  assertThat(r.getString(1), notNullValue());
-                  assertThat(r.wasNull(), is(false));
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            assertThat(r.getString(1), notNullValue());
+            assertThat(r.wasNull(), is(false));
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testGitCommitsTop() {
@@ -213,39 +185,32 @@ public class OsAdapterTest {
     Assume.assumeFalse("Skip: the 'files' table does not work on Windows",
         isWindows());
     sql("select * from vmstat")
-        .returns(
-            new Function<ResultSet, Void>() {
-              public Void apply(ResultSet r) {
-                try {
-                  assertThat(r.next(), is(true));
-                  final int c = r.getMetaData().getColumnCount();
-                  for (int i = 0; i < c; i++) {
-                    assertThat(r.getLong(i + 1), notNullValue());
-                    assertThat(r.wasNull(), is(false));
-                  }
-                  return null;
-                } catch (SQLException e) {
-                  throw new RuntimeException(e);
-                }
-              }
-            });
+        .returns(r -> {
+          try {
+            assertThat(r.next(), is(true));
+            final int c = r.getMetaData().getColumnCount();
+            for (int i = 0; i < c; i++) {
+              assertThat(r.getLong(i + 1), notNullValue());
+              assertThat(r.wasNull(), is(false));
+            }
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
+          }
+        });
   }
 
   @Test public void testStdin() throws SQLException {
     try (Hook.Closeable ignore = Hook.STANDARD_STREAMS.addThread(
-        new Function<Holder<Object[]>, Void>() {
-          public Void apply(Holder<Object[]> o) {
-            final Object[] values = o.get();
-            final InputStream in = (InputStream) values[0];
-            final String s = "First line\n"
-                + "Second line";
-            final ByteArrayInputStream in2 =
-                new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
-            final OutputStream out = (OutputStream) values[1];
-            final OutputStream err = (OutputStream) values[2];
-            o.set(new Object[] {in2, out, err});
-            return null;
-          }
+        (Consumer<Holder<Object[]>>) o -> {
+          final Object[] values = o.get();
+          final InputStream in = (InputStream) values[0];
+          final String s = "First line\n"
+              + "Second line";
+          final ByteArrayInputStream in2 =
+              new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
+          final OutputStream out = (OutputStream) values[1];
+          final OutputStream err = (OutputStream) values[2];
+          o.set(new Object[] {in2, out, err});
         })) {
       assertThat(foo("select count(*) as c from stdin"), is("2\n"));
     }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
----------------------------------------------------------------------
diff --git a/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java 
b/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
index f100197..b4c079f 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.calcite.adapter.tpcds;
 
-import org.apache.calcite.jdbc.CalciteConnection;
 import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.plan.RelTraitDef;
 import org.apache.calcite.prepare.Prepare;
@@ -35,8 +34,6 @@ import org.apache.calcite.util.Bug;
 import org.apache.calcite.util.Holder;
 import org.apache.calcite.util.Pair;
 
-import com.google.common.base.Function;
-
 import net.hydromatic.tpcds.query.Query;
 
 import org.junit.Ignore;
@@ -44,6 +41,7 @@ import org.junit.Test;
 
 import java.util.List;
 import java.util.Random;
+import java.util.function.Consumer;
 
 /** Unit test for {@link org.apache.calcite.adapter.tpcds.TpcdsSchema}.
  *
@@ -51,20 +49,13 @@ import java.util.Random;
  * command-line.
  * (See {@link org.apache.calcite.test.CalciteAssert#ENABLE_SLOW}.)</p> */
 public class TpcdsTest {
-  private static Function<Pair<List<Prepare.Materialization>, 
Holder<Program>>, Void> handler(
-      final boolean bushy, final int minJoinCount) {
-    return new Function<Pair<List<Prepare.Materialization>, Holder<Program>>,
-        Void>() {
-      public Void apply(
-          Pair<List<Prepare.Materialization>, Holder<Program>> pair) {
-        pair.right.set(
-            Programs.sequence(
-                Programs.heuristicJoinOrder(Programs.RULE_SET, bushy,
-                    minJoinCount),
-                Programs.CALC_PROGRAM));
-        return null;
-      }
-    };
+  private static Consumer<Pair<List<Prepare.Materialization>, Holder<Program>>>
+      handler(boolean bushy, int minJoinCount) {
+    return pair -> pair.right.set(
+        Programs.sequence(
+            Programs.heuristicJoinOrder(Programs.RULE_SET, bushy,
+                minJoinCount),
+            Programs.CALC_PROGRAM));
   }
 
   private static String schema(String name, String scaleFactor) {
@@ -206,13 +197,9 @@ public class TpcdsTest {
   public Frameworks.ConfigBuilder config() throws Exception {
     final Holder<SchemaPlus> root = Holder.of(null);
     CalciteAssert.model(TPCDS_MODEL)
-        .doWithConnection(
-            new Function<CalciteConnection, Object>() {
-              public Object apply(CalciteConnection input) {
-                root.set(input.getRootSchema().getSubSchema("TPCDS"));
-                return null;
-              }
-            });
+        .doWithConnection(connection -> {
+          root.set(connection.getRootSchema().getSubSchema("TPCDS"));
+        });
     return Frameworks.newConfigBuilder()
         .parserConfig(SqlParser.Config.DEFAULT)
         .defaultSchema(root.get())

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
----------------------------------------------------------------------
diff --git a/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java 
b/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
index eaf9c91..3d9de10 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
@@ -17,12 +17,10 @@
 package org.apache.calcite.adapter.tpch;
 
 import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.test.CalciteAssert;
 import org.apache.calcite.util.TestUtil;
 import org.apache.calcite.util.Util;
 
-import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 
 import org.junit.Ignore;
@@ -831,14 +829,11 @@ public class TpchTest {
   @Test public void testQuery02Conversion() {
     query(2, true)
         .enable(ENABLE)
-        .convertMatches(
-          new Function<RelNode, Void>() {
-            public Void apply(RelNode relNode) {
-              String s = RelOptUtil.toString(relNode);
-              assertThat(s, not(containsString("Correlator")));
-              return null;
-            }
-          });
+        .convertMatches(relNode -> {
+          String s = RelOptUtil.toString(relNode);
+          assertThat(s, not(containsString("Correlator")));
+          return null;
+        });
   }
 
   @Test public void testQuery03() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/codegen/includes/parserImpls.ftl
----------------------------------------------------------------------
diff --git a/server/src/main/codegen/includes/parserImpls.ftl 
b/server/src/main/codegen/includes/parserImpls.ftl
index 0fd9b87..82210a0 100644
--- a/server/src/main/codegen/includes/parserImpls.ftl
+++ b/server/src/main/codegen/includes/parserImpls.ftl
@@ -70,7 +70,7 @@ SqlCreate SqlCreateForeignSchema(Span s, boolean replace) :
 SqlNodeList Options() :
 {
     final Span s;
-    final List<SqlNode> list = Lists.newArrayList();
+    final List<SqlNode> list = new ArrayList<SqlNode>();
 }
 {
     <OPTIONS> { s = span(); } <LPAREN>
@@ -102,7 +102,7 @@ void Option(List<SqlNode> list) :
 SqlNodeList TableElementList() :
 {
     final Span s;
-    final List<SqlNode> list = Lists.newArrayList();
+    final List<SqlNode> list = new ArrayList<SqlNode>();
 }
 {
     <LPAREN> { s = span(); }
@@ -194,7 +194,7 @@ void TableElement(List<SqlNode> list) :
 SqlNodeList AttributeDefList() :
 {
     final Span s;
-    final List<SqlNode> list = Lists.newArrayList();
+    final List<SqlNode> list = new ArrayList<SqlNode>();
 }
 {
     <LPAREN> { s = span(); }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateForeignSchema.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateForeignSchema.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateForeignSchema.java
index 96ce3f9..68f24c4 100644
--- 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateForeignSchema.java
+++ 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateForeignSchema.java
@@ -49,6 +49,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -71,7 +72,7 @@ public class SqlCreateForeignSchema extends SqlCreate
       SqlIdentifier name, SqlNode type, SqlNode library,
       SqlNodeList optionList) {
     super(OPERATOR, pos, replace, ifNotExists);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
     this.type = type;
     this.library = library;
     Preconditions.checkArgument((type == null) != (library == null),

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateMaterializedView.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateMaterializedView.java
 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateMaterializedView.java
index 9e32429..2ffd6f0 100644
--- 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateMaterializedView.java
+++ 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateMaterializedView.java
@@ -43,10 +43,10 @@ import 
org.apache.calcite.sql2rel.NullInitializerExpressionFactory;
 import org.apache.calcite.util.ImmutableNullableList;
 import org.apache.calcite.util.Pair;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
+import java.util.Objects;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -68,9 +68,9 @@ public class SqlCreateMaterializedView extends SqlCreate
       boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList,
       SqlNode query) {
     super(OPERATOR, pos, replace, ifNotExists);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
     this.columnList = columnList; // may be null
-    this.query = Preconditions.checkNotNull(query);
+    this.query = Objects.requireNonNull(query);
   }
 
   public List<SqlNode> getOperandList() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateSchema.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateSchema.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateSchema.java
index 84eab77..2a04bec 100644
--- a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateSchema.java
+++ b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateSchema.java
@@ -34,9 +34,8 @@ import org.apache.calcite.sql.parser.SqlParserPos;
 import org.apache.calcite.util.ImmutableNullableList;
 import org.apache.calcite.util.Pair;
 
-import com.google.common.base.Preconditions;
-
 import java.util.List;
+import java.util.Objects;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -54,11 +53,11 @@ public class SqlCreateSchema extends SqlCreate
   SqlCreateSchema(SqlParserPos pos, boolean replace, boolean ifNotExists,
       SqlIdentifier name) {
     super(OPERATOR, pos, replace, ifNotExists);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
   }
 
   @Override public List<SqlNode> getOperandList() {
-    return ImmutableNullableList.<SqlNode>of(name);
+    return ImmutableNullableList.of(name);
   }
 
   @Override public void unparse(SqlWriter writer, int leftPrec, int rightPrec) 
{

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTable.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTable.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTable.java
index 5ae3669..3550831 100644
--- a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTable.java
+++ b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateTable.java
@@ -73,6 +73,7 @@ import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -92,7 +93,7 @@ public class SqlCreateTable extends SqlCreate
   SqlCreateTable(SqlParserPos pos, boolean replace, boolean ifNotExists,
       SqlIdentifier name, SqlNodeList columnList, SqlNode query) {
     super(OPERATOR, pos, replace, ifNotExists);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
     this.columnList = columnList; // may be null
     this.query = query; // for "CREATE TABLE ... AS query"; may be null
   }
@@ -245,7 +246,7 @@ public class SqlCreateTable extends SqlCreate
         ColumnStrategy strategy) {
       this.expr = expr;
       this.type = type;
-      this.strategy = Preconditions.checkNotNull(strategy);
+      this.strategy = Objects.requireNonNull(strategy);
       Preconditions.checkArgument(
           strategy == ColumnStrategy.NULLABLE
               || strategy == ColumnStrategy.NOT_NULLABLE
@@ -299,10 +300,10 @@ public class SqlCreateTable extends SqlCreate
         RelProtoDataType protoRowType,
         InitializerExpressionFactory initializerExpressionFactory) {
       super(name);
-      this.protoStoredRowType = Preconditions.checkNotNull(protoStoredRowType);
-      this.protoRowType = Preconditions.checkNotNull(protoRowType);
+      this.protoStoredRowType = Objects.requireNonNull(protoStoredRowType);
+      this.protoRowType = Objects.requireNonNull(protoRowType);
       this.initializerExpressionFactory =
-          Preconditions.checkNotNull(initializerExpressionFactory);
+          Objects.requireNonNull(initializerExpressionFactory);
     }
 
     public Collection getModifiableCollection() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateType.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateType.java
index c6d7991..f565126 100644
--- a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateType.java
+++ b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateType.java
@@ -34,9 +34,8 @@ import org.apache.calcite.sql.parser.SqlParserPos;
 import org.apache.calcite.util.ImmutableNullableList;
 import org.apache.calcite.util.Pair;
 
-import com.google.common.base.Preconditions;
-
 import java.util.List;
+import java.util.Objects;
 
 /**
  * Parse tree for {@code CREATE TYPE} statement.
@@ -54,7 +53,7 @@ public class SqlCreateType extends SqlCreate
   SqlCreateType(SqlParserPos pos, boolean replace, SqlIdentifier name,
       SqlNodeList attributeDefs, SqlDataTypeSpec dataType) {
     super(OPERATOR, pos, replace, false);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
     this.attributeDefs = attributeDefs; // may be null
     this.dataType = dataType; // may be null
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateView.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateView.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateView.java
index e9e3076..4332c27 100644
--- a/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateView.java
+++ b/server/src/main/java/org/apache/calcite/sql/ddl/SqlCreateView.java
@@ -39,10 +39,10 @@ import org.apache.calcite.util.ImmutableNullableList;
 import org.apache.calcite.util.Pair;
 import org.apache.calcite.util.Util;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
+import java.util.Objects;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -62,9 +62,9 @@ public class SqlCreateView extends SqlCreate
   SqlCreateView(SqlParserPos pos, boolean replace, SqlIdentifier name,
       SqlNodeList columnList, SqlNode query) {
     super(OPERATOR, pos, replace, false);
-    this.name = Preconditions.checkNotNull(name);
+    this.name = Objects.requireNonNull(name);
     this.columnList = columnList; // may be null
-    this.query = Preconditions.checkNotNull(query);
+    this.query = Objects.requireNonNull(query);
   }
 
   public List<SqlNode> getOperandList() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/server/src/main/java/org/apache/calcite/sql/ddl/SqlDropObject.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/calcite/sql/ddl/SqlDropObject.java 
b/server/src/main/java/org/apache/calcite/sql/ddl/SqlDropObject.java
index 523c96e..dacc093 100644
--- a/server/src/main/java/org/apache/calcite/sql/ddl/SqlDropObject.java
+++ b/server/src/main/java/org/apache/calcite/sql/ddl/SqlDropObject.java
@@ -49,7 +49,7 @@ abstract class SqlDropObject extends SqlDrop
   }
 
   public List<SqlNode> getOperandList() {
-    return ImmutableList.<SqlNode>of(name);
+    return ImmutableList.of(name);
   }
 
   @Override public void unparse(SqlWriter writer, int leftPrec, int rightPrec) 
{

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/site/.gitignore
----------------------------------------------------------------------
diff --git a/site/.gitignore b/site/.gitignore
index aa7624f..74fb5fa 100644
--- a/site/.gitignore
+++ b/site/.gitignore
@@ -1,3 +1,3 @@
 .sass-cache
 Gemfile.lock
-.jekyll-metadata
\ No newline at end of file
+.jekyll-metadata

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/site/README.md
----------------------------------------------------------------------
diff --git a/site/README.md b/site/README.md
index 4b5a108..cee5aa2 100644
--- a/site/README.md
+++ b/site/README.md
@@ -113,4 +113,4 @@ subversion, to publish the site, of course). If the edit is 
to appear
 on the site immediately, the committer should then cherry-pick the
 change into the "site" branch.  If there have been no feature-related
 changes on the site since the release, then "site" should be a
-fast-forward merge of "master".
\ No newline at end of file
+fast-forward merge of "master".

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/site/docker-compose.yml
----------------------------------------------------------------------
diff --git a/site/docker-compose.yml b/site/docker-compose.yml
index 2827861..eb1d7e7 100644
--- a/site/docker-compose.yml
+++ b/site/docker-compose.yml
@@ -35,4 +35,6 @@ services:
       - ../:/usr/src/calcite
       - maven-repo:/root/.m2
 volumes:
-  maven-repo:
\ No newline at end of file
+  maven-repo:
+
+# End docker-compose.yml

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/spark/src/main/java/org/apache/calcite/adapter/spark/EnumerableToSparkConverterRule.java
----------------------------------------------------------------------
diff --git 
a/spark/src/main/java/org/apache/calcite/adapter/spark/EnumerableToSparkConverterRule.java
 
b/spark/src/main/java/org/apache/calcite/adapter/spark/EnumerableToSparkConverterRule.java
index d9f2b9e..28dc0a9c 100644
--- 
a/spark/src/main/java/org/apache/calcite/adapter/spark/EnumerableToSparkConverterRule.java
+++ 
b/spark/src/main/java/org/apache/calcite/adapter/spark/EnumerableToSparkConverterRule.java
@@ -23,7 +23,7 @@ import org.apache.calcite.rel.convert.ConverterRule;
 import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.tools.RelBuilderFactory;
 
-import com.google.common.base.Predicates;
+import java.util.function.Predicate;
 
 /**
  * Rule to convert a relational expression from
@@ -40,7 +40,7 @@ public class EnumerableToSparkConverterRule extends 
ConverterRule {
    * @param relBuilderFactory Builder for relational expressions
    */
   public EnumerableToSparkConverterRule(RelBuilderFactory relBuilderFactory) {
-    super(RelNode.class, Predicates.<RelNode>alwaysTrue(),
+    super(RelNode.class, (Predicate<RelNode>) r -> true,
         EnumerableConvention.INSTANCE, SparkRel.CONVENTION, relBuilderFactory,
         "EnumerableToSparkConverterRule");
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/spark/src/main/java/org/apache/calcite/adapter/spark/HttpServer.java
----------------------------------------------------------------------
diff --git 
a/spark/src/main/java/org/apache/calcite/adapter/spark/HttpServer.java 
b/spark/src/main/java/org/apache/calcite/adapter/spark/HttpServer.java
index abef523..b9dc2b4 100644
--- a/spark/src/main/java/org/apache/calcite/adapter/spark/HttpServer.java
+++ b/spark/src/main/java/org/apache/calcite/adapter/spark/HttpServer.java
@@ -165,21 +165,17 @@ class HttpServer {
   }
 
   private static <E> Iterable<E> iterable(final Enumeration<E> enumeration) {
-    return new Iterable<E>() {
-      public Iterator<E> iterator() {
-        return new Iterator<E>() {
-          public boolean hasNext() {
-            return enumeration.hasMoreElements();
-          }
+    return () -> new Iterator<E>() {
+      public boolean hasNext() {
+        return enumeration.hasMoreElements();
+      }
 
-          public E next() {
-            return enumeration.nextElement();
-          }
+      public E next() {
+        return enumeration.nextElement();
+      }
 
-          public void remove() {
-            throw new UnsupportedOperationException();
-          }
-        };
+      public void remove() {
+        throw new UnsupportedOperationException();
       }
     };
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverter.java
----------------------------------------------------------------------
diff --git 
a/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverter.java
 
b/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverter.java
index 1c70cbe..1e986e2 100644
--- 
a/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverter.java
+++ 
b/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverter.java
@@ -90,7 +90,7 @@ public class JdbcToSparkConverter
     final Expression primitivesLiteral =
         list.append("primitives",
             Expressions.constant(
-                primitives.toArray(new Primitive[primitives.size()])));
+                primitives.toArray(new Primitive[0])));
     final Expression enumerable =
         list.append(
             "enumerable",

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverterRule.java
----------------------------------------------------------------------
diff --git 
a/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverterRule.java
 
b/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverterRule.java
index f8c30ee..51faf75 100644
--- 
a/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverterRule.java
+++ 
b/spark/src/main/java/org/apache/calcite/adapter/spark/JdbcToSparkConverterRule.java
@@ -22,7 +22,7 @@ import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.convert.ConverterRule;
 import org.apache.calcite.tools.RelBuilderFactory;
 
-import com.google.common.base.Predicates;
+import java.util.function.Predicate;
 
 /**
  * Rule to convert a relational expression from
@@ -33,7 +33,7 @@ public class JdbcToSparkConverterRule extends ConverterRule {
   /** Creates a JdbcToSparkConverterRule. */
   public JdbcToSparkConverterRule(JdbcConvention out,
       RelBuilderFactory relBuilderFactory) {
-    super(RelNode.class, Predicates.<RelNode>alwaysTrue(), out,
+    super(RelNode.class, (Predicate<RelNode>) r -> true, out,
         SparkRel.CONVENTION, relBuilderFactory, "JdbcToSparkConverterRule");
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
----------------------------------------------------------------------
diff --git 
a/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java 
b/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
index 8b313ac..3989768 100644
--- a/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
+++ b/spark/src/main/java/org/apache/calcite/adapter/spark/SparkRules.java
@@ -71,7 +71,6 @@ import java.lang.reflect.Type;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Random;
@@ -396,27 +395,14 @@ public abstract class SparkRules {
     final JavaSparkContext sc = new JavaSparkContext("local[1]", "calcite");
     final JavaRDD<String> file = sc.textFile("/usr/share/dict/words");
     System.out.println(
-        file.map(
-            new Function<String, Object>() {
-              @Override public Object call(String s) throws Exception {
-                return s.substring(0, Math.min(s.length(), 1));
-              }
-            }).distinct().count());
+        file.map(s -> s.substring(0, Math.min(s.length(), 1)))
+            .distinct().count());
     file.cache();
     String s =
-        file.groupBy(
-            new Function<String, String>() {
-              @Override public String call(String s) throws Exception {
-                return s.substring(0, Math.min(s.length(), 1));
-              }
-            }
+        file.groupBy((Function<String, String>) s1 -> s1.substring(0, 
Math.min(s1.length(), 1))
             //CHECKSTYLE: IGNORE 1
-        ).map(
-            new Function<Tuple2<String, Iterable<String>>, Object>() {
-              @Override public Object call(Tuple2<String, Iterable<String>> 
pair) {
-                return pair._1() + ":" + Iterables.size(pair._2());
-              }
-            }).collect().toString();
+        ).map((Function<Tuple2<String, Iterable<String>>, Object>) pair ->
+            pair._1() + ":" + Iterables.size(pair._2())).collect().toString();
     System.out.print(s);
 
     final JavaRDD<Integer> rdd = sc.parallelize(
@@ -433,23 +419,15 @@ public abstract class SparkRules {
           }
         });
     System.out.println(
-        rdd.groupBy(
-            new Function<Integer, Integer>() {
-              public Integer call(Integer integer) {
-                return integer % 2;
-              }
-            }).collect().toString());
+        rdd.groupBy((Function<Integer, Integer>) integer -> integer % 
2).collect().toString());
     System.out.println(
-        file.flatMap(
-            new FlatMapFunction<String, Pair<String, Integer>>() {
-              public Iterator<Pair<String, Integer>> call(String x) {
-                if (!x.startsWith("a")) {
-                  return Collections.emptyIterator();
-                }
-                return Collections.singletonList(
-                    Pair.of(x.toUpperCase(Locale.ROOT), 
x.length())).iterator();
-              }
-            })
+        file.flatMap((FlatMapFunction<String, Pair<String, Integer>>) x -> {
+          if (!x.startsWith("a")) {
+            return Collections.emptyIterator();
+          }
+          return Collections.singletonList(
+              Pair.of(x.toUpperCase(Locale.ROOT), x.length())).iterator();
+        })
             .take(5)
             .toString());
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
----------------------------------------------------------------------
diff --git 
a/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java 
b/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
index bf30881..99d4b46 100644
--- a/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
+++ b/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
@@ -18,7 +18,6 @@ package org.apache.calcite.test;
 
 import org.apache.calcite.util.Util;
 
-import com.google.common.base.Function;
 import com.google.common.collect.ImmutableSet;
 
 import org.junit.Ignore;
@@ -33,6 +32,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
+import java.util.function.Function;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
@@ -192,21 +192,18 @@ public class SplunkAdapterTest {
    * Reads from a table.
    */
   @Test public void testSelect() throws SQLException {
-    checkSql(
-        "select \"source\", \"sourcetype\"\n"
-            + "from \"splunk\".\"splunk\"",
-        new Function<ResultSet, Void>() {
-          public Void apply(ResultSet a0) {
-            try {
-              if (!(a0.next() && a0.next() && a0.next())) {
-                throw new AssertionError("expected at least 3 rows");
-              }
-              return null;
-            } catch (SQLException e) {
-              throw new RuntimeException(e);
-            }
-          }
-        });
+    final String sql = "select \"source\", \"sourcetype\"\n"
+        + "from \"splunk\".\"splunk\"";
+    checkSql(sql, resultSet -> {
+      try {
+        if (!(resultSet.next() && resultSet.next() && resultSet.next())) {
+          throw new AssertionError("expected at least 3 rows");
+        }
+        return null;
+      } catch (SQLException e) {
+        throw new RuntimeException(e);
+      }
+    });
   }
 
   @Test public void testSelectDistinct() throws SQLException {
@@ -220,16 +217,14 @@ public class SplunkAdapterTest {
 
   private static Function<ResultSet, Void> expect(final String... lines) {
     final Collection<String> expected = ImmutableSet.copyOf(lines);
-    return new Function<ResultSet, Void>() {
-      public Void apply(ResultSet a0) {
-        try {
-          Collection<String> actual =
-              CalciteAssert.toStringList(a0, new HashSet<String>());
-          assertThat(actual, equalTo(expected));
-          return null;
-        } catch (SQLException e) {
-          throw new RuntimeException(e);
-        }
+    return a0 -> {
+      try {
+        Collection<String> actual =
+            CalciteAssert.toStringList(a0, new HashSet<>());
+        assertThat(actual, equalTo(expected));
+        return null;
+      } catch (SQLException e) {
+        throw new RuntimeException(e);
       }
     };
   }
@@ -239,19 +234,16 @@ public class SplunkAdapterTest {
   @Test public void testSelectNonBuiltInColumn() throws SQLException {
     checkSql(
         "select \"status\"\n"
-        + "from \"splunk\".\"splunk\"",
-        new Function<ResultSet, Void>() {
-          public Void apply(ResultSet a0) {
-            final Set<String> actual = new HashSet<>();
-            try {
-              while (a0.next()) {
-                actual.add(a0.getString(1));
-              }
-              assertThat(actual.contains("404"), is(true));
-              return null;
-            } catch (SQLException e) {
-              throw new RuntimeException(e);
+        + "from \"splunk\".\"splunk\"", a0 -> {
+          final Set<String> actual = new HashSet<>();
+          try {
+            while (a0.next()) {
+              actual.add(a0.getString(1));
             }
+            assertThat(actual.contains("404"), is(true));
+            return null;
+          } catch (SQLException e) {
+            throw new RuntimeException(e);
           }
         });
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/d59b639d/src/main/config/forbidden-apis/signatures.txt
----------------------------------------------------------------------
diff --git a/src/main/config/forbidden-apis/signatures.txt 
b/src/main/config/forbidden-apis/signatures.txt
index 9c08b23..a415c28 100644
--- a/src/main/config/forbidden-apis/signatures.txt
+++ b/src/main/config/forbidden-apis/signatures.txt
@@ -51,4 +51,39 @@ java.lang.Runtime#exec(java.lang.String[], 
java.lang.String[], java.io.File)
 @defaultMessage For an enum, use == rather than equals
 java.lang.Enum#equals(java.lang.Object)
 
+# Preconditions.checkArgument,
+# Preconditions.checkPositionIndex, and
+# Preconditions.checkState are still OK
+@defaultMessage Use Objects.requireNonNull
+com.google.common.base.Preconditions#checkNotNull(java.lang.Object)
+com.google.common.base.Preconditions#checkNotNull(java.lang.Object, 
java.lang.Object)
+
+@defaultMessage Use java.util.Objects.equals
+com.google.common.base.Objects#equal(java.lang.Object, java.lang.Object)
+
+@defaultMessage Use java.util.Objects
+com.google.common.base.Objects
+
+@defaultMessage Use java.lang.String.join
+com.google.common.base.Joiner
+
+# Remove Guava calls to construct empty collections;
+# Sets.identityHashSet(),
+# Sets.newHashSet(Iterable) are still OK
+
+@defaultMessage Use "new ArrayList<>()"
+com.google.common.collect.Lists#newArrayList()
+
+@defaultMessage Use "new HashMap<>()"
+com.google.common.collect.Maps#newHashMap()
+
+@defaultMessage Use "new IdentityHashMap<>()"
+com.google.common.collect.Maps#newIdentityHashMap()
+
+@defaultMessage Use "new TreeMap<>()"
+com.google.common.collect.Maps#newTreeMap()
+
+@defaultMessage Use "new HashSet<>()"
+com.google.common.collect.Sets#newHashSet()
+
 # End signatures.txt

Reply via email to