JavaMethod.st
branchdevelopment
changeset 2729 ac412f6ea6d4
parent 2726 6971720de5a4
child 2732 7d1a1fb5b01a
equal deleted inserted replaced
2728:658220e93dc9 2729:ac412f6ea6d4
    70         UnresolvedClassSignal := ExecutionError newSignalMayProceed:true.
    70         UnresolvedClassSignal := ExecutionError newSignalMayProceed:true.
    71         UnresolvedClassSignal nameClass:self message:#unresolvedClassSignal.
    71         UnresolvedClassSignal nameClass:self message:#unresolvedClassSignal.
    72         UnresolvedClassSignal notifierString:'unresolved class'.
    72         UnresolvedClassSignal notifierString:'unresolved class'.
    73     ].
    73     ].
    74 
    74 
    75     ShowFullSource := false.
    75     ShowFullSource := true.
    76     ForceByteCodeDisplay := false.
    76     ForceByteCodeDisplay := false.
    77 
    77 
    78     A_PUBLIC       := 16r0001.
    78     A_PUBLIC       := 16r0001.
    79     A_PRIVATE      := 16r0002.
    79     A_PRIVATE      := 16r0002.
    80     A_PROTECTED    := 16r0004.
    80     A_PROTECTED    := 16r0004.
   120      ForceByteCodeDisplay := true.
   120      ForceByteCodeDisplay := true.
   121      ForceByteCodeDisplay := false.
   121      ForceByteCodeDisplay := false.
   122     "
   122     "
   123 
   123 
   124     "Modified: / 16-10-1998 / 01:29:48 / cg"
   124     "Modified: / 16-10-1998 / 01:29:48 / cg"
   125     "Modified: / 11-09-2013 / 03:25:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   125     "Modified: / 14-09-2013 / 11:58:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   126 !
   126 !
   127 
   127 
   128 reinitialize
   128 reinitialize
   129 
   129 
   130     self flags:(self flags bitOr:Behavior flagJavaMethod).
   130     self flags:(self flags bitOr:Behavior flagJavaMethod).
   184     "return the signal raised when an unresolved class is referenced"
   184     "return the signal raised when an unresolved class is referenced"
   185 
   185 
   186     ^ UnresolvedClassSignal
   186     ^ UnresolvedClassSignal
   187 
   187 
   188     "Created: / 27.1.1998 / 21:50:05 / cg"
   188     "Created: / 27.1.1998 / 21:50:05 / cg"
       
   189 ! !
       
   190 
       
   191 !JavaMethod class methodsFor:'accessing'!
       
   192 
       
   193 showFullSource
       
   194     ^ ShowFullSource
       
   195 
       
   196     "Created: / 14-09-2013 / 11:56:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   189 ! !
   197 ! !
   190 
   198 
   191 !JavaMethod class methodsFor:'misc'!
   199 !JavaMethod class methodsFor:'misc'!
   192 
   200 
   193 forceByteCodeDisplay
   201 forceByteCodeDisplay
   944     ^javaClass
   952     ^javaClass
   945 
   953 
   946     "Created: / 15-04-2013 / 17:57:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   954     "Created: / 15-04-2013 / 17:57:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   947 !
   955 !
   948 
   956 
       
   957 getSource
       
   958     ^ source
       
   959 
       
   960     "Created: / 13-09-2013 / 01:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   961 !
       
   962 
   949 getSourcePosition
   963 getSourcePosition
   950     ^ 1
   964     ^ 1
   951 !
   965 !
   952 
   966 
   953 hasLineNumberInformation
   967 hasLineNumberInformation
  1299 
  1313 
  1300     sourceString := javaClass source.
  1314     sourceString := javaClass source.
  1301     sourceString isNil ifTrue:[
  1315     sourceString isNil ifTrue:[
  1302         ^ self decompiledSource.
  1316         ^ self decompiledSource.
  1303     ].
  1317     ].
  1304 
  1318     ShowFullSource ifTrue:[ ^ sourceString ].
  1305 
       
  1306     source notNil ifTrue:[
  1319     source notNil ifTrue:[
  1307         ^ source readFrom: sourceString.
  1320         ^ source readFrom: sourceString.
  1308     ].
  1321     ].
  1309 
  1322 
  1310 
  1323 
  1312     JavaSourceDocument notNil ifTrue:[
  1325     JavaSourceDocument notNil ifTrue:[
  1313         "/ As a side effect, this fills in source references for all methods.
  1326         "/ As a side effect, this fills in source references for all methods.
  1314         "/ see JavaSourceDocument
  1327         "/ see JavaSourceDocument
  1315         | document |
  1328         | document |
  1316 
  1329 
  1317         ((document := self sourceDocument) notNil and:[document sourceTree notNil]) ifTrue:[
  1330         ((document := self sourceDocument) notNil and:[document sourceTreeOrNilIfParsing notNil]) ifTrue:[
  1318             ^ source readFrom: sourceString.
  1331             ^ source readFrom: sourceString.
  1319         ]
  1332         ]
  1320     ].
  1333     ].
  1321     ^ sourceString
  1334     ^ sourceString
  1322 
  1335 
  1323     "Modified: / 04-01-1998 / 13:48:35 / cg"
  1336     "Modified: / 04-01-1998 / 13:48:35 / cg"
  1324     "Modified: / 13-12-2010 / 11:06:51 / Jan Kurs <kurs.jan@post.cz>"
  1337     "Modified: / 13-12-2010 / 11:06:51 / Jan Kurs <kurs.jan@post.cz>"
  1325     "Modified: / 09-09-2013 / 12:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1338     "Modified: / 14-09-2013 / 12:01:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1326 !
  1339 !
  1327 
  1340 
  1328 sourceDocument
  1341 sourceDocument
  1329     | doc |
  1342     | doc |
  1330     "/ stx:libjava/tools may not be loaded...    
  1343     "/ stx:libjava/tools may not be loaded...    
  1918     "Modified: / 16-10-1998 / 00:17:12 / cg"
  1931     "Modified: / 16-10-1998 / 00:17:12 / cg"
  1919     "Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1932     "Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1920 !
  1933 !
  1921 
  1934 
  1922 setSource:aJavaMethodSourceRef
  1935 setSource:aJavaMethodSourceRef
       
  1936     self assert: aJavaMethodSourceRef class == JavaSourceRef.
  1923     source := aJavaMethodSourceRef
  1937     source := aJavaMethodSourceRef
  1924 
  1938 
  1925     "Created: / 07-09-2013 / 01:44:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1939     "Created: / 07-09-2013 / 01:44:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1940     "Modified: / 13-09-2013 / 02:19:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1926 ! !
  1941 ! !
  1927 
  1942 
  1928 !JavaMethod methodsFor:'inspecting'!
  1943 !JavaMethod methodsFor:'inspecting'!
  1929 
  1944 
  1930 inspectorExtraAttributes
  1945 inspectorExtraAttributes
  2412 
  2427 
  2413         line0 := self lineNumberForPC0: pc.
  2428         line0 := self lineNumberForPC0: pc.
  2414         ShowFullSource ifFalse:[
  2429         ShowFullSource ifFalse:[
  2415             source isNil ifTrue:[
  2430             source isNil ifTrue:[
  2416                 "/ Fetch the source ref...
  2431                 "/ Fetch the source ref...
  2417                 self sourceDocument sourceTree.
  2432                 self sourceDocument sourceTreeOrNilIfParsing.
  2418                 source isNil ifTrue:[
  2433                 source isNil ifTrue:[
  2419                     ^ line0 - self firstInstructionLineNumber - 2.
  2434                     ^ line0 - self firstInstructionLineNumber - 2.
  2420                 ].
  2435                 ].
  2421             ].
  2436             ].
  2422             ^ line0 - source line0 + 1.
  2437             ^ line0 - source line0 + 1.
  2443         ]
  2458         ]
  2444     ].
  2459     ].
  2445     ^ num
  2460     ^ num
  2446 
  2461 
  2447     "Modified: / 14-01-1998 / 13:30:54 / cg"
  2462     "Modified: / 14-01-1998 / 13:30:54 / cg"
  2448     "Modified: / 11-09-2013 / 04:05:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2463     "Modified: / 13-09-2013 / 02:11:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2449 !
  2464 !
  2450 
  2465 
  2451 messagesSent
  2466 messagesSent
  2452     "return a collection of messages sent by this method"
  2467     "return a collection of messages sent by this method"
  2453     ^ self analyzer messagesSent
  2468     ^ self analyzer messagesSent
  2494 package
  2509 package
  2495     "in java, class extensions are not possible;
  2510     "in java, class extensions are not possible;
  2496      all methods MUST be in their classes package"
  2511      all methods MUST be in their classes package"
  2497 
  2512 
  2498     ^ javaClass package
  2513     ^ javaClass package
  2499 !
       
  2500 
       
  2501 quickLineNumberForPC:pc
       
  2502     |last|
       
  2503 
       
  2504     lineNumberTable notNil ifTrue:[
       
  2505         lineNumberTable pairWiseDo:[:lPc :lNr |
       
  2506             lPc >= pc ifTrue:[
       
  2507                 lPc == pc ifTrue:[^ lNr].
       
  2508                 last isNil ifTrue:[^ lNr].
       
  2509                 ^ last.
       
  2510             ].
       
  2511             last := lNr.
       
  2512         ].
       
  2513         last notNil ifTrue:[        
       
  2514             ^ last
       
  2515         ].
       
  2516         ^ lineNumberTable at:2
       
  2517     ].
       
  2518     ^ nil
       
  2519 
       
  2520     "Modified: / 14.1.1998 / 13:30:54 / cg"
       
  2521     "Created: / 10.11.1998 / 14:18:22 / cg"
       
  2522 !
  2514 !
  2523 
  2515 
  2524 referencesGlobal:aGlobalName
  2516 referencesGlobal:aGlobalName
  2525     "return true, if this method refers to a global named aGlobalName"
  2517     "return true, if this method refers to a global named aGlobalName"
  2526 
  2518 
  2768 version_CVS
  2760 version_CVS
  2769     ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.114 2013-04-25 13:11:44 stefan Exp $'
  2761     ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.114 2013-04-25 13:11:44 stefan Exp $'
  2770 !
  2762 !
  2771 
  2763 
  2772 version_SVN
  2764 version_SVN
  2773     ^ '§Id§'
  2765     ^ 'Id'
  2774 ! !
  2766 ! !
  2775 
  2767 
  2776 
  2768 
  2777 JavaMethod initialize!
  2769 JavaMethod initialize!