JavaMethod.st
branchdevelopment
changeset 2380 9195eccdcbd9
parent 2069 75d40b7b986f
parent 2353 fa7400d022a0
child 2429 ebece4dcaab9
equal deleted inserted replaced
2079:08505399cea8 2380:9195eccdcbd9
    18      see the differences between this version and version stx:libjava
    18      see the differences between this version and version stx:libjava
    19      as of 1.9.2010
    19      as of 1.9.2010
    20 "
    20 "
    21 "{ Package: 'stx:libjava' }"
    21 "{ Package: 'stx:libjava' }"
    22 
    22 
    23 CompiledCode variableSubclass:#JavaMethod
    23 CompiledCode subclass:#JavaMethod
    24 	instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject
    24 	instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject
    25 		lineNumberTable localVariableTable sourceLineNumber annotations'
    25 		lineNumberTable localVariableTable sourceLineNumber annotations'
    26 	classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
    26 	classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
    27 		ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
    27 		ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
    28 		A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
    28 		A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
    55      see the differences between this version and version stx:libjava
    55      see the differences between this version and version stx:libjava
    56      as of 1.9.2010
    56      as of 1.9.2010
    57 
    57 
    58 "
    58 "
    59 ! !
    59 ! !
       
    60 
    60 
    61 
    61 !JavaMethod class methodsFor:'initialization'!
    62 !JavaMethod class methodsFor:'initialization'!
    62 
    63 
    63 initialize
    64 initialize
    64     AbstractMethodInvokationSignal isNil ifTrue:[
    65     AbstractMethodInvokationSignal isNil ifTrue:[
   126     self flags:(self flags bitOr:Behavior flagJavaMethod).
   127     self flags:(self flags bitOr:Behavior flagJavaMethod).
   127 
   128 
   128     "Created: / 14-12-2010 / 20:58:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   129     "Created: / 14-12-2010 / 20:58:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   129 ! !
   130 ! !
   130 
   131 
       
   132 
   131 !JavaMethod class methodsFor:'instance creation'!
   133 !JavaMethod class methodsFor:'instance creation'!
   132 
   134 
   133 fromMethod:aJavaMethod
   135 fromMethod:aJavaMethod
   134     "create a new javaMethod, copying values from another javaMethod"
   136     "create a new javaMethod, copying values from another javaMethod"
   135 
   137 
   146     ^ self basicNew:0.
   148     ^ self basicNew:0.
   147 
   149 
   148     "Created: / 16.10.1998 / 01:13:02 / cg"
   150     "Created: / 16.10.1998 / 01:13:02 / cg"
   149 ! !
   151 ! !
   150 
   152 
       
   153 
   151 !JavaMethod class methodsFor:'Signal constants'!
   154 !JavaMethod class methodsFor:'Signal constants'!
   152 
   155 
   153 abstractMethodInvokationSignal
   156 abstractMethodInvokationSignal
   154     "return the signal raised when an abstract method is invoked"
   157     "return the signal raised when an abstract method is invoked"
   155 
   158 
   181 
   184 
   182     ^ UnresolvedClassSignal
   185     ^ UnresolvedClassSignal
   183 
   186 
   184     "Created: / 27.1.1998 / 21:50:05 / cg"
   187     "Created: / 27.1.1998 / 21:50:05 / cg"
   185 ! !
   188 ! !
       
   189 
   186 
   190 
   187 !JavaMethod class methodsFor:'misc'!
   191 !JavaMethod class methodsFor:'misc'!
   188 
   192 
   189 forceByteCodeDisplay
   193 forceByteCodeDisplay
   190     ^ ForceByteCodeDisplay
   194     ^ ForceByteCodeDisplay
   227         JavaMethod makeMetaMethod
   231         JavaMethod makeMetaMethod
   228     "
   232     "
   229 
   233 
   230     "Created: / 23-02-2011 / 12:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   234     "Created: / 23-02-2011 / 12:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   231 ! !
   235 ! !
       
   236 
   232 
   237 
   233 !JavaMethod class methodsFor:'signature parsing'!
   238 !JavaMethod class methodsFor:'signature parsing'!
   234 
   239 
   235 argSigArrayFromSignature:aSignature
   240 argSigArrayFromSignature:aSignature
   236     "given a signature, return a specArray for the arguments"
   241     "given a signature, return a specArray for the arguments"
   777 
   782 
   778     "Created: / 1.8.1997 / 10:50:38 / cg"
   783     "Created: / 1.8.1997 / 10:50:38 / cg"
   779     "Modified: / 8.1.1998 / 19:09:31 / cg"
   784     "Modified: / 8.1.1998 / 19:09:31 / cg"
   780 ! !
   785 ! !
   781 
   786 
       
   787 
   782 !JavaMethod methodsFor:'* As yet uncategorized *'!
   788 !JavaMethod methodsFor:'* As yet uncategorized *'!
   783 
   789 
   784 annotationIndexOf:aSymbol
   790 annotationIndexOf:aSymbol
   785 
   791 
   786     ^nil
   792     ^nil
   797 
   803 
   798     ^false
   804     ^false
   799 
   805 
   800     "Created: / 02-12-2011 / 23:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   806     "Created: / 02-12-2011 / 23:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   801 ! !
   807 ! !
       
   808 
   802 
   809 
   803 !JavaMethod methodsFor:'accessing'!
   810 !JavaMethod methodsFor:'accessing'!
   804 
   811 
   805 accessFlags
   812 accessFlags
   806     "java calls this the modifiers"
   813     "java calls this the modifiers"
  1330 
  1337 
  1331     ^nil
  1338     ^nil
  1332 
  1339 
  1333     "Created: / 18-10-2010 / 19:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1340     "Created: / 18-10-2010 / 19:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1334 ! !
  1341 ! !
       
  1342 
  1335 
  1343 
  1336 !JavaMethod methodsFor:'compiler interface'!
  1344 !JavaMethod methodsFor:'compiler interface'!
  1337 
  1345 
  1338 flushCode
  1346 flushCode
  1339     "Flushes jitted code, effectively cause a recompile"
  1347     "Flushes jitted code, effectively cause a recompile"
  1373     ^javaClass programmingLanguage
  1381     ^javaClass programmingLanguage
  1374 
  1382 
  1375     "Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1383     "Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1376 ! !
  1384 ! !
  1377 
  1385 
       
  1386 
  1378 !JavaMethod methodsFor:'debugging'!
  1387 !JavaMethod methodsFor:'debugging'!
  1379 
  1388 
  1380 breakPoint
  1389 breakPoint
  1381     Debugger enter:thisContext sender withMessage:'breakpoint'
  1390     Debugger enter:thisContext sender withMessage:'breakpoint'
  1382 
  1391 
  1468     "not yet implemented"
  1477     "not yet implemented"
  1469 
  1478 
  1470     "Modified: / 9.1.1998 / 23:01:17 / cg"
  1479     "Modified: / 9.1.1998 / 23:01:17 / cg"
  1471     "Created: / 12.1.1998 / 20:04:57 / cg"
  1480     "Created: / 12.1.1998 / 20:04:57 / cg"
  1472 ! !
  1481 ! !
       
  1482 
  1473 
  1483 
  1474 !JavaMethod methodsFor:'decompiling'!
  1484 !JavaMethod methodsFor:'decompiling'!
  1475 
  1485 
  1476 decompileSourceTo:aStream
  1486 decompileSourceTo:aStream
  1477     |argNames|
  1487     |argNames|
  1580     ^ self
  1590     ^ self
  1581 
  1591 
  1582     "Created: / 13.1.1998 / 15:03:05 / cg"
  1592     "Created: / 13.1.1998 / 15:03:05 / cg"
  1583 ! !
  1593 ! !
  1584 
  1594 
       
  1595 
  1585 !JavaMethod methodsFor:'error handling'!
  1596 !JavaMethod methodsFor:'error handling'!
  1586 
  1597 
  1587 errorInvalidClassRefAt: index
  1598 errorInvalidClassRefAt: index
  1588 
  1599 
  1589     "Sent by the VM when an invalid entry in contant pool
  1600     "Sent by the VM when an invalid entry in contant pool
  1683 
  1694 
  1684     "Modified: / 01-08-1997 / 00:23:10 / cg"
  1695     "Modified: / 01-08-1997 / 00:23:10 / cg"
  1685     "Created: / 07-09-2011 / 14:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1696     "Created: / 07-09-2011 / 14:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1686 ! !
  1697 ! !
  1687 
  1698 
       
  1699 
  1688 !JavaMethod methodsFor:'executing'!
  1700 !JavaMethod methodsFor:'executing'!
  1689 
  1701 
  1690 valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
  1702 valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
  1691     self isStatic ifTrue:[
  1703     self isStatic ifTrue:[
  1692         anObject == javaClass ifFalse:[
  1704         anObject == javaClass ifFalse:[
  1695     ].
  1707     ].
  1696     ^super valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
  1708     ^super valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
  1697 
  1709 
  1698     "Created: / 31-10-2012 / 23:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1710     "Created: / 31-10-2012 / 23:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1699 ! !
  1711 ! !
       
  1712 
  1700 
  1713 
  1701 !JavaMethod methodsFor:'initialization'!
  1714 !JavaMethod methodsFor:'initialization'!
  1702 
  1715 
  1703 resolve
  1716 resolve
  1704     "Called by VM to resolve all references used by this method. When 
  1717     "Called by VM to resolve all references used by this method. When 
  1864     "Created: / 16-04-1996 / 11:34:29 / cg"
  1877     "Created: / 16-04-1996 / 11:34:29 / cg"
  1865     "Modified: / 16-10-1998 / 00:17:12 / cg"
  1878     "Modified: / 16-10-1998 / 00:17:12 / cg"
  1866     "Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1879     "Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1867 ! !
  1880 ! !
  1868 
  1881 
       
  1882 
  1869 !JavaMethod methodsFor:'inspecting'!
  1883 !JavaMethod methodsFor:'inspecting'!
  1870 
  1884 
  1871 inspectorExtraAttributes
  1885 inspectorExtraAttributes
  1872     "extra (pseudo instvar) entries to be shown in an inspector."
  1886     "extra (pseudo instvar) entries to be shown in an inspector."
  1873 
  1887 
  1879         yourself
  1893         yourself
  1880 
  1894 
  1881     "Modified: / 22-03-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1895     "Modified: / 22-03-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1882 ! !
  1896 ! !
  1883 
  1897 
       
  1898 
  1884 !JavaMethod methodsFor:'interpretation'!
  1899 !JavaMethod methodsFor:'interpretation'!
  1885 
  1900 
  1886 interpretWithReceiver: receiver 
  1901 interpretWithReceiver: receiver 
  1887 
  1902 
  1888     ^self 
  1903     ^self 
  1927         arguments:args
  1942         arguments:args
  1928 
  1943 
  1929     "Modified: / 24-02-2011 / 23:00:42 / Marcel Hlopko <hlopik@gmail.com>"
  1944     "Modified: / 24-02-2011 / 23:00:42 / Marcel Hlopko <hlopik@gmail.com>"
  1930     "Created: / 24-02-2011 / 22:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1945     "Created: / 24-02-2011 / 22:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1931 ! !
  1946 ! !
       
  1947 
  1932 
  1948 
  1933 !JavaMethod methodsFor:'methodref interchangability'!
  1949 !JavaMethod methodsFor:'methodref interchangability'!
  1934 
  1950 
  1935 homeMethod
  1951 homeMethod
  1936     ^ self
  1952     ^ self
  1943 setPackage:newPackage
  1959 setPackage:newPackage
  1944     newPackage ~= javaClass package ifTrue:[
  1960     newPackage ~= javaClass package ifTrue:[
  1945         self halt:'java method cannot be in a package different from its class'.
  1961         self halt:'java method cannot be in a package different from its class'.
  1946     ]
  1962     ]
  1947 ! !
  1963 ! !
       
  1964 
  1948 
  1965 
  1949 !JavaMethod methodsFor:'misc'!
  1966 !JavaMethod methodsFor:'misc'!
  1950 
  1967 
  1951 fromMethod:aJavaMethod
  1968 fromMethod:aJavaMethod
  1952     "copy values from another javaMethod"
  1969     "copy values from another javaMethod"
  1972         byteCode := nil.
  1989         byteCode := nil.
  1973     ]
  1990     ]
  1974 
  1991 
  1975     "Created: / 6.1.1998 / 18:19:48 / cg"
  1992     "Created: / 6.1.1998 / 18:19:48 / cg"
  1976 ! !
  1993 ! !
       
  1994 
  1977 
  1995 
  1978 !JavaMethod methodsFor:'printing & storing'!
  1996 !JavaMethod methodsFor:'printing & storing'!
  1979 
  1997 
  1980 displayString
  1998 displayString
  1981     javaClass isNil ifTrue:[
  1999     javaClass isNil ifTrue:[
  2122     "return a string to be used when browsing"
  2140     "return a string to be used when browsing"
  2123 
  2141 
  2124     ^ self class argSpecFromSignature:descriptor withName:(self name)
  2142     ^ self class argSpecFromSignature:descriptor withName:(self name)
  2125 
  2143 
  2126 ! !
  2144 ! !
       
  2145 
  2127 
  2146 
  2128 !JavaMethod methodsFor:'queries'!
  2147 !JavaMethod methodsFor:'queries'!
  2129 
  2148 
  2130 handlerFor:anException at:pc
  2149 handlerFor:anException at:pc
  2131     "return an exceptionHandlers pc, for an exception of the given type,
  2150     "return an exceptionHandlers pc, for an exception of the given type,
  2574     ^ Method::MethodWhoInfo class:javaClass selector:sel.
  2593     ^ Method::MethodWhoInfo class:javaClass selector:sel.
  2575 
  2594 
  2576     "Modified: / 16.10.1998 / 13:42:10 / cg"
  2595     "Modified: / 16.10.1998 / 13:42:10 / cg"
  2577 ! !
  2596 ! !
  2578 
  2597 
       
  2598 
  2579 !JavaMethod methodsFor:'signature parsing'!
  2599 !JavaMethod methodsFor:'signature parsing'!
  2580 
  2600 
  2581 XXXspecWithArgsFromSignature:aSignature withName:name in:aPackage
  2601 XXXspecWithArgsFromSignature:aSignature withName:name in:aPackage
  2582     "given a signature, return a spec with args"
  2602     "given a signature, return a spec with args"
  2583 
  2603 
  2600     "
  2620     "
  2601 
  2621 
  2602     "Created: / 8.1.1998 / 19:17:58 / cg"
  2622     "Created: / 8.1.1998 / 19:17:58 / cg"
  2603 ! !
  2623 ! !
  2604 
  2624 
       
  2625 
  2605 !JavaMethod methodsFor:'testing'!
  2626 !JavaMethod methodsFor:'testing'!
  2606 
  2627 
  2607 isSynthetic
  2628 isSynthetic
  2608     ^ (accessFlags bitAnd:A_SYNTHETIC) ~~ 0
  2629     ^ (accessFlags bitAnd:A_SYNTHETIC) ~~ 0
  2609 
  2630 
  2610     "Created: / 18-10-2010 / 19:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2631     "Created: / 18-10-2010 / 19:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2611 ! !
  2632 ! !
  2612 
  2633 
       
  2634 
  2613 !JavaMethod class methodsFor:'documentation'!
  2635 !JavaMethod class methodsFor:'documentation'!
  2614 
  2636 
  2615 version
  2637 version
  2616     ^ '$Header$'
  2638     ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.111 2013-02-16 18:08:32 vrany Exp $'
  2617 !
  2639 !
  2618 
  2640 
  2619 version_CVS
  2641 version_CVS
  2620     ^ '$Header$'
  2642     ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.111 2013-02-16 18:08:32 vrany Exp $'
  2621 !
  2643 !
  2622 
  2644 
  2623 version_HG
  2645 version_HG
  2624 
  2646 
  2625     ^ '$Changeset: <not expanded> $'
  2647     ^ '$Changeset: <not expanded> $'