877
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
3 |
|
1155
|
4 |
New code and modifications done at SWING Research Group [1]:
|
1152
|
5 |
|
877
|
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
7 |
SWING Research Group, Czech Technical University in Prague
|
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
|
15 |
|
1155
|
16 |
[1] Code written at SWING Research Group contains a signature
|
|
17 |
of one of the above copright owners. For exact set of such code,
|
|
18 |
see the differences between this version and version stx:libjava
|
1152
|
19 |
as of 1.9.2010
|
877
|
20 |
"
|
752
|
21 |
"{ Package: 'stx:libjava' }"
|
|
22 |
|
|
23 |
Object subclass:#JavaSourceCodeCache
|
|
24 |
instanceVariableNames:'parsedCodes'
|
|
25 |
classVariableNames:'parsedCode'
|
|
26 |
poolDictionaries:''
|
|
27 |
category:'Languages-Java-Support'
|
|
28 |
!
|
|
29 |
|
|
30 |
JavaSourceCodeCache class instanceVariableNames:'instance'
|
|
31 |
|
|
32 |
"
|
|
33 |
No other class instance variables are inherited by this class.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
877
|
37 |
!JavaSourceCodeCache class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
|
41 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
42 |
|
1155
|
43 |
New code and modifications done at SWING Research Group [1]:
|
1152
|
44 |
|
877
|
45 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
46 |
SWING Research Group, Czech Technical University in Prague
|
|
47 |
|
|
48 |
This software is furnished under a license and may be used
|
|
49 |
only in accordance with the terms of that license and with the
|
|
50 |
inclusion of the above copyright notice. This software may not
|
|
51 |
be provided or otherwise made available to, or used by, any
|
|
52 |
other person. No title to or ownership of the software is
|
|
53 |
hereby transferred.
|
|
54 |
|
1155
|
55 |
[1] Code written at SWING Research Group contains a signature
|
|
56 |
of one of the above copright owners. For exact set of such code,
|
|
57 |
see the differences between this version and version stx:libjava
|
1152
|
58 |
as of 1.9.2010
|
877
|
59 |
|
|
60 |
"
|
|
61 |
! !
|
752
|
62 |
|
|
63 |
!JavaSourceCodeCache class methodsFor:'instance creation'!
|
|
64 |
|
|
65 |
new
|
|
66 |
instance isNil ifTrue: [ instance := self basicNew initialize ].
|
|
67 |
^ instance
|
|
68 |
|
|
69 |
"Created: / 13-12-2010 / 13:56:31 / Jan Kurs <kurs.jan@post.cz>"
|
|
70 |
! !
|
|
71 |
|
|
72 |
!JavaSourceCodeCache methodsFor:'adding & removing'!
|
|
73 |
|
|
74 |
flush
|
|
75 |
self parsedCodes removeAll.
|
|
76 |
|
|
77 |
"Created: / 17-12-2010 / 16:32:49 / Jan Kurs <kurs.jan@post.cz>"
|
|
78 |
! !
|
|
79 |
|
|
80 |
!JavaSourceCodeCache methodsFor:'initialize'!
|
|
81 |
|
|
82 |
initialize
|
|
83 |
parsedCodes := IdentityDictionary new.
|
|
84 |
|
|
85 |
"Created: / 13-12-2010 / 14:11:49 / Jan Kurs <kurs.jan@post.cz>"
|
|
86 |
"Modified: / 17-12-2010 / 13:35:36 / Jan Kurs <kurs.jan@post.cz>"
|
|
87 |
! !
|
|
88 |
|
|
89 |
!JavaSourceCodeCache methodsFor:'private - searching'!
|
|
90 |
|
|
91 |
findMethodLine: javaMethod inMethods: methods
|
|
92 |
| bestMatchMethod pos |
|
|
93 |
|
|
94 |
pos := javaMethod firstInstructionLineNumber.
|
|
95 |
bestMatchMethod := Plug new respondTo: #startLine with: [^ 0].
|
|
96 |
methods do: [
|
|
97 |
:method |
|
|
98 |
method startLine > pos ifTrue: [
|
|
99 |
^ bestMatchMethod startLine
|
|
100 |
].
|
|
101 |
bestMatchMethod := method.
|
|
102 |
].
|
|
103 |
^ 0.
|
|
104 |
|
|
105 |
"Created: / 08-01-2011 / 16:10:37 / Jan Kurs <kurs.jan@post.cz>"
|
|
106 |
!
|
|
107 |
|
|
108 |
getMethodsFor:class
|
|
109 |
^ parsedCodes at: class fullName ifAbsentPut: [
|
|
110 |
[
|
1402
|
111 |
JavaParser_Old methodsIn: class source
|
752
|
112 |
] on: Exception do:
|
|
113 |
[
|
|
114 |
OrderedCollection new.
|
|
115 |
]
|
|
116 |
].
|
|
117 |
|
|
118 |
"Created: / 08-01-2011 / 16:09:47 / Jan Kurs <kurs.jan@post.cz>"
|
1402
|
119 |
"Modified: / 09-03-2012 / 23:30:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
752
|
120 |
!
|
|
121 |
|
|
122 |
parsedCodes
|
|
123 |
^ parsedCodes
|
|
124 |
! !
|
|
125 |
|
|
126 |
!JavaSourceCodeCache methodsFor:'queries'!
|
|
127 |
|
|
128 |
findLineForMethod:javaMethod inClass:javaClass
|
|
129 |
| methods mdL |
|
|
130 |
methods := self getMethodsFor:javaClass.
|
|
131 |
mdL := self findMethodLine:javaMethod inMethods:methods.
|
|
132 |
^ mdL
|
|
133 |
|
|
134 |
"Created: / 13-12-2010 / 13:47:26 / Jan Kurs <kurs.jan@post.cz>"
|
|
135 |
"Modified: / 08-01-2011 / 16:10:21 / Jan Kurs <kurs.jan@post.cz>"
|
|
136 |
! !
|
|
137 |
|
|
138 |
!JavaSourceCodeCache class methodsFor:'documentation'!
|
|
139 |
|
|
140 |
version_SVN
|
|
141 |
^ '$Id$'
|
|
142 |
! !
|