Skip to content

Commit 1c6796f

Browse files
committed
Small corrections due to tests
- JavaString is now hashable - Use an integer-division reading annotations
1 parent da20470 commit 1c6796f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

javaobj.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ class JavaString(str):
315315
"""
316316
Represents a Java String
317317
"""
318+
def __hash__(self):
319+
return str.__hash__(self)
320+
318321
def __eq__(self, other):
319322
if not isinstance(other, str):
320323
return False
@@ -1421,7 +1424,7 @@ def transform(self, java_object):
14211424
new_object = self.JavaMap()
14221425
java_object.copy(new_object)
14231426

1424-
for i in range((len(java_object.annotations) - 1) / 2):
1427+
for i in range((len(java_object.annotations) - 1) // 2):
14251428
new_object[java_object.annotations[i * 2 + 1]] = \
14261429
java_object.annotations[i * 2 + 2]
14271430

0 commit comments

Comments
 (0)