Skip to content

Commit c3cd280

Browse files
committed
quiet some warnings and small cleanup
1 parent a4608b4 commit c3cd280

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

src/org/python/modules/itertools.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* Copyright (c) Jython Developers */
12
package org.python.modules;
23

34
import java.util.ArrayList;
@@ -134,7 +135,7 @@ public PyObject __iternext__() {
134135
// start over again
135136
counter = 0;
136137
}
137-
return (PyObject)saved.get(counter++);
138+
return saved.get(counter++);
138139
}
139140

140141
};

src/org/python/util/JLineConsole.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* Copyright (c) Jython Developers */
12
package org.python.util;
23

34
import java.io.File;
@@ -87,6 +88,7 @@ protected InputStream getBindings() {
8788
return getClass().getResourceAsStream("jline-keybindings.properties");
8889
}
8990

91+
@Override
9092
public String raw_input(PyObject prompt) {
9193
String line = null;
9294
try {

tests/java/javatests/Dict2JavaTest.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/* Copyright (c) Jython Developers */
12
package javatests;
3+
24
import java.util.Map;
35
import java.util.Set;
46
import java.util.Collection;
57
import java.util.HashMap;
6-
import java.util.Iterator;
78

89
/**
910
* This class is used by the test_dict2java.py test script for testing
@@ -13,21 +14,21 @@
1314
*/
1415
public class Dict2JavaTest {
1516

16-
private Map map = null;
17+
private Map<Object, Object> map;
1718

18-
public Dict2JavaTest(Map map) {
19+
public Dict2JavaTest(Map<Object, Object> map) {
1920
this.map = map;
2021
}
21-
22-
public Set entrySet() {
22+
23+
public Set<Map.Entry<Object, Object>> entrySet() {
2324
return map.entrySet();
2425
}
2526

26-
public Set keySet() {
27+
public Set<Object> keySet() {
2728
return map.keySet();
2829
}
2930

30-
public Collection values() {
31+
public Collection<Object> values() {
3132
return map.values();
3233
}
3334

@@ -41,7 +42,7 @@ public boolean containsKey(Object key) {
4142
}
4243

4344
public boolean test_putAll_efg() {
44-
HashMap hmap = new HashMap();
45+
HashMap<String, String> hmap = new HashMap<String, String>();
4546
hmap.put("e", "1");
4647
hmap.put("f", null);
4748
hmap.put("g", "2");
@@ -70,29 +71,29 @@ public boolean test_put_hig() {
7071

7172
public boolean test_java_mapentry() {
7273
// created outside of Jython with non PyOjects
73-
HashMap hmap = new HashMap();
74+
HashMap<String, Object> hmap = new HashMap<String, Object>();
7475
hmap.put("b", "y");
75-
Map.Entry entry = (Map.Entry)hmap.entrySet().iterator().next();
76+
Map.Entry<String, Object> entry = hmap.entrySet().iterator().next();
7677
if (!map.entrySet().contains(entry)) return false;
7778

7879
// Test a number
79-
hmap = new HashMap();
80+
hmap = new HashMap<String, Object>();
8081
hmap.put("i", new Integer(3));
81-
entry = (Map.Entry)hmap.entrySet().iterator().next();
82+
entry = hmap.entrySet().iterator().next();
8283
if (!map.entrySet().contains(entry)) return false;
8384

8485
// test Null
85-
hmap = new HashMap();
86+
hmap = new HashMap<String, Object>();
8687
hmap.put("f", null);
87-
entry = (Map.Entry)hmap.entrySet().iterator().next();
88+
entry = hmap.entrySet().iterator().next();
8889
if (!map.entrySet().contains(entry)) return false;
8990
return true;
9091
}
9192

9293
// make sure nulls are handled and other object types, nulls
9394
// should never match anything in the entry set.
9495
public boolean test_entry_set_nulls() {
95-
Set set = map.entrySet();
96+
Set<Map.Entry<Object, Object>> set = map.entrySet();
9697
return set.contains(null) == false && set.remove(null) == false &&
9798
set.contains(new Boolean(true)) == false && set.remove(new String("")) == false;
9899
}

0 commit comments

Comments
 (0)