author | Claus Gittinger <cg@exept.de> |
Thu, 14 Jan 2016 22:09:34 +0100 | |
changeset 3933 | f7cd19b621fb |
parent 3932 | ff45df4a8398 |
child 3936 | 669dd820f259 |
child 3937 | 9873e699a554 |
permissions | -rw-r--r-- |
2798 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3779 | 3 |
All Rights Reserved |
2798 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libbasic3' }" |
|
13 |
||
3775 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2798 | 16 |
Object subclass:#ProjectProblem |
3790 | 17 |
instanceVariableNames:'package fixes allProblems' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'System-Support-Projects' |
|
2798 | 21 |
! |
22 |
||
23 |
ProjectProblem subclass:#ClassProblem |
|
3790 | 24 |
instanceVariableNames:'className' |
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:ProjectProblem |
|
2798 | 28 |
! |
29 |
||
3160 | 30 |
ProjectProblem::ClassProblem subclass:#InconsistentProjectDefinition |
3790 | 31 |
instanceVariableNames:'' |
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
privateIn:ProjectProblem |
|
2798 | 35 |
! |
36 |
||
3449 | 37 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool |
3790 | 38 |
instanceVariableNames:'poolName' |
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:ProjectProblem |
|
3449 | 42 |
! |
43 |
||
44 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass |
|
3790 | 45 |
instanceVariableNames:'superClassName' |
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
privateIn:ProjectProblem |
|
3449 | 49 |
! |
50 |
||
3160 | 51 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButDoesNotExist |
3790 | 52 |
instanceVariableNames:'' |
53 |
classVariableNames:'' |
|
54 |
poolDictionaries:'' |
|
55 |
privateIn:ProjectProblem |
|
2798 | 56 |
! |
57 |
||
3806 | 58 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButInOtherPackage |
59 |
instanceVariableNames:'' |
|
60 |
classVariableNames:'' |
|
61 |
poolDictionaries:'' |
|
62 |
privateIn:ProjectProblem |
|
63 |
! |
|
64 |
||
3160 | 65 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedMultipleTimes |
3790 | 66 |
instanceVariableNames:'' |
67 |
classVariableNames:'' |
|
68 |
poolDictionaries:'' |
|
69 |
privateIn:ProjectProblem |
|
2911 | 70 |
! |
71 |
||
3160 | 72 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassNotListed |
3790 | 73 |
instanceVariableNames:'' |
74 |
classVariableNames:'' |
|
75 |
poolDictionaries:'' |
|
76 |
privateIn:ProjectProblem |
|
2911 | 77 |
! |
78 |
||
3449 | 79 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassIsAutoloaded |
3790 | 80 |
instanceVariableNames:'' |
81 |
classVariableNames:'' |
|
82 |
poolDictionaries:'' |
|
83 |
privateIn:ProjectProblem |
|
2798 | 84 |
! |
85 |
||
3588 | 86 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassShouldNotBeInPackage |
3790 | 87 |
instanceVariableNames:'' |
88 |
classVariableNames:'' |
|
89 |
poolDictionaries:'' |
|
90 |
privateIn:ProjectProblem |
|
3588 | 91 |
! |
92 |
||
2911 | 93 |
ProjectProblem::ClassProblem subclass:#ClassUsesPoolProblem |
3790 | 94 |
instanceVariableNames:'poolName' |
95 |
classVariableNames:'' |
|
96 |
poolDictionaries:'' |
|
97 |
privateIn:ProjectProblem |
|
2798 | 98 |
! |
99 |
||
2911 | 100 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItIsNotASharedPool |
3790 | 101 |
instanceVariableNames:'' |
102 |
classVariableNames:'' |
|
103 |
poolDictionaries:'' |
|
104 |
privateIn:ProjectProblem |
|
2911 | 105 |
! |
106 |
||
107 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolInNamespaceButNamespaceIsNotDefined |
|
3790 | 108 |
instanceVariableNames:'' |
109 |
classVariableNames:'' |
|
110 |
poolDictionaries:'' |
|
111 |
privateIn:ProjectProblem |
|
2911 | 112 |
! |
113 |
||
114 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItDoesNotExist |
|
3790 | 115 |
instanceVariableNames:'' |
116 |
classVariableNames:'' |
|
117 |
poolDictionaries:'' |
|
118 |
privateIn:ProjectProblem |
|
2911 | 119 |
! |
120 |
||
2854 | 121 |
ProjectProblem::ClassProblem subclass:#MethodProblem |
3790 | 122 |
instanceVariableNames:'selector' |
123 |
classVariableNames:'' |
|
124 |
poolDictionaries:'' |
|
125 |
privateIn:ProjectProblem |
|
2798 | 126 |
! |
127 |
||
3166 | 128 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButInDifferentPackage |
3790 | 129 |
instanceVariableNames:'' |
130 |
classVariableNames:'' |
|
131 |
poolDictionaries:'' |
|
132 |
privateIn:ProjectProblem |
|
3166 | 133 |
! |
134 |
||
2798 | 135 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodNotListed |
3790 | 136 |
instanceVariableNames:'' |
137 |
classVariableNames:'' |
|
138 |
poolDictionaries:'' |
|
139 |
privateIn:ProjectProblem |
|
2798 | 140 |
! |
141 |
||
3166 | 142 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodsClassDoesNotExist |
3790 | 143 |
instanceVariableNames:'' |
144 |
classVariableNames:'' |
|
145 |
poolDictionaries:'' |
|
146 |
privateIn:ProjectProblem |
|
3166 | 147 |
! |
148 |
||
3449 | 149 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassProjectDefinitionIsMissing |
3790 | 150 |
instanceVariableNames:'' |
151 |
classVariableNames:'' |
|
152 |
poolDictionaries:'' |
|
153 |
privateIn:ProjectProblem |
|
3160 | 154 |
! |
155 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
156 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue1 |
3790 | 157 |
instanceVariableNames:'errors warnings' |
158 |
classVariableNames:'' |
|
159 |
poolDictionaries:'' |
|
160 |
privateIn:ProjectProblem |
|
2854 | 161 |
! |
162 |
||
163 |
Object subclass:#Error |
|
3790 | 164 |
instanceVariableNames:'message startPosition endPosition' |
165 |
classVariableNames:'' |
|
166 |
poolDictionaries:'' |
|
167 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
|
2854 | 168 |
! |
169 |
||
170 |
Object subclass:#Warning |
|
3790 | 171 |
instanceVariableNames:'message startPosition endPosition' |
172 |
classVariableNames:'' |
|
173 |
poolDictionaries:'' |
|
174 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
175 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
176 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
177 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue2 |
3790 | 178 |
instanceVariableNames:'rules errors warnings' |
179 |
classVariableNames:'' |
|
180 |
poolDictionaries:'' |
|
181 |
privateIn:ProjectProblem |
|
2854 | 182 |
! |
183 |
||
2798 | 184 |
ProjectProblem::MethodProblem subclass:#MethodInNoPackage |
3790 | 185 |
instanceVariableNames:'' |
186 |
classVariableNames:'' |
|
187 |
poolDictionaries:'' |
|
188 |
privateIn:ProjectProblem |
|
189 |
! |
|
190 |
||
191 |
ProjectProblem::MethodProblem subclass:#MethodListedInOtherPackage |
|
192 |
instanceVariableNames:'otherProjectDefinitionClasses' |
|
193 |
classVariableNames:'' |
|
194 |
poolDictionaries:'' |
|
195 |
privateIn:ProjectProblem |
|
2798 | 196 |
! |
197 |
||
198 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButDoesNotExist |
|
3790 | 199 |
instanceVariableNames:'' |
200 |
classVariableNames:'' |
|
201 |
poolDictionaries:'' |
|
202 |
privateIn:ProjectProblem |
|
2798 | 203 |
! |
204 |
||
2854 | 205 |
ProjectProblem::MethodProblem subclass:#MethodSourceCorrupted |
3790 | 206 |
instanceVariableNames:'' |
207 |
classVariableNames:'' |
|
208 |
poolDictionaries:'' |
|
209 |
privateIn:ProjectProblem |
|
2854 | 210 |
! |
211 |
||
212 |
ProjectProblem::MethodProblem subclass:#MethodSourceNotAvailable |
|
3790 | 213 |
instanceVariableNames:'' |
214 |
classVariableNames:'' |
|
215 |
poolDictionaries:'' |
|
216 |
privateIn:ProjectProblem |
|
2854 | 217 |
! |
218 |
||
2798 | 219 |
ProjectProblem subclass:#ProjectDefinitionDoesNotExist |
3790 | 220 |
instanceVariableNames:'' |
221 |
classVariableNames:'' |
|
222 |
poolDictionaries:'' |
|
223 |
privateIn:ProjectProblem |
|
2798 | 224 |
! |
225 |
||
226 |
!ProjectProblem class methodsFor:'documentation'! |
|
227 |
||
228 |
copyright |
|
229 |
" |
|
230 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3779 | 231 |
All Rights Reserved |
2798 | 232 |
|
233 |
This software is furnished under a license and may be used |
|
234 |
only in accordance with the terms of that license and with the |
|
235 |
inclusion of the above copyright notice. This software may not |
|
236 |
be provided or otherwise made available to, or used by, any |
|
237 |
other person. No title to or ownership of the software is |
|
238 |
hereby transferred. |
|
239 |
" |
|
3430 | 240 |
! |
241 |
||
242 |
documentation |
|
243 |
" |
|
244 |
I represent a problem as detect by the project consistency checker, |
|
245 |
which is optionally executed before committing a package to a repository. |
|
246 |
Typically, I find inconsistencies, uncompilable methods or missing prerequisites, |
|
247 |
which might lead to trouble when the package is later to be compiled to a dll via stc. |
|
3431 | 248 |
|
3547 | 249 |
[instance variables:] |
250 |
package - the package in question |
|
251 |
||
252 |
fixes - a collection of possible fixes |
|
253 |
(to be shown in the HTML view of the problem browser) |
|
254 |
||
255 |
allProblems - the collection of problems I am part of |
|
256 |
(only needed to be able to do the |
|
257 |
'fix other problems of this kind' operation, |
|
258 |
for example in the MethodOnNoPackage problem.) |
|
259 |
||
3431 | 260 |
[see also:] |
261 |
ProjectChecker ProjectDefinition |
|
3430 | 262 |
" |
2798 | 263 |
! ! |
264 |
||
265 |
!ProjectProblem class methodsFor:'instance creation'! |
|
266 |
||
3449 | 267 |
newClassIsCompiledButSuperclassIsAutoloaded |
268 |
||
269 |
^ClassIsCompiledButSuperclassIsAutoloaded new |
|
270 |
||
271 |
"Created: / 20-09-2013 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
272 |
! |
|
273 |
||
274 |
newClassIsCompiledButSuperclassProjectDefinitionIsMissing |
|
275 |
||
276 |
^ClassIsCompiledButSuperclassProjectDefinitionIsMissing new |
|
277 |
||
278 |
"Created: / 05-10-2013 / 12:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
279 |
! |
|
280 |
||
2911 | 281 |
newClassListedBeforeItsPool |
282 |
||
283 |
^ClassListedBeforeItsPool new |
|
284 |
||
285 |
"Created: / 13-09-2012 / 17:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
286 |
! |
|
287 |
||
288 |
newClassListedBeforeItsSuperclass |
|
289 |
||
290 |
^ClassListedBeforeItsSuperclass new |
|
291 |
||
292 |
"Created: / 13-09-2012 / 17:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
293 |
! |
|
294 |
||
2798 | 295 |
newClassListedButDoesNotExist |
296 |
||
297 |
^ClassListedButDoesNotExist new |
|
298 |
||
299 |
"Created: / 23-02-2012 / 13:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
300 |
! |
|
301 |
||
3806 | 302 |
newClassListedButInOtherPackage |
303 |
||
304 |
^ClassListedButInOtherPackage new |
|
305 |
! |
|
306 |
||
2911 | 307 |
newClassListedMultipleTimes |
308 |
||
309 |
^ClassListedMultipleTimes new |
|
310 |
||
311 |
"Created: / 13-09-2012 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
! |
|
313 |
||
2798 | 314 |
newClassNotListed |
315 |
||
316 |
^ClassNotListed new |
|
317 |
||
318 |
"Created: / 23-02-2012 / 13:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
319 |
! |
|
320 |
||
3588 | 321 |
newClassShouldNotBeInPackage |
322 |
||
323 |
^ClassShouldNotBeInPackage new |
|
324 |
! |
|
325 |
||
2798 | 326 |
newClassUsesPoolButItDoesNotExist |
327 |
||
328 |
^ClassUsesPoolButItDoesNotExist new |
|
329 |
||
330 |
"Created: / 23-02-2012 / 13:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
331 |
! |
|
332 |
||
333 |
newClassUsesPoolButItIsNotASharedPool |
|
334 |
||
335 |
^ClassUsesPoolButItIsNotASharedPool new |
|
336 |
||
337 |
"Created: / 23-02-2012 / 13:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
338 |
! |
|
339 |
||
2911 | 340 |
newClassUsesPoolInNamespaceButNamespaceIsNotDefined |
341 |
||
342 |
^ClassUsesPoolInNamespaceButNamespaceIsNotDefined new |
|
343 |
||
344 |
"Created: / 13-09-2012 / 16:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
345 |
! |
|
346 |
||
2798 | 347 |
newExtensionMethodListedButDoesNotExist |
348 |
||
349 |
^ExtensionMethodListedButDoesNotExist new |
|
350 |
||
351 |
"Created: / 23-02-2012 / 14:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
352 |
! |
|
353 |
||
3166 | 354 |
newExtensionMethodListedButInDifferentPackage |
355 |
||
356 |
^ExtensionMethodListedButInDifferentPackage new |
|
357 |
! |
|
358 |
||
2798 | 359 |
newExtensionMethodNotListed |
360 |
||
361 |
^ExtensionMethodNotListed new |
|
362 |
||
363 |
"Created: / 23-02-2012 / 14:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
364 |
! |
|
365 |
||
3166 | 366 |
newExtensionMethodsClassDoesNotExist |
367 |
||
368 |
^ExtensionMethodsClassDoesNotExist new |
|
369 |
! |
|
370 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
371 |
newMethodCompilabilityIssue1 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
372 |
^ MethodCompilabilityIssue1 new |
2854 | 373 |
|
374 |
"Created: / 11-04-2012 / 15:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
375 |
"Modified: / 29-05-2014 / 15:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
376 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
377 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
378 |
newMethodCompilabilityIssue2 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
379 |
^ MethodCompilabilityIssue2 new |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
380 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
381 |
"Created: / 29-05-2014 / 15:37:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 382 |
! |
383 |
||
2798 | 384 |
newMethodInNoPackage |
385 |
||
386 |
^MethodInNoPackage new |
|
387 |
||
388 |
"Created: / 23-02-2012 / 14:27:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
389 |
! |
|
390 |
||
3790 | 391 |
newMethodListedInOtherPackage |
392 |
||
393 |
^ MethodListedInOtherPackage new |
|
394 |
! |
|
395 |
||
2854 | 396 |
newMethodSourceCorrupted |
397 |
||
398 |
^MethodSourceCorrupted new |
|
399 |
||
400 |
"Created: / 11-04-2012 / 12:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
401 |
! |
|
402 |
||
403 |
newMethodSourceNotAvailable |
|
404 |
||
405 |
^MethodSourceNotAvailable new |
|
406 |
||
407 |
"Created: / 11-04-2012 / 12:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
408 |
! |
|
409 |
||
2798 | 410 |
newProjectDefinitionDoesNotExist |
411 |
||
412 |
^ProjectDefinitionDoesNotExist new |
|
413 |
||
414 |
"Created: / 23-02-2012 / 13:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
415 |
! ! |
|
416 |
||
417 |
!ProjectProblem methodsFor:'accessing'! |
|
418 |
||
3547 | 419 |
allProblems:something |
420 |
allProblems := something. |
|
421 |
! |
|
422 |
||
3549 | 423 |
countOtherProblemsOfThisKind |
424 |
^ allProblems |
|
425 |
count: |
|
426 |
[:problem | |
|
427 |
problem class == self class |
|
428 |
and:[ problem ~~ self |
|
429 |
and:[ problem alreadyFixed not]] |
|
430 |
]. |
|
431 |
! |
|
432 |
||
2798 | 433 |
description |
434 |
"Return a (HTML) describing the problem." |
|
435 |
||
436 |
^self subclassResponsibility |
|
437 |
||
438 |
"Created: / 23-02-2012 / 13:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
439 |
! |
|
440 |
||
2854 | 441 |
descriptionAndFixes |
442 |
"Return a (HTML) describing the problem plus possible fixes." |
|
443 |
||
3169 | 444 |
|descriptionText fixes| |
445 |
||
446 |
(self alreadyFixed) ifTrue:[^ 'Already fixed.']. |
|
447 |
||
448 |
descriptionText := self description. |
|
449 |
||
450 |
"/ don't use cached fixes (after a fix, the problem may return an empty fix list) |
|
451 |
fixes := self fixes. |
|
452 |
fixes isEmpty ifTrue:[ ^ descriptionText ]. |
|
2854 | 453 |
|
454 |
^String streamContents:[:html | |
|
3169 | 455 |
html nextPutAll: descriptionText. |
2798 | 456 |
|
3169 | 457 |
html nextPutAll: '<br><br>'. |
458 |
fixes size == 1 ifTrue:[ |
|
459 |
html nextPutLine: 'Possible fix:'. |
|
460 |
] ifFalse:[ |
|
461 |
html nextPutLine: 'Possible fixes:'. |
|
462 |
]. |
|
463 |
html nextPutLine:'<ul>'. |
|
464 |
fixes withIndexDo:[:fix :index| |
|
465 |
html |
|
3894 | 466 |
nextPutAll:'<li><a ACTION="doit: self application doFix: '; |
3169 | 467 |
nextPutAll: index printString; |
468 |
nextPutAll:'">'; |
|
469 |
nextPutAll: fix first; |
|
470 |
nextPutAll:'</a></li>'. |
|
471 |
]. |
|
472 |
html nextPutLine:'</ul>'. |
|
2854 | 473 |
]. |
2798 | 474 |
|
2854 | 475 |
"Created: / 26-07-2012 / 09:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
476 |
! |
|
477 |
||
2798 | 478 |
label |
479 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
480 |
||
481 |
^self subclassResponsibility |
|
482 |
||
483 |
"Created: / 23-02-2012 / 13:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
484 |
! |
|
485 |
||
486 |
package |
|
487 |
^ package |
|
488 |
! |
|
489 |
||
490 |
package:aSymbol |
|
2854 | 491 |
package := aSymbol asSymbol. |
492 |
||
493 |
"Modified: / 11-04-2012 / 16:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 494 |
! |
495 |
||
496 |
packageDefinitionClass |
|
497 |
^ProjectDefinition definitionClassForPackage: package |
|
498 |
||
499 |
"Created: / 23-02-2012 / 13:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
500 |
! |
|
501 |
||
502 |
severity |
|
503 |
"Return a severity - one of #error, #warning, #info" |
|
504 |
||
2911 | 505 |
^#warning "/by default |
2798 | 506 |
|
507 |
"Created: / 23-02-2012 / 13:09:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
508 |
! ! |
|
509 |
||
2854 | 510 |
!ProjectProblem methodsFor:'fixing'! |
511 |
||
3549 | 512 |
allUnfixedProblemsOfMyKindDo:aBlock |
513 |
allProblems do:[:p | |
|
514 |
(p class == self class and:[ p alreadyFixed not]) ifTrue:[ |
|
515 |
aBlock value:p |
|
516 |
] |
|
517 |
] |
|
518 |
! |
|
519 |
||
3169 | 520 |
alreadyFixed |
521 |
^ false |
|
522 |
! |
|
523 |
||
2854 | 524 |
doFix: index |
525 |
self initializeFixes. |
|
3169 | 526 |
^ (fixes at: index) second value |
2854 | 527 |
|
528 |
"Created: / 26-07-2012 / 10:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3549 | 529 |
! |
530 |
||
531 |
fixes |
|
3790 | 532 |
"Return (possibly empty) list of description-action pairs that |
3549 | 533 |
the user may take to fix/investigate the problem. |
534 |
Returned value should be list of pairs (label, action block). |
|
535 |
To be overriden in subclasses. |
|
536 |
||
537 |
The list should be an array of pairs ( fix label , fix block ). |
|
538 |
Fix block should return true, if the fix was successful, |
|
539 |
false otherwise" |
|
540 |
||
541 |
^#() |
|
542 |
||
543 |
"Created: / 26-07-2012 / 09:46:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 544 |
! ! |
545 |
||
546 |
!ProjectProblem methodsFor:'initialization'! |
|
547 |
||
548 |
initializeFixes |
|
549 |
||
550 |
fixes isNil ifTrue:[ |
|
3779 | 551 |
fixes := self fixes |
2854 | 552 |
]. |
553 |
||
554 |
"/ super initialize. -- commented since inherited method does nothing |
|
555 |
||
556 |
"Created: / 26-07-2012 / 09:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
557 |
! ! |
|
558 |
||
2798 | 559 |
!ProjectProblem methodsFor:'printing & storing'! |
560 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
561 |
displayOn:aGCOrStream |
3169 | 562 |
|lbl| |
563 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
564 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
565 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
566 |
(aGCOrStream isStream) ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
567 |
^ super displayOn:aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
568 |
]. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
569 |
|
3169 | 570 |
lbl := self label. |
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
571 |
self alreadyFixed ifTrue:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
572 |
aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
573 |
nextPutAll:lbl string; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
574 |
emphasis:#italic; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
575 |
nextPutAll:' (already fixed)' |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
576 |
] ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
577 |
aGCOrStream nextPutAll:lbl. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
578 |
]. |
2798 | 579 |
|
580 |
"Created: / 14-02-2012 / 17:02:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
581 |
! |
|
582 |
||
583 |
printOn:aStream |
|
584 |
"append a printed representation if the receiver to the argument, aStream" |
|
585 |
||
586 |
super printOn:aStream. |
|
587 |
aStream nextPut:$(. |
|
588 |
self severity printOn:aStream. |
|
589 |
aStream nextPut:$:; space. |
|
590 |
self label printOn:aStream. |
|
591 |
aStream nextPut:$). |
|
592 |
||
593 |
"Modified: / 23-02-2012 / 16:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
594 |
! ! |
|
595 |
||
596 |
!ProjectProblem methodsFor:'utilities-HTML'! |
|
597 |
||
598 |
linkToClass: classOrclassName |
|
2854 | 599 |
| className | |
2798 | 600 |
|
601 |
className := classOrclassName isBehavior |
|
3779 | 602 |
ifTrue: [classOrclassName storeString] |
603 |
ifFalse:[classOrclassName]. |
|
604 |
||
605 |
^'<A INFO="Click to browse class" |
|
3894 | 606 |
ACTION="doit: SystemBrowser default openInClass:%1"> |
3779 | 607 |
<CODE>%1</CODE></A>' |
608 |
bindWith: className |
|
2798 | 609 |
|
610 |
"Created: / 23-02-2012 / 13:44:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
611 |
! |
|
612 |
||
613 |
linkToClass: classOrclassName selector: selector |
|
2854 | 614 |
^self linkToClass: classOrclassName selector: selector omitClassName: false |
615 |
||
616 |
"Created: / 23-02-2012 / 13:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
617 |
! |
|
618 |
||
619 |
linkToClass: classOrclassName selector: selector omitClassName: omitClassName |
|
2798 | 620 |
|
621 |
| className | |
|
622 |
className := classOrclassName isBehavior |
|
3779 | 623 |
ifTrue: [classOrclassName name] |
624 |
ifFalse:[classOrclassName]. |
|
2854 | 625 |
^omitClassName ifTrue:[ |
3779 | 626 |
'<A INFO="Click to browse method" |
3894 | 627 |
ACTION="doit: SystemBrowser default openInClass:%1 selector: %2"> |
3779 | 628 |
<CODE>#%3</CODE></A>' |
629 |
bindWith: className |
|
630 |
with: selector storeString |
|
631 |
with: selector |
|
2854 | 632 |
] ifFalse:[ |
3779 | 633 |
'<A INFO="Click to browse method" |
3894 | 634 |
ACTION="doit: SystemBrowser default openInClass:%1 selector: %2"> |
3779 | 635 |
<CODE>%1>>%3</CODE></A>' |
636 |
bindWith: className |
|
637 |
with: selector storeString |
|
638 |
with: selector |
|
2854 | 639 |
] |
2798 | 640 |
|
2854 | 641 |
"Created: / 26-07-2012 / 10:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3779 | 642 |
! |
643 |
||
644 |
linkToPackage: packageId |
|
645 |
||
646 |
^'<A INFO="Click to browse package" |
|
3894 | 647 |
ACTION="doit: SystemBrowser default openOnPackage:''%1''"> |
3779 | 648 |
<CODE>%1</CODE></A>' |
649 |
bindWith: packageId |
|
2798 | 650 |
! ! |
651 |
||
652 |
!ProjectProblem::ClassProblem methodsFor:'accessing'! |
|
653 |
||
654 |
className |
|
655 |
^ className |
|
656 |
! |
|
657 |
||
658 |
className:something |
|
659 |
className := something. |
|
2854 | 660 |
! |
661 |
||
662 |
klass |
|
663 |
"Return the class which is subject of the problem" |
|
2911 | 664 |
|
3143 | 665 |
"/ | class | |
666 |
"/ |
|
667 |
"/ (className endsWith: ' class') ifTrue:[ |
|
668 |
"/ class := Smalltalk at: (className copyTo: className size - 6) asSymbol. |
|
669 |
"/ class := class theMetaclass. |
|
670 |
"/ ] ifFalse:[ |
|
671 |
"/ class := Smalltalk at: className asSymbol |
|
672 |
"/ ]. |
|
673 |
"/ ^class |
|
2854 | 674 |
|
3143 | 675 |
"/ the above is exactly: |
3154 | 676 |
^ Smalltalk classNamed:className |
2854 | 677 |
|
678 |
"Created: / 26-07-2012 / 10:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 679 |
! ! |
680 |
||
3198 | 681 |
!ProjectProblem::ClassProblem methodsFor:'fixing'! |
682 |
||
683 |
doUpdateAllProjectDefinitions |
|
684 |
"full update the project definition class; |
|
685 |
will do a rescan to add all missing items" |
|
686 |
||
687 |
| def | |
|
688 |
||
689 |
def := self packageDefinitionClass. |
|
690 |
def isNil ifTrue:[ ^ false ]. |
|
691 |
||
692 |
def |
|
693 |
updateMethodsCodeUsingCompiler:Compiler |
|
694 |
ignoreOldDefinition:false. |
|
695 |
||
696 |
UserNotification notify: ('Project definitions updated. Do not forget to check in build support files!!'). |
|
697 |
^true |
|
698 |
! ! |
|
699 |
||
3549 | 700 |
!ProjectProblem::InconsistentProjectDefinition methodsFor:'fixing'! |
2911 | 701 |
|
3160 | 702 |
fixes |
3790 | 703 |
"return a list of description-actionBlock pairs for possible fixes" |
2911 | 704 |
|
3160 | 705 |
^Array |
3809 | 706 |
with: (Array |
3816 | 707 |
with: ('Full update of the package definition (rescan) of "%1"' bindWith:package) |
3809 | 708 |
with: [ self doUpdateAllProjectDefinitions ]) |
2911 | 709 |
! ! |
710 |
||
3449 | 711 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'! |
712 |
||
713 |
poolName |
|
714 |
^ poolName |
|
715 |
! |
|
716 |
||
717 |
poolName:something |
|
718 |
poolName := something. |
|
719 |
! ! |
|
720 |
||
721 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'! |
|
722 |
||
723 |
description |
|
724 |
"Return a (HTML) describing the problem." |
|
725 |
||
726 |
^ |
|
727 |
'Class %2 is listed in project definition (%1) before one of its pools (%3). |
|
728 |
<br>Such class will fail to compile (if the package is being stc-compiled) |
|
729 |
and load (if the package is being loaded from source). |
|
730 |
<br>Make sure class (%3) is listed before (%2). |
|
731 |
||
732 |
' |
|
733 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
734 |
with: (self linkToClass: className) |
|
735 |
with: (self linkToClass: poolName) |
|
736 |
||
737 |
"Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
738 |
! |
|
739 |
||
740 |
label |
|
741 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
742 |
||
743 |
^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass |
|
744 |
||
745 |
"Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
! ! |
|
747 |
||
748 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'! |
|
749 |
||
750 |
superClassName |
|
751 |
^ superClassName |
|
752 |
! |
|
753 |
||
754 |
superClassName:something |
|
755 |
superClassName := something. |
|
756 |
! ! |
|
757 |
||
758 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'! |
|
759 |
||
760 |
description |
|
761 |
"Return a (HTML) describing the problem." |
|
762 |
||
763 |
^ |
|
764 |
'Class %2 is listed in project definition (%1) before its superclass %3. |
|
765 |
<br>The package can be stc-compiled |
|
766 |
(because the generated makefile compiles in correct order) |
|
767 |
but the class may fail to load from source. |
|
768 |
<br>Make sure %3 is listed before %2. |
|
769 |
||
770 |
' |
|
771 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
772 |
with: (self linkToClass: className) |
|
773 |
with: (self linkToClass: superClassName) |
|
774 |
||
775 |
"Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
776 |
! |
|
777 |
||
778 |
label |
|
779 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
780 |
||
3691 | 781 |
^'Class %1 listed in project definition "%2" before its superclass %3' |
782 |
bindWith: className allBold |
|
783 |
with:self packageDefinitionClass |
|
784 |
with:superClassName |
|
3449 | 785 |
|
786 |
"Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
787 |
! ! |
|
788 |
||
2911 | 789 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing'! |
790 |
||
3160 | 791 |
severity |
792 |
"Return a severity - one of #error, #warning, #info" |
|
793 |
||
794 |
^#error |
|
795 |
||
796 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
797 |
! ! |
|
798 |
||
799 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing-description'! |
|
800 |
||
2911 | 801 |
description |
802 |
"Return a (HTML) describing the problem." |
|
3550 | 803 |
|
804 |
|msg| |
|
2911 | 805 |
|
3550 | 806 |
self klass isNil ifTrue:[ |
807 |
msg := |
|
808 |
'Class "<code>%1</code>" is listed in the project definition but not present in the system. |
|
809 |
<br> |
|
2911 | 810 |
You should either create it or remove it from %2.' |
3550 | 811 |
] ifFalse:[ |
812 |
msg := |
|
813 |
'Class "<code>%1</code>" is listed in the project definition but is located in another package ("',self klass package,'") |
|
814 |
<br> |
|
815 |
You should either move the class to this package it or remove it from the list in %2.' |
|
816 |
]. |
|
817 |
^ msg |
|
818 |
bindWith: className |
|
819 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
|
2911 | 820 |
|
821 |
"Modified: / 28-02-2012 / 22:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
822 |
! |
|
823 |
||
824 |
label |
|
3160 | 825 |
^'Missing class: ', className allBold |
2911 | 826 |
|
827 |
"Modified: / 23-02-2012 / 13:20:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
828 |
! ! |
|
829 |
||
3550 | 830 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'fixing'! |
831 |
||
832 |
alreadyFixed |
|
833 |
| cls def | |
|
834 |
||
835 |
def := self packageDefinitionClass. |
|
836 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
837 |
||
838 |
(def compiled_classNames includes:className) ifFalse:[^ true]. |
|
839 |
||
840 |
cls := self klass. |
|
841 |
cls isNil ifTrue:[^ false]. |
|
842 |
||
843 |
^ cls package = self package |
|
844 |
! |
|
845 |
||
846 |
doMoveClassToPackage |
|
3806 | 847 |
| cls def | |
848 |
||
849 |
def := self packageDefinitionClass. |
|
850 |
def isNil ifTrue:[ ^ false ]. |
|
851 |
cls := self klass. |
|
852 |
cls isNil ifTrue:[ ^ false ]. |
|
853 |
cls package:def package. |
|
854 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
|
855 |
^true |
|
856 |
! |
|
857 |
||
858 |
doRemoveClassFromProjectDefinition |
|
859 |
| def cls | |
|
860 |
||
861 |
def := self packageDefinitionClass. |
|
862 |
def isNil ifTrue:[ ^ false ]. |
|
863 |
cls := self klass. |
|
864 |
cls isNil ifTrue:[ ^ false ]. |
|
865 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
866 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
867 |
^true |
|
868 |
! |
|
869 |
||
870 |
fixes |
|
871 |
"return a list of description-actionBlock pairs for possible fixes" |
|
872 |
||
873 |
|allFixes| |
|
874 |
||
875 |
allFixes := OrderedCollection new. |
|
876 |
allFixes add:{ |
|
877 |
'Remove from project definition' . |
|
878 |
[ self doRemoveClassFromProjectDefinition ] |
|
879 |
}. |
|
880 |
self klass notNil ifTrue:[ |
|
881 |
allFixes add:{ |
|
882 |
'Move class to package' . |
|
883 |
[ self doMoveClassToPackage ] |
|
884 |
}. |
|
885 |
]. |
|
886 |
allFixes addAll:super fixes. |
|
887 |
^ allFixes |
|
888 |
! ! |
|
889 |
||
890 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'accessing'! |
|
891 |
||
892 |
severity |
|
893 |
"Return a severity - one of #error, #warning, #info" |
|
894 |
||
895 |
^#error |
|
896 |
||
897 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
898 |
! ! |
|
899 |
||
900 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'accessing-description'! |
|
901 |
||
902 |
description |
|
903 |
"Return a (HTML) describing the problem." |
|
904 |
||
905 |
|msg| |
|
906 |
||
907 |
msg := |
|
908 |
'Class "<code>%1</code>" is listed in the project definition but is assigned to another package (%2). |
|
909 |
<br> |
|
910 |
You should either remove it from the classList %3 or completely assign it to %4.'. |
|
911 |
||
912 |
^ msg |
|
913 |
bindWith: className |
|
914 |
with:(self klass package) |
|
915 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
916 |
with: package |
|
917 |
! |
|
918 |
||
919 |
label |
|
920 |
^'Class %1 is assigned to another package (%2)' |
|
921 |
bindWith:className allBold |
|
922 |
with: self klass package |
|
923 |
! ! |
|
924 |
||
925 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'fixing'! |
|
926 |
||
927 |
alreadyFixed |
|
928 |
| cls def | |
|
929 |
||
930 |
def := self packageDefinitionClass. |
|
931 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
932 |
||
933 |
(def allClassNames includes:className) ifFalse:[^ true]. |
|
3550 | 934 |
|
935 |
cls := self klass. |
|
3806 | 936 |
cls isNil ifTrue:[^ false]. |
937 |
||
938 |
^ cls package = package |
|
939 |
! |
|
940 |
||
941 |
doMoveClassToPackage |
|
942 |
| cls def | |
|
943 |
||
944 |
def := self packageDefinitionClass. |
|
945 |
def isNil ifTrue:[ ^ false ]. |
|
946 |
cls := self klass. |
|
3550 | 947 |
cls isNil ifTrue:[ ^ false ]. |
3806 | 948 |
cls package:def package. |
3550 | 949 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
950 |
^true |
|
951 |
! |
|
952 |
||
953 |
doRemoveClassFromProjectDefinition |
|
954 |
| def cls | |
|
955 |
||
956 |
def := self packageDefinitionClass. |
|
957 |
def isNil ifTrue:[ ^ false ]. |
|
958 |
cls := self klass. |
|
959 |
cls isNil ifTrue:[ ^ false ]. |
|
960 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
961 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
962 |
^true |
|
963 |
! |
|
964 |
||
965 |
fixes |
|
3790 | 966 |
"return a list of description-actionBlock pairs for possible fixes" |
967 |
||
3550 | 968 |
|allFixes| |
969 |
||
970 |
allFixes := OrderedCollection new. |
|
971 |
allFixes add:{ |
|
972 |
'Remove from project definition' . |
|
973 |
[ self doRemoveClassFromProjectDefinition ] |
|
974 |
}. |
|
975 |
self klass notNil ifTrue:[ |
|
976 |
allFixes add:{ |
|
977 |
'Move class to package' . |
|
978 |
[ self doMoveClassToPackage ] |
|
979 |
}. |
|
980 |
]. |
|
981 |
allFixes addAll:super fixes. |
|
982 |
^ allFixes |
|
983 |
! ! |
|
984 |
||
3160 | 985 |
!ProjectProblem::ClassListedMultipleTimes methodsFor:'accessing-description'! |
2911 | 986 |
|
987 |
description |
|
988 |
"Return a (HTML) describing the problem." |
|
989 |
||
990 |
^ |
|
991 |
'A class %1 is listed more than once in %2. |
|
992 |
||
993 |
Such package will fail to compile, as linker will complain |
|
3147 | 994 |
about multiple definitions of the same symbols. Make sure each |
2911 | 995 |
class is listed only once. |
996 |
' |
|
997 |
bindWith: (self linkToClass: className) |
|
3645
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
998 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
999 |
|
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
1000 |
"Modified: / 26-11-2014 / 09:25:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2911 | 1001 |
! |
1002 |
||
1003 |
label |
|
1004 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1005 |
||
3160 | 1006 |
^'Class %1 listed multiple times in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
2911 | 1007 |
|
1008 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1009 |
! ! |
|
1010 |
||
3160 | 1011 |
!ProjectProblem::ClassNotListed methodsFor:'accessing-description'! |
2798 | 1012 |
|
1013 |
description |
|
1014 |
"Return a (HTML) describing the problem." |
|
1015 |
||
1016 |
^ |
|
3147 | 1017 |
'Class %1 is not listed in project definition (%2). |
1018 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
2854 | 1019 |
at all.' |
1020 |
bindWith: (self linkToClass: className) |
|
1021 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
1022 |
||
1023 |
"Modified: / 26-07-2012 / 10:27:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1024 |
! |
|
1025 |
||
3143 | 1026 |
label |
1027 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1028 |
||
3160 | 1029 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
3143 | 1030 |
|
1031 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1032 |
! ! |
|
1033 |
||
1034 |
!ProjectProblem::ClassNotListed methodsFor:'fixing'! |
|
1035 |
||
3549 | 1036 |
alreadyFixed |
1037 |
| cls def | |
|
1038 |
||
1039 |
def := self packageDefinitionClass. |
|
1040 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
1041 |
||
1042 |
cls := self klass. |
|
1043 |
"/ One may "fix" the problem by actually removing the class. |
|
1044 |
"/ In this case, consider problem as "fixed". |
|
1045 |
cls isNil ifTrue:[^ true]. |
|
1046 |
||
1047 |
^ (def compiled_classNames includes:className) |
|
1048 |
! |
|
1049 |
||
1050 |
doIncludeAllClassesInProject |
|
1051 |
"Include all unlisted subject classes in project definition. |
|
1052 |
Return false if fix fails, true otherwise" |
|
1053 |
||
1054 |
|any| |
|
1055 |
||
1056 |
any := false. |
|
1057 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1058 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
1059 |
]. |
|
1060 |
^ any |
|
1061 |
! |
|
1062 |
||
2854 | 1063 |
doIncludeInProject |
1064 |
"Include subject class in project definition. Return false if |
|
1065 |
fix fails, true otherwise" |
|
2798 | 1066 |
|
3160 | 1067 |
^ self doIncludeInProjectAsAutoloaded:false |
2854 | 1068 |
! |
2798 | 1069 |
|
2854 | 1070 |
doIncludeInProjectAsAutoloaded |
1071 |
"Include subject class in project definition. Return false if |
|
1072 |
fix fails, true otherwise" |
|
3160 | 1073 |
|
1074 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1075 |
! |
|
1076 |
||
1077 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1078 |
"Include subject class in project definition. Return false if |
|
1079 |
fix fails, true otherwise" |
|
1080 |
||
2854 | 1081 |
| def cls | |
3160 | 1082 |
|
2854 | 1083 |
def := self packageDefinitionClass. |
1084 |
def isNil ifTrue:[ ^ false ]. |
|
1085 |
cls := self klass. |
|
1086 |
cls isNil ifTrue:[ ^ false ]. |
|
3160 | 1087 |
asAutoloaded ifTrue:[ |
1088 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1089 |
] ifFalse:[ |
|
1090 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1091 |
]. |
|
3144 | 1092 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
2854 | 1093 |
^true |
1094 |
||
1095 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1096 |
! |
|
1097 |
||
1098 |
fixes |
|
3790 | 1099 |
"return a list of description-actionBlock pairs for possible fixes" |
1100 |
||
3549 | 1101 |
|numOther fixes| |
2854 | 1102 |
|
3549 | 1103 |
numOther := self countOtherProblemsOfThisKind. |
1104 |
fixes := OrderedCollection new. |
|
1105 |
fixes add:{ 'Add class to project (as compiled)' . |
|
1106 |
[ self doIncludeInProject ] |
|
1107 |
}. |
|
1108 |
numOther > 0 ifTrue:[ |
|
1109 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
1110 |
[ self doIncludeAllClassesInProject ] |
|
1111 |
}. |
|
1112 |
]. |
|
1113 |
||
1114 |
fixes |
|
1115 |
add:{ 'Add class to project as autoloaded' . |
|
1116 |
[ self doIncludeInProjectAsAutoloaded ] |
|
1117 |
}; |
|
1118 |
add:{ 'Full update of the project definitions (rescan)' . |
|
1119 |
[ self doUpdateAllProjectDefinitions ] |
|
1120 |
}. |
|
1121 |
^ fixes |
|
2854 | 1122 |
|
1123 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1124 |
! ! |
1125 |
||
3449 | 1126 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'accessing'! |
3160 | 1127 |
|
2798 | 1128 |
description |
1129 |
"Return a (HTML) describing the problem." |
|
1130 |
||
1131 |
^ |
|
3779 | 1132 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass %2 is autoloaded. |
1133 |
<p> |
|
1134 |
Such class won''t compile with STC because of a missing superclass header file. |
|
3776 | 1135 |
To fix it, either make %1 autoloaded or make %2 compiled.' |
3449 | 1136 |
bindWith: (self linkToClass: className) |
1137 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
2798 | 1138 |
|
3449 | 1139 |
"Modified: / 20-09-2013 / 11:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 1140 |
! |
1141 |
||
1142 |
label |
|
1143 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1144 |
||
3449 | 1145 |
^ 'Class ', className , ' is compiled but its superclass is autoloaded' |
1146 |
||
1147 |
"Modified: / 20-09-2013 / 11:00:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1148 |
! ! |
|
1149 |
||
1150 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'fixing'! |
|
1151 |
||
1152 |
doIncludeInProjectAsAutoloaded |
|
1153 |
"Include subject class in project definition. Return false if |
|
1154 |
fix fails, true otherwise" |
|
1155 |
||
1156 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1157 |
! |
|
1158 |
||
1159 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1160 |
"Include subject class in project definition. Return false if |
|
1161 |
fix fails, true otherwise" |
|
1162 |
||
1163 |
| def cls | |
|
2911 | 1164 |
|
3449 | 1165 |
def := self packageDefinitionClass. |
1166 |
def isNil ifTrue:[ ^ false ]. |
|
1167 |
cls := self klass. |
|
1168 |
cls isNil ifTrue:[ ^ false ]. |
|
1169 |
asAutoloaded ifTrue:[ |
|
1170 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1171 |
] ifFalse:[ |
|
1172 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1173 |
]. |
|
1174 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1175 |
^true |
|
1176 |
||
1177 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1178 |
! |
|
1179 |
||
3777 | 1180 |
doMakeSuperclassCompiled |
1181 |
"Include subject's super class in project definition as compiled class. |
|
1182 |
Return false if fix fails, true otherwise" |
|
1183 |
||
3779 | 1184 |
| def cls superclass superclassDef| |
3777 | 1185 |
|
1186 |
def := self packageDefinitionClass. |
|
1187 |
def isNil ifTrue:[ ^ false ]. |
|
1188 |
cls := self klass. |
|
1189 |
cls isNil ifTrue:[ ^ false ]. |
|
3779 | 1190 |
|
3777 | 1191 |
superclass := (Smalltalk at: className) superclass. |
3779 | 1192 |
superclassDef := superclass projectDefinitionClass. |
1193 |
superclassDef isNil ifTrue:[^ false]. |
|
1194 |
||
1195 |
superclassDef includeClasses:(Array with: superclass) usingCompiler: nil. |
|
3777 | 1196 |
|
1197 |
UserNotification notify: ('Superclass added/changed. Do not forget to check in build support files!!' bindWith: className). |
|
1198 |
^true |
|
1199 |
! |
|
1200 |
||
3449 | 1201 |
fixes |
3790 | 1202 |
"return a list of description-actionBlock pairs for possible fixes" |
1203 |
||
3779 | 1204 |
|fixes superClass superPackage| |
1205 |
||
1206 |
fixes := super fixes asNewOrderedCollection. |
|
1207 |
||
1208 |
superClass := (Smalltalk at: className) superclass. |
|
1209 |
superPackage := superClass package. |
|
1210 |
||
1211 |
superPackage = package ifTrue:[ |
|
1212 |
fixes add: |
|
1213 |
{ 'Make ',className,' autoloaded in project' . |
|
1214 |
[ self doIncludeInProjectAsAutoloaded ]}. |
|
1215 |
fixes add: |
|
1216 |
{ 'Make superclass ',(superClass name),' compiled' . |
|
3777 | 1217 |
[ self doMakeSuperclassCompiled ]} . |
3779 | 1218 |
] ifFalse:[ |
1219 |
fixes add: |
|
1220 |
{ 'Make ',className,' autoloaded in project "',package,'"' . |
|
1221 |
[ self doIncludeInProjectAsAutoloaded ]}. |
|
1222 |
||
1223 |
fixes add: |
|
1224 |
{ 'Make superclass ',(superClass name),' compiled in "',superPackage,'"'. |
|
1225 |
[ self doMakeSuperclassCompiled ]} . |
|
1226 |
]. |
|
3778 | 1227 |
^ fixes |
2911 | 1228 |
! ! |
1229 |
||
3588 | 1230 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'accessing-description'! |
1231 |
||
1232 |
description |
|
1233 |
"Return a (HTML) describing the problem." |
|
1234 |
||
1235 |
^ |
|
1236 |
'Class %1 should not be assigned to a Folder-only package (%2). |
|
1237 |
Folder-only packages are only meant for organization and to visit subprojects for compilation. |
|
1238 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
1239 |
at all.' |
|
1240 |
bindWith: (self linkToClass: className) |
|
1241 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
1242 |
! |
|
1243 |
||
1244 |
label |
|
1245 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1246 |
||
1247 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
|
1248 |
||
1249 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1250 |
! ! |
|
1251 |
||
1252 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'fixing'! |
|
1253 |
||
1254 |
alreadyFixed |
|
1255 |
| cls def | |
|
1256 |
||
1257 |
def := self packageDefinitionClass. |
|
1258 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
1259 |
||
1260 |
cls := self klass. |
|
1261 |
"/ One may "fix" the problem by actually removing the class. |
|
1262 |
"/ In this case, consider problem as "fixed". |
|
1263 |
cls isNil ifTrue:[^ true]. |
|
1264 |
||
1265 |
^ (def compiled_classNames includes:className) |
|
1266 |
! |
|
1267 |
||
1268 |
doIncludeAllClassesInProject |
|
1269 |
"Include all unlisted subject classes in project definition. |
|
1270 |
Return false if fix fails, true otherwise" |
|
1271 |
||
1272 |
|any| |
|
1273 |
||
1274 |
any := false. |
|
1275 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1276 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
1277 |
]. |
|
1278 |
^ any |
|
1279 |
! |
|
1280 |
||
1281 |
doIncludeInProject |
|
1282 |
"Include subject class in project definition. Return false if |
|
1283 |
fix fails, true otherwise" |
|
1284 |
||
1285 |
^ self doIncludeInProjectAsAutoloaded:false |
|
1286 |
! |
|
1287 |
||
1288 |
doIncludeInProjectAsAutoloaded |
|
1289 |
"Include subject class in project definition. Return false if |
|
1290 |
fix fails, true otherwise" |
|
1291 |
||
1292 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1293 |
! |
|
1294 |
||
1295 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1296 |
"Include subject class in project definition. Return false if |
|
1297 |
fix fails, true otherwise" |
|
1298 |
||
1299 |
| def cls | |
|
1300 |
||
1301 |
def := self packageDefinitionClass. |
|
1302 |
def isNil ifTrue:[ ^ false ]. |
|
1303 |
cls := self klass. |
|
1304 |
cls isNil ifTrue:[ ^ false ]. |
|
1305 |
asAutoloaded ifTrue:[ |
|
1306 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1307 |
] ifFalse:[ |
|
1308 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1309 |
]. |
|
1310 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1311 |
^true |
|
1312 |
||
1313 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1314 |
! |
|
1315 |
||
1316 |
fixes |
|
3790 | 1317 |
"return a list of description-actionBlock pairs for possible fixes" |
1318 |
||
3588 | 1319 |
|numOther fixes| |
1320 |
||
1321 |
numOther := self countOtherProblemsOfThisKind. |
|
1322 |
fixes := OrderedCollection new. |
|
1323 |
fixes add:{ 'Add class to project (as compiled)' . |
|
1324 |
[ self doIncludeInProject ] |
|
1325 |
}. |
|
1326 |
numOther > 0 ifTrue:[ |
|
1327 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
1328 |
[ self doIncludeAllClassesInProject ] |
|
1329 |
}. |
|
1330 |
]. |
|
1331 |
||
1332 |
fixes |
|
1333 |
add:{ 'Add class to project as autoloaded' . |
|
1334 |
[ self doIncludeInProjectAsAutoloaded ] |
|
1335 |
}; |
|
1336 |
add:{ 'Full update of the project definitions (rescan)' . |
|
1337 |
[ self doUpdateAllProjectDefinitions ] |
|
1338 |
}. |
|
1339 |
^ fixes |
|
1340 |
||
1341 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1342 |
! ! |
|
1343 |
||
2911 | 1344 |
!ProjectProblem::ClassUsesPoolProblem methodsFor:'accessing'! |
1345 |
||
2798 | 1346 |
poolName |
1347 |
^ poolName |
|
1348 |
! |
|
1349 |
||
1350 |
poolName:something |
|
1351 |
poolName := something. |
|
1352 |
! ! |
|
1353 |
||
3160 | 1354 |
!ProjectProblem::ClassUsesPoolButItIsNotASharedPool methodsFor:'accessing-description'! |
2798 | 1355 |
|
1356 |
description |
|
1357 |
"Return a (HTML) describing the problem." |
|
1358 |
||
1359 |
^ |
|
3147 | 1360 |
'A class %1 uses pool %2 but it does not exist. |
2798 | 1361 |
|
3154 | 1362 |
The pool should be removed from the class definition; |
3147 | 1363 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1364 |
bindWith: (self linkToClass: className) |
3779 | 1365 |
with: (self linkToClass: poolName) |
2798 | 1366 |
|
1367 |
"Modified: / 23-02-2012 / 13:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1368 |
! |
|
1369 |
||
1370 |
label |
|
1371 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1372 |
||
3160 | 1373 |
^'Used pool %1 is not a SharedPool' bindWith: className allBold |
2798 | 1374 |
|
1375 |
"Modified: / 23-02-2012 / 13:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1376 |
! ! |
1377 |
||
3160 | 1378 |
!ProjectProblem::ClassUsesPoolInNamespaceButNamespaceIsNotDefined methodsFor:'accessing-description'! |
2911 | 1379 |
|
1380 |
description |
|
1381 |
"Return a (HTML) describing the problem." |
|
1382 |
||
1383 |
^ |
|
3147 | 1384 |
'A class %1 uses pool %2 from same namespace as the class, |
1385 |
but the namespace is not explicitly named in the shared pools definition. |
|
2911 | 1386 |
|
1387 |
Due to a bug in stc, such code will fail to compile. A pool definition |
|
3147 | 1388 |
must contain a fully qualified class name including namespace.' |
2911 | 1389 |
bindWith: (self linkToClass: className) |
3779 | 1390 |
with: (self linkToClass: poolName) |
2911 | 1391 |
|
1392 |
"Modified: / 13-09-2012 / 16:32:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1393 |
! |
1394 |
||
2911 | 1395 |
label |
1396 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1397 |
||
3160 | 1398 |
^ 'Missing namespace prefix in shared pools definition of %1' bindWith: className allBold |
2911 | 1399 |
|
1400 |
"Modified: / 13-09-2012 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1401 |
! ! |
|
1402 |
||
3160 | 1403 |
!ProjectProblem::ClassUsesPoolButItDoesNotExist methodsFor:'accessing-description'! |
2911 | 1404 |
|
1405 |
description |
|
1406 |
"Return a (HTML) describing the problem." |
|
1407 |
||
1408 |
^ |
|
3147 | 1409 |
'A class %1 uses pool %2 but it does not exist. |
2911 | 1410 |
|
3154 | 1411 |
The pool should be removed from the class definition; |
3147 | 1412 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1413 |
bindWith: (self linkToClass: className) with: poolName |
1414 |
||
1415 |
"Modified: / 13-09-2012 / 16:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1416 |
! |
1417 |
||
2911 | 1418 |
label |
1419 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1420 |
||
3160 | 1421 |
^'Missing pool: ' , className allBold |
2911 | 1422 |
|
1423 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1424 |
! ! |
1425 |
||
1426 |
!ProjectProblem::MethodProblem methodsFor:'accessing'! |
|
1427 |
||
1428 |
className:something selector: sel |
|
1429 |
className := something. |
|
1430 |
selector := sel |
|
1431 |
||
1432 |
"Created: / 23-02-2012 / 14:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1433 |
! |
|
1434 |
||
2854 | 1435 |
method |
1436 |
| class | |
|
1437 |
||
1438 |
class := self klass. |
|
3166 | 1439 |
class isNil ifTrue:[ ^ nil ]. |
2854 | 1440 |
^class compiledMethodAt: selector |
1441 |
||
1442 |
"Created: / 26-07-2012 / 10:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1443 |
! |
|
1444 |
||
1445 |
method: method |
|
1446 |
||
1447 |
self className: method mclass name selector: method selector |
|
1448 |
||
1449 |
"Created: / 11-04-2012 / 12:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1450 |
! |
|
1451 |
||
2798 | 1452 |
selector |
1453 |
^ selector |
|
1454 |
! |
|
1455 |
||
1456 |
selector:something |
|
1457 |
selector := something. |
|
1458 |
! ! |
|
1459 |
||
3204 | 1460 |
!ProjectProblem::MethodProblem methodsFor:'fixes'! |
1461 |
||
1462 |
doRemoveMethodFromExtensionsList |
|
1463 |
"update the extension method info in the project definition. |
|
1464 |
Return false if fix fails, true otherwise" |
|
1465 |
||
1466 |
| def mthd | |
|
1467 |
||
1468 |
def := self packageDefinitionClass. |
|
1469 |
def isNil ifTrue:[ ^ false ]. |
|
1470 |
mthd := self method. |
|
1471 |
mthd isNil ifTrue:[ ^ false ]. |
|
1472 |
||
1473 |
def excludeMethods:(Array with:mthd) usingCompiler:nil. |
|
1474 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1475 |
^true |
|
1476 |
! |
|
1477 |
||
1478 |
doRemoveNamedMethodFromExtensionsList |
|
1479 |
"update the extension method info in the project definition. |
|
1480 |
Return false if fix fails, true otherwise" |
|
1481 |
||
1482 |
| def | |
|
1483 |
||
1484 |
def := self packageDefinitionClass. |
|
1485 |
def isNil ifTrue:[ ^ false ]. |
|
1486 |
||
1487 |
def excludeMethodFor:selector inClassNamed:className usingCompiler:nil. |
|
1488 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1489 |
^true |
|
1490 |
! ! |
|
1491 |
||
2798 | 1492 |
!ProjectProblem::MethodProblem methodsFor:'utilities-HTML'! |
1493 |
||
1494 |
linkToMethod |
|
1495 |
||
1496 |
^self linkToClass: className selector: selector |
|
1497 |
||
1498 |
"Created: / 23-02-2012 / 14:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1499 |
! ! |
|
1500 |
||
3166 | 1501 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'accessing-description'! |
1502 |
||
1503 |
description |
|
1504 |
"Return a (HTML) describing the problem." |
|
1505 |
||
3168 | 1506 |
|mthd text| |
3166 | 1507 |
|
3168 | 1508 |
(mthd := self method) isNil ifTrue:[ ^ 'Method removed.' ]. |
3169 | 1509 |
|
3168 | 1510 |
mthd package = mthd mclass package ifTrue:[ |
1511 |
text := |
|
3650 | 1512 |
'Method %1 is listed as an extension in "%3", but is actually associated to its class''s package "%4" (ie. not as extension). |
1513 |
<P>Maybe the method used to be an extension but is now a proper part of the class. |
|
1514 |
If this is the case, you should remove the method name from the extensions list (%3). |
|
1515 |
<P>Otherwise, the method may have lost its package information due to a recompilation in |
|
1516 |
a tool which did not known about the original package association. |
|
1517 |
Then, you should reassociate the method to the extending package.' |
|
3168 | 1518 |
] ifFalse:[ |
1519 |
text := |
|
3650 | 1520 |
'Method %1 is listed as an extension in "%3" but is actually assicualted to a different package: "%4". |
1521 |
<P>The package will compile but may fail to (auto)load from sources. |
|
1522 |
<P>It is recommended to either remove the method name from the extensions list (%3) |
|
3166 | 1523 |
or move the method it to the correct package.' |
3168 | 1524 |
]. |
1525 |
^ text |
|
1526 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1527 |
with: selector |
|
1528 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1529 |
with: mthd package |
|
3166 | 1530 |
|
1531 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1532 |
! |
|
1533 |
||
1534 |
label |
|
1535 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1536 |
||
3168 | 1537 |
|mthd text| |
1538 |
||
1539 |
text := 'Extension method %1 >> %2 listed but in different package'. |
|
1540 |
||
1541 |
(mthd := self method) notNil ifTrue:[ |
|
1542 |
mthd package = mthd mclass package ifTrue:[ |
|
1543 |
text := 'Extension method %1 >> %2 listed but in classes package' |
|
1544 |
] |
|
1545 |
]. |
|
1546 |
^ text |
|
3166 | 1547 |
bindWith: className allBold |
1548 |
with: selector allBold |
|
1549 |
||
1550 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1551 |
! ! |
|
1552 |
||
1553 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixes'! |
|
1554 |
||
3169 | 1555 |
alreadyFixed |
1556 |
|mthd| |
|
1557 |
||
1558 |
(self packageDefinitionClass extensionMethods includes:self method) ifFalse:[^ true]. |
|
1559 |
^ ((mthd := self method) notNil |
|
1560 |
and:[ mthd package = package ]) |
|
1561 |
! |
|
1562 |
||
3166 | 1563 |
doMoveMethodToProject |
1564 |
self method package:package |
|
3549 | 1565 |
! ! |
1566 |
||
1567 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixing'! |
|
3166 | 1568 |
|
1569 |
fixes |
|
3790 | 1570 |
"return a list of description-actionBlock pairs for possible fixes" |
1571 |
||
3168 | 1572 |
|mthd| |
1573 |
||
1574 |
(mthd := self method) isNil ifTrue:[ ^ #() ]. |
|
3166 | 1575 |
|
3169 | 1576 |
"/ mthd package = mthd mclass package ifTrue:[ |
1577 |
"/ ^Array |
|
1578 |
"/ with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
|
1579 |
"/ ]. |
|
1580 |
"/ |
|
3166 | 1581 |
^Array |
3169 | 1582 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
3809 | 1583 |
with: (Array with: ('Move method to package "%1"' bindWith:package) with: [ self doMoveMethodToProject ]) |
3166 | 1584 |
|
1585 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1586 |
! ! |
|
1587 |
||
3160 | 1588 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'accessing-description'! |
2798 | 1589 |
|
1590 |
description |
|
1591 |
"Return a (HTML) describing the problem." |
|
1592 |
||
3154 | 1593 |
^'Method %1 is not listed in %2. |
3143 | 1594 |
<br>It should either be listed in the project definition, or moved to the owning classes package' |
2798 | 1595 |
bindWith: (self linkToMethod) |
3169 | 1596 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
2798 | 1597 |
|
1598 |
"Modified: / 23-02-2012 / 14:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1599 |
! |
|
1600 |
||
1601 |
label |
|
1602 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1603 |
||
3160 | 1604 |
^'Extension method %1 >> %2 not listed in project definition "%3"' bindWith: className allBold with: selector allBold with:self packageDefinitionClass |
2798 | 1605 |
|
1606 |
"Modified: / 23-02-2012 / 14:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1607 |
! ! |
|
1608 |
||
3143 | 1609 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'fixing'! |
1610 |
||
3169 | 1611 |
alreadyFixed |
1612 |
^ (self packageDefinitionClass extensionMethods includes:self method) |
|
1613 |
! |
|
1614 |
||
3143 | 1615 |
doMoveToClassesPackage |
3154 | 1616 |
"move the extension method to the owning classes package. |
3143 | 1617 |
Return false if fix fails, true otherwise" |
1618 |
||
1619 |
| cls mthd | |
|
1620 |
||
1621 |
cls := self klass. |
|
1622 |
cls isNil ifTrue:[ ^ false ]. |
|
1623 |
mthd := cls compiledMethodAt:selector. |
|
1624 |
mthd package:(cls package). |
|
3809 | 1625 |
|
3143 | 1626 |
UserNotification notify: ('Do not forget to check in the method''s package (or class) ("%1")!!' bindWith:cls package). |
1627 |
^true |
|
1628 |
! |
|
1629 |
||
1630 |
doUpdateExtensionMethodsInProject |
|
3154 | 1631 |
"update the extension method info in the project definition. |
3143 | 1632 |
Return false if fix fails, true otherwise" |
1633 |
||
3169 | 1634 |
| def mthd | |
3143 | 1635 |
|
1636 |
def := self packageDefinitionClass. |
|
1637 |
def isNil ifTrue:[ ^ false ]. |
|
3169 | 1638 |
mthd := self method. |
1639 |
mthd isNil ifTrue:[ ^ false ]. |
|
1640 |
||
1641 |
def includeMethods:(Array with:mthd) usingCompiler:nil. |
|
3143 | 1642 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
1643 |
^true |
|
1644 |
! |
|
1645 |
||
1646 |
fixes |
|
3790 | 1647 |
"return a list of description-actionBlock pairs for possible fixes" |
1648 |
||
3143 | 1649 |
^Array |
3809 | 1650 |
with: (Array |
1651 |
with: ('Add method to package ("%1")' bindWith:package) |
|
1652 |
with: [ self doUpdateExtensionMethodsInProject ] ) |
|
1653 |
with: (Array |
|
1654 |
with: ('Move method to classes package ("%1")' bindWith:self klass package) |
|
1655 |
with: [ self doMoveToClassesPackage ] ) |
|
1656 |
with: (Array |
|
1657 |
with: ('Full update of the package definition (rescan) of "%1"' bindWith:self klass package) |
|
1658 |
with: [ self doUpdateAllProjectDefinitions ] ) |
|
3143 | 1659 |
! ! |
1660 |
||
3166 | 1661 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'accessing-description'! |
1662 |
||
1663 |
description |
|
1664 |
"Return a (HTML) describing the problem." |
|
1665 |
||
1666 |
^'Method %1 >> %2 listed in %3 but class does not exist. |
|
1667 |
The package will compile but may fail to (auto)load from sources. |
|
1668 |
||
1669 |
It is recommended to remove the method from the list (%3).' |
|
1670 |
bindWith: className |
|
1671 |
with: selector |
|
1672 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1673 |
! |
|
1674 |
||
1675 |
label |
|
1676 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1677 |
||
1678 |
^'Extension method %1 >> %2 listed but class not existing' |
|
1679 |
bindWith: className allBold |
|
1680 |
with: selector allBold |
|
1681 |
||
1682 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1683 |
! ! |
|
1684 |
||
3549 | 1685 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'fixing'! |
3204 | 1686 |
|
1687 |
fixes |
|
3790 | 1688 |
"return a list of description-actionBlock pairs for possible fixes" |
1689 |
||
3204 | 1690 |
^Array |
1691 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1692 |
||
1693 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1694 |
! ! |
|
1695 |
||
3449 | 1696 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'accessing'! |
3160 | 1697 |
|
1698 |
description |
|
1699 |
"Return a (HTML) describing the problem." |
|
1700 |
||
1701 |
^ |
|
3779 | 1702 |
'Class %1 is compiled (i.e. not autoloaded) but its superclass''s project |
1703 |
definition class is missing. |
|
1704 |
<BR>(superclass %2 has no project definition for "%3"). |
|
1705 |
<P> |
|
1706 |
Such class won''t compile with STC because the superclass''s package |
|
1707 |
will likely be missing.' |
|
3449 | 1708 |
bindWith: (self linkToClass: className) |
1709 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
3779 | 1710 |
with: (self linkToPackage: (Smalltalk at: className) superclass package) |
3160 | 1711 |
|
3449 | 1712 |
"Modified: / 05-10-2013 / 12:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1713 |
! |
1714 |
||
3779 | 1715 |
fixes |
3790 | 1716 |
"return a list of description-actionBlock pairs for possible fixes" |
1717 |
||
3779 | 1718 |
|fixes superClass superPackage| |
1719 |
||
1720 |
fixes := super fixes asNewOrderedCollection. |
|
1721 |
||
1722 |
superClass := (Smalltalk at: className) superclass. |
|
1723 |
superPackage := superClass package. |
|
1724 |
||
1725 |
fixes add: |
|
1726 |
{ 'Create project definition class for project "',superPackage,'"' . |
|
3809 | 1727 |
[ self createPackageDefinitionForSuperclass ] |
1728 |
}. |
|
3779 | 1729 |
|
1730 |
^ fixes |
|
1731 |
! |
|
1732 |
||
3160 | 1733 |
label |
1734 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1735 |
||
3449 | 1736 |
^ 'Class ', className , ' is compiled but its superclass''s package definition is missing' |
3160 | 1737 |
|
3449 | 1738 |
"Modified: / 05-10-2013 / 12:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1739 |
! ! |
1740 |
||
3779 | 1741 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'fixing'! |
1742 |
||
1743 |
createPackageDefinitionForSuperclass |
|
1744 |
"crate super class's project definition. |
|
1745 |
Return false if fix fails, true otherwise" |
|
1746 |
||
1747 |
| superclass superclassDef| |
|
1748 |
||
1749 |
superclass := (Smalltalk at: className) superclass. |
|
1750 |
superclassDef := ProjectDefinition definitionClassForPackage:superclass package createIfAbsent:true. |
|
1751 |
superclassDef isNil ifTrue:[^ false]. |
|
1752 |
^true |
|
1753 |
! ! |
|
1754 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1755 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing'! |
2854 | 1756 |
|
3160 | 1757 |
severity |
1758 |
^ errors notNil ifTrue:[#error] ifFalse:[#warning] |
|
1759 |
||
1760 |
"Modified: / 11-04-2012 / 15:40:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1761 |
! ! |
|
1762 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1763 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing-description'! |
3160 | 1764 |
|
2854 | 1765 |
description |
1766 |
"Return a (HTML) describing the problem." |
|
1767 |
||
1768 |
| issuePrinter | |
|
1769 |
||
3488 | 1770 |
issuePrinter := |
1771 |
[:stream :issue| |
|
1772 |
stream nextPutAll:'<li>'. |
|
1773 |
issue descriptionOn: stream. |
|
1774 |
stream nextPutAll:'</li>'. |
|
1775 |
stream cr. |
|
1776 |
]. |
|
2854 | 1777 |
|
1778 |
^ String streamContents:[:s| |
|
3488 | 1779 |
s |
1780 |
nextPutAll: 'The following problems have been found in '; |
|
1781 |
nextPutAll: self linkToMethod; |
|
1782 |
nextPutAll: ':'; cr; |
|
1783 |
nextPutAll: '<ul>'. |
|
1784 |
errors ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1785 |
warnings ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1786 |
s |
|
1787 |
nextPutAll: '</ul>'. |
|
2854 | 1788 |
|
3488 | 1789 |
errors notNil ifTrue:[ |
1790 |
s nextPutAll: |
|
3147 | 1791 |
'STC won''t compile such code, therefore you must fix it before committing' |
3488 | 1792 |
]. |
2854 | 1793 |
] |
1794 |
||
1795 |
"Modified: / 11-04-2012 / 15:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1796 |
! |
|
1797 |
||
1798 |
label |
|
1799 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1800 |
||
3160 | 1801 |
^ (errors notNil |
1802 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
|
1803 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
|
1804 |
||
2854 | 1805 |
|
1806 |
"Modified: / 11-04-2012 / 16:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1807 |
! ! |
|
1808 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1809 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'error handling'! |
2854 | 1810 |
|
3162 | 1811 |
addError:aMessage from: position to: endPos |
1812 |
errors isNil ifTrue:[ errors := OrderedCollection new]. |
|
1813 |
errors add: (Error message: aMessage from: position to: endPos) |
|
1814 |
! |
|
1815 |
||
1816 |
addWarning:aMessage from: position to: endPos |
|
1817 |
warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
|
1818 |
warnings add: (Warning message: aMessage from: position to: endPos) |
|
1819 |
! |
|
1820 |
||
2854 | 1821 |
correctableError:aMessage position:position to:endPos from:aCompiler |
1822 |
"error notification during fileIn. |
|
1823 |
This is sent by the compiler/evaluator if it detects errors." |
|
1824 |
||
1825 |
self error:aMessage position:position to:endPos from:aCompiler. |
|
1826 |
^ false. "/ no correction |
|
1827 |
||
1828 |
"Created: / 30-07-1999 / 18:11:15 / cg" |
|
1829 |
"Modified: / 02-11-2010 / 12:58:54 / cg" |
|
1830 |
! |
|
1831 |
||
1832 |
correctableSelectorWarning:aMessage position:position to:endPos from:aCompiler |
|
1833 |
"warning notification during fileIn. |
|
1834 |
This is sent by the compiler/evaluator if it detects errors." |
|
1835 |
||
1836 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1837 |
^ false. "/ no correction |
|
1838 |
||
1839 |
"Modified: / 02-11-2010 / 12:59:04 / cg" |
|
1840 |
! |
|
1841 |
||
1842 |
correctableWarning:aMessage position:position to:endPos from:aCompiler |
|
1843 |
"error notification during fileIn. |
|
1844 |
This is sent by the compiler/evaluator if it detects errors." |
|
1845 |
||
1846 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1847 |
^ false |
|
1848 |
||
1849 |
"Created: / 02-11-2010 / 13:29:40 / cg" |
|
1850 |
! |
|
1851 |
||
1852 |
error:aMessage position:position to:endPos from:aCompiler |
|
1853 |
"error notification during fileIn. |
|
1854 |
This is sent by the compiler/evaluator if it detects errors." |
|
1855 |
||
2911 | 1856 |
"Argh!!!!!!!! If its an ignorable error, why signal error!!!!!! Bad design, |
1857 |
even worse workaround. Sigh." |
|
3162 | 1858 |
(thisContext findNextContextWithSelector:#ignorableParseError: or:nil or:nil) notNil |
1859 |
"/ thisContext sender sender sender sender selector == #ignorableParseError: |
|
1860 |
ifTrue:[ ^ self ]. |
|
2911 | 1861 |
|
3162 | 1862 |
self addError:aMessage from: position to: endPos |
2854 | 1863 |
|
1864 |
"Created: / 30-07-1999 / 18:10:30 / cg" |
|
2911 | 1865 |
"Modified: / 10-09-2012 / 11:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1866 |
! |
1867 |
||
1868 |
unusedVariableWarning:aMessage position:position to:endPos from:aCompiler |
|
1869 |
"warning notification during fileIn. |
|
1870 |
This is sent by the compiler/evaluator if it detects errors." |
|
1871 |
||
1872 |
^ self warning:aMessage position:position to:endPos from:aCompiler |
|
1873 |
! |
|
1874 |
||
1875 |
warning:aMessage position:position to:endPos from:aCompiler |
|
1876 |
"warning notification during fileIn - ignore it. |
|
1877 |
This is sent by the compiler/evaluator if it detects errors." |
|
1878 |
||
2911 | 1879 |
"/ No, do not show warnings now, too many false positives |
2854 | 1880 |
"/ warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
1881 |
"/ warnings add: (Warning message: aMessage from: position to: endPos). |
|
1882 |
||
1883 |
"Created: / 30-07-1999 / 18:11:05 / cg" |
|
1884 |
"Modified (comment): / 12-04-2012 / 18:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1885 |
! ! |
|
1886 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1887 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'queries'! |
2854 | 1888 |
|
1889 |
hasIssue |
|
1890 |
^ (errors ? warnings) notNil |
|
1891 |
||
1892 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1893 |
! ! |
|
1894 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1895 |
!ProjectProblem::MethodCompilabilityIssue1::Error class methodsFor:'instance creation'! |
2854 | 1896 |
|
1897 |
message: message from: startPosition to: endPosition |
|
1898 |
||
1899 |
^self new |
|
3779 | 1900 |
message: message; |
1901 |
startPosition: startPosition; |
|
1902 |
endPosition: endPosition; |
|
1903 |
yourself. |
|
2854 | 1904 |
|
1905 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1906 |
! ! |
|
1907 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1908 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing'! |
2854 | 1909 |
|
1910 |
endPosition |
|
1911 |
^ endPosition |
|
1912 |
! |
|
1913 |
||
1914 |
endPosition:something |
|
1915 |
endPosition := something. |
|
1916 |
! |
|
1917 |
||
1918 |
message |
|
1919 |
^ message |
|
1920 |
! |
|
1921 |
||
1922 |
message:something |
|
1923 |
message := something. |
|
1924 |
! |
|
1925 |
||
1926 |
startPosition |
|
1927 |
^ startPosition |
|
1928 |
! |
|
1929 |
||
1930 |
startPosition:something |
|
1931 |
startPosition := something. |
|
1932 |
! ! |
|
1933 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1934 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing-description'! |
3160 | 1935 |
|
1936 |
descriptionOn: stream |
|
1937 |
||
1938 |
stream nextPutAll: message; space; nextPutAll:'(error)' |
|
1939 |
||
1940 |
"Created: / 11-04-2012 / 15:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1941 |
! ! |
|
1942 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1943 |
!ProjectProblem::MethodCompilabilityIssue1::Warning class methodsFor:'instance creation'! |
2854 | 1944 |
|
1945 |
message: message from: startPosition to: endPosition |
|
1946 |
||
1947 |
^self new |
|
3779 | 1948 |
message: message; |
1949 |
startPosition: startPosition; |
|
1950 |
endPosition: endPosition; |
|
1951 |
yourself. |
|
2854 | 1952 |
|
1953 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1954 |
! ! |
|
1955 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1956 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing'! |
2854 | 1957 |
|
1958 |
endPosition |
|
1959 |
^ endPosition |
|
1960 |
! |
|
1961 |
||
1962 |
endPosition:something |
|
1963 |
endPosition := something. |
|
1964 |
! |
|
1965 |
||
1966 |
message |
|
1967 |
^ message |
|
1968 |
! |
|
1969 |
||
1970 |
message:something |
|
1971 |
message := something. |
|
1972 |
! |
|
1973 |
||
1974 |
startPosition |
|
1975 |
^ startPosition |
|
1976 |
! |
|
1977 |
||
1978 |
startPosition:something |
|
1979 |
startPosition := something. |
|
1980 |
! ! |
|
1981 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1982 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing-description'! |
2798 | 1983 |
|
3160 | 1984 |
descriptionOn: stream |
2798 | 1985 |
|
3160 | 1986 |
stream nextPutAll: message; space"/; nextPutAll:'(warning)' |
2798 | 1987 |
|
3160 | 1988 |
"Created: / 11-04-2012 / 15:52:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1989 |
! ! |
|
1990 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1991 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1992 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1993 |
severity |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1994 |
| severities | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1995 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1996 |
severities := rules collect:[ :rule | rule severity ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1997 |
(severities includes: #error) ifTrue:[ ^ #error ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1998 |
^ #warning |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1999 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2000 |
"Modified: / 29-05-2014 / 15:41:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2001 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2002 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2003 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing-description'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2004 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2005 |
description |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2006 |
"Return a (HTML) describing the problem." |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2007 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2008 |
| issuePrinter | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2009 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2010 |
issuePrinter := |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2011 |
[:stream :rule| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2012 |
stream nextPutAll:'<li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2013 |
stream nextPutAll: rule name. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2014 |
stream nextPutAll: '<br></br>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2015 |
stream nextPutAll:'<p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2016 |
stream nextPutAll: rule rationale. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2017 |
stream nextPutAll:'</p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2018 |
stream nextPutAll:'</li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2019 |
stream cr. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2020 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2021 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2022 |
^ String streamContents:[:s| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2023 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2024 |
nextPutAll: 'The following problems have been found in '; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2025 |
nextPutAll: self linkToMethod; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2026 |
nextPutAll: ':'; cr; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2027 |
nextPutAll: '<ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2028 |
rules ? #() do:[:rule|issuePrinter value: s value: rule]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2029 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2030 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2031 |
nextPutAll: '</ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2032 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2033 |
errors notNil ifTrue:[ |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2034 |
s nextPutAll: |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2035 |
'STC won''t compile such code, therefore you must fix it before committing' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2036 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2037 |
] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2038 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2039 |
"Modified: / 29-05-2014 / 16:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2040 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2041 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2042 |
label |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2043 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2044 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2045 |
^ ((self severity == #error) |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2046 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2047 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2048 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2049 |
"Modified: / 29-05-2014 / 15:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2050 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2051 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2052 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'adding & removing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2053 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2054 |
addViolation: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2055 |
rules isNil ifTrue:[ rules := OrderedCollection new ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2056 |
rules add: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2057 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2058 |
"Created: / 29-05-2014 / 15:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2059 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2060 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2061 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'queries'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2062 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2063 |
hasIssue |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2064 |
^ rules notEmptyOrNil |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2065 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2066 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2067 |
"Modified: / 29-05-2014 / 15:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2068 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2069 |
|
3160 | 2070 |
!ProjectProblem::MethodInNoPackage methodsFor:'accessing-description'! |
2071 |
||
3217 | 2072 |
alreadyFixed |
3449 | 2073 |
| m | |
2074 |
||
2075 |
"/ One may "fix" the problem by actually removing the method. |
|
3790 | 2076 |
"/ In this case, also consider problem as "fixed". |
3933 | 2077 |
m := self method. |
2078 |
^ m isNil or:[m package ~= PackageId noProjectID] |
|
3449 | 2079 |
|
2080 |
"Modified (format): / 19-12-2013 / 15:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3217 | 2081 |
! |
2082 |
||
3160 | 2083 |
description |
2084 |
"Return a (HTML) describing the problem." |
|
2085 |
||
2086 |
^ |
|
2087 |
'Method %1 does not belong to any package. Such methods |
|
2088 |
are not committed and will be lost when you restart/recompile. |
|
3342 | 2089 |
Especially, it will not be included when you generate a compiled class library. |
2090 |
However, it will be kept in the changes file, so it is not completely lost. |
|
2091 |
The method should be moved to some package, %2 maybe?' |
|
3160 | 2092 |
bindWith: (self linkToMethod) |
3342 | 2093 |
with: package |
3160 | 2094 |
|
2095 |
"Modified: / 23-02-2012 / 14:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 2096 |
! |
2097 |
||
2798 | 2098 |
label |
2099 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2100 |
||
3160 | 2101 |
^'Unpackaged method %1 >> %2' bindWith: className allBold with: selector allBold |
2798 | 2102 |
|
2103 |
"Modified: / 23-02-2012 / 14:19:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2104 |
! ! |
|
2105 |
||
3549 | 2106 |
!ProjectProblem::MethodInNoPackage methodsFor:'fixing'! |
2107 |
||
3932 | 2108 |
doMoveAllListedMethodsToClassPackage |
2109 |
"move all listed methods to their corresponding classes package. |
|
2110 |
Return false if fix fails, true otherwise" |
|
2111 |
||
2112 |
| mth cls any | |
|
2113 |
||
2114 |
any := false. |
|
2115 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
2116 |
cls := p klass. |
|
2117 |
cls notNil ifTrue:[ |
|
2118 |
mth := p method. |
|
2119 |
mth notNil ifTrue:[ |
|
2120 |
cls package ~= PackageId noProjectID ifTrue:[ |
|
2121 |
mth package:(cls package). |
|
2122 |
any := true. |
|
2123 |
] |
|
2124 |
] |
|
2125 |
] |
|
2126 |
]. |
|
2127 |
^ any |
|
2128 |
! |
|
2129 |
||
3549 | 2130 |
doMoveAllListedMethodsToPackage |
2131 |
"move all listed methods to the package. |
|
2132 |
Return false if fix fails, true otherwise" |
|
2133 |
||
2134 |
| m any | |
|
2135 |
||
2136 |
any := false. |
|
2137 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
2138 |
m := p method. |
|
2139 |
m notNil ifTrue:[ |
|
2140 |
m package: package. |
|
2141 |
any := true. |
|
2142 |
] |
|
2143 |
]. |
|
2144 |
^ any |
|
2145 |
! |
|
2146 |
||
2147 |
doMoveMethodToPackage |
|
2148 |
"move the method to the package. |
|
2149 |
Return false if fix fails, true otherwise" |
|
2150 |
||
2151 |
| m | |
|
2152 |
||
2153 |
m := self method. |
|
2154 |
m notNil ifTrue:[ |
|
2155 |
m package: package. |
|
2156 |
^ true |
|
2157 |
] ifFalse:[ |
|
2158 |
^ false |
|
2159 |
] |
|
2160 |
! |
|
2161 |
||
2162 |
fixes |
|
3790 | 2163 |
"return a list of description-actionBlock pairs for possible fixes" |
2164 |
||
3932 | 2165 |
|ops| |
2166 |
||
2167 |
ops := OrderedCollection new. |
|
2168 |
||
2169 |
ops add:{ |
|
3809 | 2170 |
('Move method to package "%1"' bindWith:package) . |
3549 | 2171 |
[ self doMoveMethodToPackage ] |
2172 |
}. |
|
3932 | 2173 |
|
3549 | 2174 |
self countOtherProblemsOfThisKind > 0 ifTrue:[ |
3932 | 2175 |
ops add:{ |
2176 |
('Move all listed unpackaged methods to their class package') . |
|
2177 |
[ self doMoveAllListedMethodsToClassPackage ] |
|
2178 |
}. |
|
2179 |
||
2180 |
ops add:{ |
|
3809 | 2181 |
('Move all listed unpackaged methods to package "%1"' bindWith:package) . |
3549 | 2182 |
[ self doMoveAllListedMethodsToPackage ] |
2183 |
}. |
|
2184 |
]. |
|
3932 | 2185 |
^ ops |
3549 | 2186 |
|
2187 |
"Created: / 26-07-2012 / 09:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2188 |
! ! |
|
2189 |
||
3790 | 2190 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'accessing'! |
2191 |
||
2192 |
otherProjectDefinitionClasses |
|
2193 |
^ otherProjectDefinitionClasses |
|
2194 |
! |
|
2195 |
||
2196 |
otherProjectDefinitionClasses:aCollectionOfClasses |
|
2197 |
otherProjectDefinitionClasses := aCollectionOfClasses. |
|
2198 |
! ! |
|
2199 |
||
2200 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'accessing-description'! |
|
2201 |
||
2202 |
alreadyFixed |
|
2203 |
| m | |
|
2204 |
||
2205 |
"/ One may "fix" the problem by actually removing the method. |
|
2206 |
"/ In this case, also consider problem as "fixed". |
|
2207 |
m := self method. |
|
2208 |
^ m isNil |
|
2209 |
or:[otherProjectDefinitionClasses isEmptyOrNil |
|
3809 | 2210 |
or:[(otherProjectDefinitionClasses contains:[:cls | cls extensionMethods includes:m]) not]] |
3790 | 2211 |
! |
2212 |
||
2213 |
description |
|
2214 |
"Return a (HTML) describing the problem." |
|
2215 |
||
2216 |
^ |
|
2217 |
'Method "%1" is also listed in "%2". |
|
2218 |
The method may only be present in exactly one package, "%3" perhaps?' |
|
2219 |
bindWith: (self linkToMethod) |
|
2220 |
with: (otherProjectDefinitionClasses size == 1 |
|
2221 |
ifTrue:[ self linkToPackage: (otherProjectDefinitionClasses first package) ] |
|
2222 |
ifFalse:[ '%1 other packages' bindWith:otherProjectDefinitionClasses size ]) |
|
2223 |
with: (self linkToPackage:package) |
|
2224 |
! |
|
2225 |
||
2226 |
label |
|
2227 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2228 |
||
2229 |
^'Method %1 >> %2 also present in other pacakge(s)' bindWith: className allBold with: selector allBold |
|
2230 |
! ! |
|
2231 |
||
2232 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'fixing'! |
|
2233 |
||
2234 |
doRemoveMethodFromOtherPackages |
|
2235 |
"remove the method to the other package(s). |
|
2236 |
Return false if fix fails, true otherwise" |
|
2237 |
||
2238 |
| m | |
|
2239 |
||
2240 |
m := self method. |
|
2241 |
m isNil ifTrue:[^ false]. |
|
2242 |
||
2243 |
m package: package. |
|
2244 |
otherProjectDefinitionClasses do:[:each | |
|
2245 |
each excludeMethods:(Array with:m) usingCompiler:nil. |
|
2246 |
]. |
|
2247 |
UserNotification notify: ('Other ProjectDefinition updated. Do not forget to check that one in also!!'). |
|
2248 |
^ true. |
|
2249 |
! |
|
2250 |
||
2251 |
fixes |
|
2252 |
"return a list of description-actionBlock pairs for possible fixes" |
|
2253 |
||
2254 |
|removeThisFromOtherPackages| |
|
2255 |
||
2256 |
removeThisFromOtherPackages := |
|
2257 |
{ |
|
2258 |
('Remove method from other package(s)') . |
|
2259 |
[ self doRemoveMethodFromOtherPackages ] |
|
2260 |
}. |
|
2261 |
||
2262 |
^ { |
|
2263 |
removeThisFromOtherPackages |
|
2264 |
} |
|
2265 |
! ! |
|
2266 |
||
3160 | 2267 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'accessing-description'! |
2798 | 2268 |
|
2269 |
description |
|
2270 |
"Return a (HTML) describing the problem." |
|
2271 |
||
3166 | 2272 |
^'Method %1 listed in %3 but does not exist. |
2273 |
The package will compile but may fail to (auto)load from sources. |
|
2798 | 2274 |
|
3166 | 2275 |
It is recommended to remove the method from the list (%3).' |
2276 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
2277 |
with: selector |
|
2278 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
2798 | 2279 |
|
2280 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2281 |
! |
|
2282 |
||
2283 |
label |
|
2284 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2285 |
||
3160 | 2286 |
^'Extension method %1 >> %2 listed but not existing' bindWith: className allBold with: selector allBold |
2798 | 2287 |
|
2288 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2289 |
! ! |
|
2290 |
||
3549 | 2291 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'fixing'! |
3204 | 2292 |
|
2293 |
fixes |
|
3790 | 2294 |
"return a list of description-actionBlock pairs for possible fixes" |
2295 |
||
2296 |
^ { |
|
2297 |
{ |
|
2298 |
'Remove from the extensionMethodNames list' . |
|
2299 |
[ self doRemoveNamedMethodFromExtensionsList ] |
|
2300 |
} |
|
2301 |
} |
|
3204 | 2302 |
|
2303 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2304 |
! ! |
|
2305 |
||
2854 | 2306 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing'! |
2307 |
||
3160 | 2308 |
severity |
2309 |
"Return a severity - one of #error, #warning, #info" |
|
2310 |
||
2311 |
^#error |
|
2312 |
||
2313 |
"Created: / 11-04-2012 / 12:47:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2314 |
! ! |
|
2315 |
||
2316 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing-description'! |
|
2317 |
||
2854 | 2318 |
description |
2319 |
"Return a (HTML) describing the problem." |
|
2320 |
||
2321 |
^ |
|
2322 |
'Source code for %1 is <b>corrupted</b>. This is likely because |
|
2323 |
the binary class version does not match the source file. This may happen, |
|
3488 | 2324 |
for instance, if you compile a class library and then edit the ".st" file, |
2325 |
or you have checked out from the SCM into the file system over the existing source code, |
|
2326 |
from which the class was compiled. |
|
2327 |
<P>Be very careful with checkin or fileOut (do NOT save over any existing file), |
|
2328 |
and check the results for currupt source code, |
|
2329 |
<P>Sometimes, you can fix this by disabling the "Use Local Source" in the SCM manager''s settings |
|
2330 |
dialog. If that does not help, it is recommended to leave ST/X, restore the old source or compile a system |
|
2331 |
based on the current source, restart ST/X, reapply the changes via the Changebrowser and commit then.' |
|
2911 | 2332 |
bindWith: (self linkToMethod) |
3488 | 2333 |
with: package |
2854 | 2334 |
|
2335 |
"Modified: / 11-04-2012 / 12:47:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2336 |
! |
|
2337 |
||
2338 |
label |
|
2339 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2340 |
||
3160 | 2341 |
^ 'Corrupted source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2342 |
|
2343 |
"Modified: / 11-04-2012 / 12:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2344 |
! ! |
2345 |
||
2346 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing'! |
|
2854 | 2347 |
|
2348 |
severity |
|
2349 |
"Return a severity - one of #error, #warning, #info" |
|
2350 |
||
2351 |
^#error |
|
2352 |
||
3160 | 2353 |
"Created: / 11-04-2012 / 12:47:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2354 |
! ! |
2355 |
||
3160 | 2356 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing-description'! |
2854 | 2357 |
|
2358 |
description |
|
2359 |
"Return a (HTML) describing the problem." |
|
2360 |
||
2361 |
^ |
|
3147 | 2362 |
'Source code for %1 is not available. Check your package path |
2854 | 2363 |
and/or source code management settings. |
2364 |
' |
|
2911 | 2365 |
bindWith: (self linkToMethod) |
3779 | 2366 |
with: package |
2854 | 2367 |
|
2368 |
"Modified: / 11-04-2012 / 12:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2369 |
! |
|
2370 |
||
2371 |
label |
|
2372 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2373 |
||
3160 | 2374 |
^ 'Unavailable source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2375 |
|
2376 |
"Modified: / 11-04-2012 / 12:41:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2377 |
! ! |
2378 |
||
2379 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing'! |
|
2854 | 2380 |
|
2381 |
severity |
|
2382 |
"Return a severity - one of #error, #warning, #info" |
|
2383 |
||
2384 |
^#error |
|
2385 |
||
3160 | 2386 |
"Created: / 11-04-2012 / 12:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2387 |
! ! |
2388 |
||
3160 | 2389 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing-description'! |
2798 | 2390 |
|
2391 |
description |
|
2392 |
"Return a (HTML) describing the problem." |
|
2393 |
||
3152 | 2394 |
package = 'stx' ifTrue:[ |
3198 | 2395 |
^ |
3154 | 2396 |
'Move your code to another package. |
3198 | 2397 |
<br>The package name "stx" is reserveed for exept''s ST/X development.' |
3152 | 2398 |
]. |
2399 |
||
2798 | 2400 |
^ |
3152 | 2401 |
'A project definition class for package "%1" does not exist. |
2402 |
<br>Project definition classes keep the meta information of a package, |
|
2403 |
such as contents and build parameters. |
|
3198 | 2404 |
You <b>must</b> create it, otherwise package management won''t work, |
2405 |
and the package cannot be compiled to a binary dll.' |
|
3152 | 2406 |
bindWith: package |
2798 | 2407 |
|
2408 |
"Modified: / 23-02-2012 / 13:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2409 |
! |
|
2410 |
||
2411 |
label |
|
3152 | 2412 |
^'Project definition class for "%1" does not exist' bindWith: package |
2798 | 2413 |
|
2414 |
"Modified: / 23-02-2012 / 13:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2415 |
! ! |
|
2416 |
||
3152 | 2417 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'fixing'! |
2418 |
||
3225 | 2419 |
alreadyFixed |
2420 |
^ (ProjectDefinition definitionClassForPackage:package) notNil |
|
2421 |
! |
|
2422 |
||
3152 | 2423 |
doCreateAs:whatType |
3198 | 2424 |
|prjDef| |
2425 |
||
2426 |
prjDef := ProjectDefinition |
|
2427 |
definitionClassForPackage:package |
|
2428 |
projectType: whatType |
|
2429 |
createIfAbsent:true. |
|
2430 |
||
2431 |
prjDef |
|
2432 |
updateMethodsCodeUsingCompiler:Compiler |
|
2433 |
ignoreOldDefinition:true |
|
3152 | 2434 |
! |
2435 |
||
2436 |
doCreateAsGUIApplication |
|
2437 |
self doCreateAs:ProjectDefinition guiApplicationType |
|
2438 |
! |
|
2439 |
||
2440 |
doCreateAsLibrary |
|
2441 |
self doCreateAs:ProjectDefinition libraryType |
|
2442 |
! |
|
2443 |
||
2444 |
doCreateAsNonGUIApplication |
|
2445 |
self doCreateAs:ProjectDefinition nonGuiApplicationType |
|
2446 |
! |
|
2447 |
||
2448 |
fixes |
|
3790 | 2449 |
"return a list of description-actionBlock pairs for possible fixes" |
2450 |
||
3152 | 2451 |
package = 'stx' ifTrue:[ ^ #() ]. |
2452 |
||
3154 | 2453 |
^ Array |
3792 | 2454 |
with: (Array with: 'Create as Library' with: [ self doCreateAsLibrary ] ) |
2455 |
with: (Array with: 'Create as GUI Application' with: [ self doCreateAsGUIApplication ] ) |
|
2456 |
with: (Array with: 'Create as non-GUI Application' with: [ self doCreateAsNonGUIApplication ] ) |
|
3152 | 2457 |
! ! |
2458 |
||
2798 | 2459 |
!ProjectProblem class methodsFor:'documentation'! |
2460 |
||
2912 | 2461 |
version |
3894 | 2462 |
^ '$Header$' |
2912 | 2463 |
! |
2464 |
||
2465 |
version_CVS |
|
3894 | 2466 |
^ '$Header$' |
2912 | 2467 |
! |
2468 |
||
2854 | 2469 |
version_SVN |
3894 | 2470 |
^ '$Id$' |
2798 | 2471 |
! ! |
3160 | 2472 |