From 8ccc3b4309a11b9ff7b9644867d88d445bc870f8 Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Mon, 28 Jan 2019 17:03:03 +0000 Subject: [PATCH] Fix Java 6/7/8 concurrent map compatibility --- src/android/io/sqlc/SQLitePlugin.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/android/io/sqlc/SQLitePlugin.java b/src/android/io/sqlc/SQLitePlugin.java index 8a86b821..bddc4d4c 100755 --- a/src/android/io/sqlc/SQLitePlugin.java +++ b/src/android/io/sqlc/SQLitePlugin.java @@ -14,6 +14,8 @@ import java.io.File; import java.lang.IllegalArgumentException; import java.lang.Number; + +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; @@ -38,9 +40,17 @@ public class SQLitePlugin extends CordovaPlugin { /** * Multiple database runner map (static). * NOTE: no public static accessor to db (runner) map since it would not work with db threading. - * FUTURE put DBRunner into a public class that can provide external accessor. + * + * FUTURE TBD put DBRunner into a public class that can provide external accessor. + * + * ADDITIONAL NOTE: Storing as Map to avoid portabiity issue + * between Java 6/7/8 as discussed in: + * https://gist.github.com/AlainODea/1375759b8720a3f9f094 + * + * THANKS to @NeoLSN (Jason Yang/楊朝傑) for giving the pointer in: + * https://github.com/litehelpers/Cordova-sqlite-storage/issues/727 */ - static ConcurrentHashMap dbrmap = new ConcurrentHashMap(); + static Map dbrmap = new ConcurrentHashMap(); /** * NOTE: Using default constructor, no explicit constructor.