You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/04/22 05:55:45 UTC

[groovy] branch master updated: remove legacy named param type check hack

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3518a22  remove legacy named param type check hack
3518a22 is described below

commit 3518a22bfd6b708a90a91473d93a752b61cf7f9f
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Apr 22 15:55:23 2021 +1000

    remove legacy named param type check hack
---
 subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
index 747776e..a43db7a 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
@@ -545,10 +545,8 @@ public class Sql implements AutoCloseable {
             @NamedParam(value = "resultSetConcurrency", type = Integer.class)
             @NamedParam(value = "resultSetHoldability", type = Integer.class)
             @NamedParam(value = "resultSetType", type = Integer.class)
-            // TODO below will be deleted once we fix type checker to understand
-            // readonly Map otherwise seen as Map<String, Serializable>
-            @NamedParam(value = "unused", type = Object.class)
-            Map<String, Object> args) throws SQLException, ClassNotFoundException {
+            Map<String, Object> args
+    ) throws SQLException, ClassNotFoundException {
         if (!args.containsKey("url"))
             throw new IllegalArgumentException("Argument 'url' is required");
 
@@ -559,9 +557,8 @@ public class Sql implements AutoCloseable {
             throw new IllegalArgumentException("Only one of 'driverClassName' and 'driver' should be provided");
 
         // Make a copy so destructive operations will not affect the caller
-        Map<String, Object> sqlArgs = new HashMap<String, Object>(args);
+        Map<String, Object> sqlArgs = new HashMap<>(args);
 
-        sqlArgs.remove("unused"); // TODO remove
         Object driverClassName = sqlArgs.remove("driverClassName");
         if (driverClassName == null) driverClassName = sqlArgs.remove("driver");
         if (driverClassName != null) loadDriver(driverClassName.toString());
@@ -631,13 +628,10 @@ public class Sql implements AutoCloseable {
             @NamedParam(value = "resultSetConcurrency", type = Integer.class)
             @NamedParam(value = "resultSetHoldability", type = Integer.class)
             @NamedParam(value = "resultSetType", type = Integer.class)
-            // TODO below will be deleted once we fix type checker to understand
-            // readonly Map otherwise seen as Map<String, Serializable>
-            @NamedParam(value = "unused", type = Object.class)
             Map<String, Object> args,
             @ClosureParams(value=SimpleType.class, options="groovy.sql.Sql")
-            Closure c)
-                throws SQLException, ClassNotFoundException {
+            Closure c
+    ) throws SQLException, ClassNotFoundException {
         try (Sql sql = newInstance(args)) {
             c.call(sql);
         }