GeezerVison is showing github.com — test/fix overloaded synchronized methods · fuzz-security/java2python@7120676
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: java2python/config/default.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
97 | 97 | methodPrologueHandlers = [ |
98 | 98 | basic.maybeAbstractMethod, |
99 | 99 | basic.maybeClassMethod, |
| 100 | + basic.overloadedClassMethods, |
100 | 101 | # NB: synchronized should come after classmethod |
101 | 102 | basic.maybeSynchronizedMethod, |
102 | | - basic.overloadedClassMethods, |
103 | 103 | ] |
104 | 104 |
|
105 | 105 |
|
|
Collapse file
Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +class classmethod_(classmethod): |
| 2 | + """ Classmethod that provides attribute delegation. |
| 3 | +
|
| 4 | + """ |
| 5 | + def __getattr__(self, name): |
| 6 | + return getattr(self.__func__, name) |
Collapse file
Copy file name to clipboard +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +class Synchronized2 { |
| 2 | + |
| 3 | + public synchronized void test1() { |
| 4 | + System.out.println(1); |
| 5 | + } |
| 6 | + |
| 7 | + public synchronized void test1(String s) { |
| 8 | + System.out.println(s); |
| 9 | + } |
| 10 | + |
| 11 | + public static synchronized void test1(int i) { |
| 12 | + System.out.println(i); |
| 13 | + } |
| 14 | + |
| 15 | + public static synchronized void test2() { |
| 16 | + System.out.println(2); |
| 17 | + } |
| 18 | + |
| 19 | + public static synchronized void test2(String s) { |
| 20 | + System.out.println(s); |
| 21 | + } |
| 22 | + |
| 23 | + public synchronized void test2(int i) { |
| 24 | + System.out.println(i); |
| 25 | + } |
| 26 | + |
| 27 | + public static void main(String[] args) { |
| 28 | + Synchronized2 obj = new Synchronized2(); |
| 29 | + obj.test1(); |
| 30 | + obj.test1("test1"); |
| 31 | + obj.test1(1); |
| 32 | + obj.test2(); |
| 33 | + obj.test2("test2"); |
| 34 | + obj.test2(2); |
| 35 | + } |
| 36 | +} |
Collapse file
Copy file name to clipboardExpand all lines: test/configs/defaults.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
4 | 4 |
|
5 | 5 |
|
6 | 6 | modulePrologueHandlers = default.modulePrologueHandlers + [ |
| 7 | + 'from java2python.mod.include.classmethod import classmethod_ as classmethod', |
7 | 8 | 'from java2python.mod.include.overloading import overloaded', |
8 | 9 | 'from abc import ABCMeta, abstractmethod', |
9 | 10 | 'import zope.interface', |
|