Skip to content

Commit

Permalink
type-constrain all HashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 13, 2018
1 parent 5e3b622 commit 88f7c2c
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions Java/sources/org/perl/inline/java/InlineJavaClass.java
Expand Up @@ -8,7 +8,7 @@ class InlineJavaClass {
private InlineJavaServer ijs ;
private InlineJavaProtocol ijp ;

static private HashMap class2jni_code = new HashMap() ;
static private HashMap<Class, String> class2jni_code = new HashMap<>() ;
static {
class2jni_code.put(byte.class, "B") ;
class2jni_code.put(short.class, "S") ;
Expand All @@ -21,7 +21,7 @@ class InlineJavaClass {
class2jni_code.put(void.class, "V") ;
} ;

static private HashMap class2wrapper = new HashMap() ;
static private HashMap<Class, Class> class2wrapper = new HashMap<>() ;
static {
class2wrapper.put(byte.class, java.lang.Byte.class) ;
class2wrapper.put(short.class, java.lang.Short.class) ;
Expand All @@ -34,7 +34,7 @@ class InlineJavaClass {
class2wrapper.put(void.class, java.lang.Void.class) ;
} ;

static private HashMap name2class = new HashMap() ;
static private HashMap<String, Class> name2class = new HashMap<>() ;
static {
name2class.put("byte", byte.class) ;
name2class.put("short", short.class) ;
Expand Down Expand Up @@ -388,7 +388,7 @@ static boolean ClassIsPrimitive(Class p){
/*
Determines if class is of numerical type.
*/
static private HashMap numeric_classes = new HashMap() ;
static private HashMap<Class, Boolean> numeric_classes = new HashMap<>() ;
static {
Class [] list = {
java.lang.Byte.class,
Expand All @@ -414,7 +414,7 @@ static boolean ClassIsNumeric (Class p){
}


static private HashMap double_classes = new HashMap() ;
static private HashMap<Class, Boolean> double_classes = new HashMap<>();
static {
Class [] list = {
java.lang.Double.class,
Expand All @@ -432,7 +432,7 @@ static boolean ClassIsDouble (Class p){
/*
Class is String or StringBuffer
*/
static private HashMap string_classes = new HashMap() ;
static private HashMap<Class, Boolean> string_classes = new HashMap<>();
static {
Class csq = ValidateClassQuiet("java.lang.CharSequence") ;
Class [] list = {
Expand All @@ -452,7 +452,7 @@ static boolean ClassIsString (Class p){
/*
Class is Char
*/
static private HashMap char_classes = new HashMap() ;
static private HashMap<Class, Boolean> char_classes = new HashMap<>() ;
static {
Class [] list = {
java.lang.Character.class,
Expand All @@ -470,7 +470,7 @@ static boolean ClassIsChar (Class p){
/*
Class is Bool
*/
static private HashMap bool_classes = new HashMap() ;
static private HashMap<Class, Boolean> bool_classes = new HashMap<>() ;
static {
Class [] list = {
java.lang.Boolean.class,
Expand Down
Expand Up @@ -10,7 +10,7 @@
public class InlineJavaPerlCaller {
private InlineJavaServer ijs = InlineJavaServer.GetInstance() ;
private Thread creator = null ;
static private Map thread_callback_queues = Collections.synchronizedMap(new HashMap()) ;
static private Map<Thread, InlineJavaCallbackQueue> thread_callback_queues = Collections.synchronizedMap(new HashMap<Thread, InlineJavaCallbackQueue>()) ;
static private ResourceBundle resources = null ;
static private boolean inited = false ;

Expand Down
4 changes: 2 additions & 2 deletions Java/sources/org/perl/inline/java/InlineJavaPerlNatives.java
Expand Up @@ -7,8 +7,8 @@

public class InlineJavaPerlNatives extends InlineJavaPerlCaller {
static private boolean inited = false ;
static private Map registered_classes = Collections.synchronizedMap(new HashMap()) ;
static private Map registered_methods = Collections.synchronizedMap(new HashMap()) ;
static private Map<Class, Class> registered_classes = Collections.synchronizedMap(new HashMap<>()) ;
static private Map<String, String> registered_methods = Collections.synchronizedMap(new HashMap<>()) ;


protected InlineJavaPerlNatives() throws InlineJavaException {
Expand Down
2 changes: 1 addition & 1 deletion Java/sources/org/perl/inline/java/InlineJavaProtocol.java
Expand Up @@ -18,7 +18,7 @@ class InlineJavaProtocol {

private final String encoding = "UTF-8" ;

static private Map member_cache = Collections.synchronizedMap(new HashMap()) ;
static private Map<String, Member> member_cache = Collections.synchronizedMap(new HashMap<>()) ;
static private final String report_version = "V2" ;

InlineJavaProtocol(InlineJavaServer _ijs, String _cmd) {
Expand Down
6 changes: 3 additions & 3 deletions Java/sources/org/perl/inline/java/InlineJavaServer.java
Expand Up @@ -20,7 +20,7 @@ public class InlineJavaServer {
private boolean finished = false ;
private ServerSocket server_socket = null ;
private InlineJavaUserClassLoader ijucl = null ;
private HashMap thread_objects = new HashMap() ;
private HashMap<Thread, HashMap<Integer, Object>> thread_objects = new HashMap<>();
private int objid = 1 ;
private boolean jni = false ;
private Thread creator = null ;
Expand Down Expand Up @@ -218,7 +218,7 @@ synchronized Object GetObject(int id) throws InlineJavaException {


synchronized int PutObject(Object o) throws InlineJavaException {
HashMap h = (HashMap)thread_objects.get(Thread.currentThread()) ;
HashMap<Integer, Object> h = (HashMap<Integer, Object>)thread_objects.get(Thread.currentThread()) ;

int id = objid ;
if (h == null){
Expand Down Expand Up @@ -291,7 +291,7 @@ synchronized void Shutdown(){
calls this method also.
*/
synchronized void AddThread(Thread t){
thread_objects.put(t, new HashMap()) ;
thread_objects.put(t, new HashMap<Integer, Object>()) ;
InlineJavaPerlCaller.AddThread(t) ;
}

Expand Down
Expand Up @@ -12,7 +12,7 @@
so that it will execute them.
*/
class InlineJavaUserClassLoader extends URLClassLoader {
private HashMap urls = new HashMap() ;
private HashMap<URL, String> urls = new HashMap<>() ;

private Object link = null ;
private Method invoke = null ;
Expand Down
4 changes: 2 additions & 2 deletions lib/Inline/Java.pod
Expand Up @@ -480,13 +480,13 @@ are not known to C<Inline::Java>. This is also true for return types:
}

public HashMap get_hash(){
HashMap h = new HashMap() ;
HashMap<String, String> h = new HashMap<>() ;
h.put("key", "value") ;

return h ;
}

public String do_stuff_to_hash(HashMap h){
public String do_stuff_to_hash(HashMap<String, String> h){
return (String)h.get("key") ;
}
}
Expand Down
2 changes: 1 addition & 1 deletion t/06_static.t
Expand Up @@ -60,7 +60,7 @@ import java.util.* ;
public class types6 {
public static int i = 5 ;
public static HashMap hm = new HashMap() ;
public static HashMap<String, String> hm = new HashMap<>() ;
public types6(String k, String v){
hm.put(k, v) ;
Expand Down
4 changes: 2 additions & 2 deletions t/08_study.t
Expand Up @@ -101,8 +101,8 @@ public class a8 {
}
public HashMap [] sb(){
HashMap h1 = new HashMap() ;
HashMap h2 = new HashMap() ;
HashMap<String, String> h1 = new HashMap<>() ;
HashMap<String, String> h2 = new HashMap<>() ;
h1.put("toto", "titi") ;
h2.put("tata", "tete") ;
Expand Down
2 changes: 1 addition & 1 deletion t/types.java
Expand Up @@ -12,7 +12,7 @@ public String func(){
}

public HashMap hm(){
HashMap hm = new HashMap() ;
HashMap<String, String> hm = new HashMap<>() ;
hm.put("key", "value") ;

return hm ;
Expand Down

0 comments on commit 88f7c2c

Please sign in to comment.