This is an automated email from the ASF dual-hosted git repository.

losd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git


The following commit(s) were added to refs/heads/master by this push:
     new 0331ce4  METAMODEL-1215: Remove deprecated code from pre-Java 8 times
0331ce4 is described below

commit 0331ce4bd7225d19098c07d25abd87690b6a2856
Author: Dennis Du Krøger <[email protected]>
AuthorDate: Thu Jul 25 08:02:44 2019 +0200

    METAMODEL-1215: Remove deprecated code from pre-Java 8 times
---
 CHANGES.md                                         |  1 +
 .../java/org/apache/metamodel/util/FileHelper.java | 65 +++-------------------
 .../main/java/org/apache/metamodel/util/Func.java  | 52 -----------------
 .../java/org/apache/metamodel/util/Predicate.java  | 38 -------------
 .../main/java/org/apache/metamodel/util/Ref.java   | 37 ------------
 .../org/apache/metamodel/jdbc/JdbcDataContext.java |  9 ---
 .../java/org/apache/metamodel/jdbc/JdbcUtils.java  | 11 ----
 7 files changed, 10 insertions(+), 203 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 7f7fc3d..cf11d18 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,6 +3,7 @@
  * [METAMODEL-1151] - Created DataContextFactory implementations for each 
remaining module.
  * [METAMODEL-1213] - Fixed concurrency bug in single-line CSV parallel reader.
  * [METAMODEL-1211] - Fixed bug of getting all SelectItems when performing 
nested loop joins.
+ * [METAMODEL-1215] - Removed deprecated code from pre-Java 8 times.
  * Improved HBase query building by scanning columns instead of column 
families.
 
 ### Apache MetaModel 5.3.0
diff --git a/core/src/main/java/org/apache/metamodel/util/FileHelper.java 
b/core/src/main/java/org/apache/metamodel/util/FileHelper.java
index 298b44b..7e532e7 100644
--- a/core/src/main/java/org/apache/metamodel/util/FileHelper.java
+++ b/core/src/main/java/org/apache/metamodel/util/FileHelper.java
@@ -359,14 +359,12 @@ public final class FileHelper {
         return new BufferedReader(reader);
     }
 
