File: method_signatures.py

package info (click to toggle)
jython 2.7.3%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 62,820 kB
  • sloc: python: 641,384; java: 306,981; xml: 2,066; sh: 514; ansic: 126; makefile: 77
file content (41 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from java.lang import (Class, Object, Void, String, Long)
from java.lang import RuntimeException

from org.python.compiler.custom_proxymaker import MiniClampMaker

import sys
sys.path.append('tests/python/custom_proxymaker/')
from clamp import ClampMethod

class MethodSignatures(Object):
    __proxymaker__ = MiniClampMaker
    __java_package__ = 'custom_proxymaker.tests'

    def throwsException(self):
        pass
    throwsException._clamp = ClampMethod('throwsException', Void.TYPE, [], [RuntimeException], {}, [{}])

    def returnsLong(self):
        return 2
    returnsLong._clamp = ClampMethod('returnsLong', Long.TYPE, [], [], {}, [{}])

    def returnsObject(self):
        return Object()
    returnsObject._clamp = ClampMethod('returnsObject', Object, [], [], {}, [{}])

    def returnsArray(self):
        return [1,2,3]
    returnsArray._clamp = ClampMethod('returnsArray', Class.forName('[J'), [], [], {}, [{}])

    def returnsArrayObj(self):
        return [1,2,3]
    returnsArrayObj._clamp = ClampMethod('returnsArrayObj', Class.forName('[Ljava.lang.Object;'), [], [], {}, [{}])

    def acceptsString(self, arg):
        pass
    acceptsString._clamp = ClampMethod('acceptsString', Void.TYPE, [String], [], {}, [{}])

    def acceptsArray(self, arg):
        pass
    acceptsArray._clamp = ClampMethod('acceptsArray', Void.TYPE, [Class.forName('[J')], [], {}, [{}])