3030import functools
3131
3232from .beans import JavaObject
33+ from .unmarshaller import JavaObjectUnmarshaller
34+ from ..constants import ClassDescFlags , TerminalCode , TypeCode
3335from ..utils import (
3436 log_debug ,
3537 log_error ,
@@ -59,6 +61,9 @@ def __init__(self, unmarshaller):
5961 list .__init__ (self )
6062 JavaObject .__init__ (self )
6163
64+ def __hash__ (self ):
65+ return list .__hash__ (self )
66+
6267 def __extra_loading__ (self , unmarshaller , ident = 0 ):
6368 # type: (JavaObjectUnmarshaller, int) -> None
6469 """
@@ -110,6 +115,9 @@ def __init__(self, unmarshaller):
110115 dict .__init__ (self )
111116 JavaObject .__init__ (self )
112117
118+ def __hash__ (self ):
119+ return dict .__hash__ (self )
120+
113121 def __extra_loading__ (self , unmarshaller , ident = 0 ):
114122 # type: (JavaObjectUnmarshaller, int) -> None
115123 """
@@ -128,15 +136,15 @@ def __extra_loading__(self, unmarshaller, ident=0):
128136 """
129137 # Ignore the blockdata opid
130138 (opid ,) = unmarshaller ._readStruct (">B" )
131- if opid != unmarshaller .SC_BLOCK_DATA :
139+ if opid != ClassDescFlags .SC_BLOCK_DATA :
132140 raise ValueError ("Start of block data not found" )
133141
134142 # Read HashMap fields
135143 self .buckets = unmarshaller ._read_value (
136- unmarshaller .TYPE_INTEGER , ident
144+ TypeCode .TYPE_INTEGER , ident
137145 )
138146 self .size = unmarshaller ._read_value (
139- unmarshaller .TYPE_INTEGER , ident
147+ TypeCode .TYPE_INTEGER , ident
140148 )
141149
142150 # Read entries
@@ -147,7 +155,7 @@ def __extra_loading__(self, unmarshaller, ident=0):
147155
148156 # Ignore the end of the blockdata
149157 unmarshaller ._read_and_exec_opcode (
150- ident , [unmarshaller .TC_ENDBLOCKDATA ]
158+ ident , [TerminalCode .TC_ENDBLOCKDATA ]
151159 )
152160
153161 # Ignore the trailing 0
@@ -165,6 +173,9 @@ def __init__(self, unmarshaller):
165173 set .__init__ (self )
166174 JavaObject .__init__ (self )
167175
176+ def __hash__ (self ):
177+ return set .__hash__ (self )
178+
168179 def __extra_loading__ (self , unmarshaller , ident = 0 ):
169180 # type: (JavaObjectUnmarshaller, int) -> None
170181 """
0 commit comments