Skip to content

Commit 4353f40

Browse files
committed
ensure overloaded methods are registered as synchronized
1 parent 7120676 commit 4353f40

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

java2python/compiler/template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def __init__(self, config, name=None, type=None, parent=None):
119119
self.children = []
120120
self.config = config
121121
self.decorators = []
122+
self.overloaded = None
122123
self.factory = Factory(config)
123124
self.modifiers = []
124125
self.name = name

java2python/mod/basic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ def overloadedClassMethods(method):
109109
cls = method.parent
110110
methods = [o for o in cls.children if o.isMethod and o.name==method.name]
111111
if len(methods) == 1:
112+
if methods[0].overloaded:
113+
yield methods[0].overloaded
112114
return
113115
for i, m in enumerate(methods[1:]):
114116
args = [p['type'] for p in m.parameters]
115117
args = ', '.join(args)
116-
m.decorators.append('@{0}.register({1})'.format(method.name, args))
118+
m.overloaded = '@{0}.register({1})'.format(method.name, args)
117119
m.name = '{0}_{1}'.format(method.name, i)
118120
# for this one only:
119121
yield '@overloaded'

0 commit comments

Comments
 (0)