-    public static BufferedReader getBufferedReader(InputStream inputStream, 
Charset charset)
-            throws IllegalStateException {
+    public static BufferedReader getBufferedReader(InputStream inputStream, 
Charset charset) throws IllegalStateException {
         final Reader reader = getReader(inputStream, charset);
         return new BufferedReader(reader);
     }
 
-    public static BufferedReader getBufferedReader(InputStream inputStream, 
String encoding)
-            throws IllegalStateException {
+    public static BufferedReader getBufferedReader(InputStream inputStream, 
String encoding) throws IllegalStateException {
         final Reader reader = getReader(inputStream, encoding);
         return new BufferedReader(reader);
     }
@@ -388,61 +386,13 @@ public final class FileHelper {
     }
 
     public static void writeString(OutputStream outputStream, String string) 
throws IllegalStateException {
-        writeString(outputStream, string, DEFAULT_ENCODING);
-    }
-
-    /**
-     * Writes a string to a {@link OutputStream}, and then closes it.
-     * 
-     * @param outputStream
-     * @param string
-     * @param encoding
-     * @throws IllegalStateException
-     * @deprecated No longer advised for use since this will close the writer 
(just use {@link Writer#write(String)}).
-     */
-    @Deprecated
-    public static void writeString(OutputStream outputStream, String string, 
String encoding)
-            throws IllegalStateException {
-        final Writer writer = getWriter(outputStream, encoding);
-        writeString(writer, string);
-    }
-
-    /**
-     * Writes a string to a {@link Writer}, and then closes it.
-     * 
-     * @param writer
-     * @param string
-     * @throws IllegalStateException
-     * 
-     * @deprecated No longer advised for use since this will close the writer 
(just use {@link Writer#write(String)}).
-     */
-    @Deprecated
-    public static void writeString(Writer writer, String string) throws 
IllegalStateException {
-        try {
+        try (final Writer writer = getWriter(outputStream, DEFAULT_ENCODING)) {
             writer.write(string);
-        } catch (Exception e) {
+        } catch (IOException e) {
             throw new IllegalStateException(e);
-        } finally {
-            safeClose(writer);
         }
     }
 
-    /**
-     * Writes a string to a {@link Writer}, and then closes it.
-     * 
-     * @param writer
-     * @param string
-     * @param encoding
-     * @throws IllegalStateException
-     * 
-     * @deprecated No longer advised for use since this will close the writer 
(just use {@link Writer#write(String)})
-     *             and the encoding is never used.
-     */
-    @Deprecated
-    public static void writeString(Writer writer, String string, String 
encoding) throws IllegalStateException {
-        writeString(writer, string);
-    }
-
     public static void writeStringAsFile(File file, String string) throws 
IllegalStateException {
         writeStringAsFile(file, string, DEFAULT_ENCODING);
     }
@@ -452,8 +402,11 @@ public final class FileHelper {
     }
 
     public static void writeStringAsFile(File file, String string, Charset 
charset) throws IllegalStateException {
-        final BufferedWriter bw = getBufferedWriter(file, charset);
-        writeString(bw, string);
+        try (final BufferedWriter bw = getBufferedWriter(file, charset)) {
+            bw.write(string);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
     }
 
     public static BufferedReader getBufferedReader(File file) throws 
IllegalStateException {
diff --git a/core/src/main/java/org/apache/metamodel/util/Func.java 
b/core/src/main/java/org/apache/metamodel/util/Func.java
deleted file mode 100644
index 687189a..0000000
--- a/core/src/main/java/org/apache/metamodel/util/Func.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.metamodel.util;
-
-import java.util.function.Function;
-
-/**
- * Represents an abstract function, which is an executable piece of
- * functionality that has an input and an output. A {@link Func} has a return
- * type, unlike an {@link Action}.
- * 
- * @param <I>
- *            the input type
- * @param <O>
- *            the output type
- * @deprecated use {@link Function} instead
- */
-@Deprecated
-@FunctionalInterface
-public interface Func<I, O> extends Function<I, O> {
-    
-    @Override
-    default O apply(I t) {
-        // defer to the deprecated signature
-        return eval(t);
-    }
-
-    /**
-     * Evaluates an element and transforms it using this function.
-     * 
-     * @param arg
-     *            the input given to the function
-     * @return the output result of the function
-     */
-    public O eval(I arg);
-}
diff --git a/core/src/main/java/org/apache/metamodel/util/Predicate.java 
b/core/src/main/java/org/apache/metamodel/util/Predicate.java
deleted file mode 100644
index 73e6a22..0000000
--- a/core/src/main/java/org/apache/metamodel/util/Predicate.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.metamodel.util;
-
-/**
- * A predicate is a special type of {@link Func}, used typically for
- * inclusion/exclusion criteria.
- * 
- * @param <E>
- * 
- * @deprecated use {@link java.util.function.Predicate} instead
- */
-@Deprecated
-@FunctionalInterface
-public interface Predicate<E> extends Func<E, Boolean>, 
java.util.function.Predicate<E> {
-
-    @Override
-    default boolean test(E t) {
-        // delegate to the deprecated method signature
-        return eval(t);
-    }
-}
diff --git a/core/src/main/java/org/apache/metamodel/util/Ref.java 
b/core/src/main/java/org/apache/metamodel/util/Ref.java
deleted file mode 100644
index 927c606..0000000
--- a/core/src/main/java/org/apache/metamodel/util/Ref.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.metamodel.util;
-
-import java.util.function.Supplier;
-
-/**
- * Represents an abstract reference. This interface enables use of both 
regular,
- * hard references, soft references and deferred/lazy references.
- * 
- * @param <E>
- * 
- * @deprecated use {@link Supplier} instead
- */
-@Deprecated
-@FunctionalInterface
-public interface Ref<E> extends Supplier<E> {
-    
-    @Override
-       public E get();
-}
diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java 
b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java
index ce8d3b9..3ca2d9f 100644
--- a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java
+++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java
@@ -569,15 +569,6 @@ public class JdbcDataContext extends AbstractDataContext 
implements UpdateableDa
     }
 
     /**
-     * @deprecated Manually close {@link ResultSet} and {@link Statement} 
instead.
-     */
-    @Deprecated
-    public void close(Connection connection, ResultSet rs, Statement st) {
-        close(connection);
-        FileHelper.safeClose(rs, st);
-    }
-
-    /**
      * Convenience method to get the available catalogNames using this 
connection.
      * 
      * @return a String-array with the names of the available catalogs.
diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUtils.java 
b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUtils.java
index 3512b8a..b99c32d 100644
--- a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUtils.java
+++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUtils.java
@@ -18,12 +18,10 @@
  */
 package org.apache.metamodel.jdbc;
 
-import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.List;
 
 import org.apache.metamodel.MetaModelException;
-import org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter;
 import org.apache.metamodel.jdbc.dialects.IQueryRewriter;
 import org.apache.metamodel.query.FilterItem;
 import org.apache.metamodel.query.OperatorType;
@@ -77,15 +75,6 @@ public final class JdbcUtils {
         }
     }
 
-    /**
-     * @deprecated use {@link 
IQueryRewriter#setStatementParameter(PreparedStatement, int, Column, Object)}
-     */
-    @Deprecated
-    public static void setStatementValue(final PreparedStatement st, final int 
valueIndex, final Column column,
-            Object value) throws SQLException {
-        new DefaultQueryRewriter(null).setStatementParameter(st, valueIndex, 
column, value);
-    }
-
     public static String getValueAsSql(Column column, Object value, 
IQueryRewriter queryRewriter) {
         if (value == null) {
             return "NULL";

Reply via email to