author | Claus Gittinger <cg@exept.de> |
Sat, 26 Apr 2014 11:46:13 +0200 | |
changeset 3550 | 44a44c0c231c |
parent 3549 | 4f2f1be5b4bc |
child 3562 | a16bc9e17d35 |
permissions | -rw-r--r-- |
2798 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
2911 | 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 |
||
14 |
Object subclass:#ProjectProblem |
|
3547 | 15 |
instanceVariableNames:'package fixes allProblems' |
2798 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'System-Support-Projects' |
|
19 |
! |
|
20 |
||
21 |
ProjectProblem subclass:#ClassProblem |
|
22 |
instanceVariableNames:'className' |
|
23 |
classVariableNames:'' |
|
24 |
poolDictionaries:'' |
|
25 |
privateIn:ProjectProblem |
|
26 |
! |
|
27 |
||
3160 | 28 |
ProjectProblem::ClassProblem subclass:#InconsistentProjectDefinition |
29 |
instanceVariableNames:'' |
|
2798 | 30 |
classVariableNames:'' |
31 |
poolDictionaries:'' |
|
32 |
privateIn:ProjectProblem |
|
33 |
! |
|
34 |
||
3449 | 35 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool |
36 |
instanceVariableNames:'poolName' |
|
37 |
classVariableNames:'' |
|
38 |
poolDictionaries:'' |
|
39 |
privateIn:ProjectProblem |
|
40 |
! |
|
41 |
||
42 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass |
|
43 |
instanceVariableNames:'superClassName' |
|
44 |
classVariableNames:'' |
|
45 |
poolDictionaries:'' |
|
46 |
privateIn:ProjectProblem |
|
47 |
! |
|
48 |
||
3160 | 49 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButDoesNotExist |
2798 | 50 |
instanceVariableNames:'' |
51 |
classVariableNames:'' |
|
52 |
poolDictionaries:'' |
|
53 |
privateIn:ProjectProblem |
|
54 |
! |
|
55 |
||
3160 | 56 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedMultipleTimes |
2911 | 57 |
instanceVariableNames:'' |
58 |
classVariableNames:'' |
|
59 |
poolDictionaries:'' |
|
60 |
privateIn:ProjectProblem |
|
61 |
! |
|
62 |
||
3160 | 63 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassNotListed |
2911 | 64 |
instanceVariableNames:'' |
65 |
classVariableNames:'' |
|
66 |
poolDictionaries:'' |
|
67 |
privateIn:ProjectProblem |
|
68 |
! |
|
69 |
||
3449 | 70 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassIsAutoloaded |
71 |
instanceVariableNames:'' |
|
2798 | 72 |
classVariableNames:'' |
73 |
poolDictionaries:'' |
|
74 |
privateIn:ProjectProblem |
|
75 |
! |
|
76 |
||
2911 | 77 |
ProjectProblem::ClassProblem subclass:#ClassUsesPoolProblem |
2798 | 78 |
instanceVariableNames:'poolName' |
79 |
classVariableNames:'' |
|
80 |
poolDictionaries:'' |
|
81 |
privateIn:ProjectProblem |
|
82 |
! |
|
83 |
||
2911 | 84 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItIsNotASharedPool |
85 |
instanceVariableNames:'' |
|
86 |
classVariableNames:'' |
|
87 |
poolDictionaries:'' |
|
88 |
privateIn:ProjectProblem |
|
89 |
! |
|
90 |
||
91 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolInNamespaceButNamespaceIsNotDefined |
|
92 |
instanceVariableNames:'' |
|
93 |
classVariableNames:'' |
|
94 |
poolDictionaries:'' |
|
95 |
privateIn:ProjectProblem |
|
96 |
! |
|
97 |
||
98 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItDoesNotExist |
|
99 |
instanceVariableNames:'' |
|
100 |
classVariableNames:'' |
|
101 |
poolDictionaries:'' |
|
102 |
privateIn:ProjectProblem |
|
103 |
! |
|
104 |
||
2854 | 105 |
ProjectProblem::ClassProblem subclass:#MethodProblem |
106 |
instanceVariableNames:'selector' |
|
2798 | 107 |
classVariableNames:'' |
108 |
poolDictionaries:'' |
|
109 |
privateIn:ProjectProblem |
|
110 |
! |
|
111 |
||
3166 | 112 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButInDifferentPackage |
113 |
instanceVariableNames:'' |
|
114 |
classVariableNames:'' |
|
115 |
poolDictionaries:'' |
|
116 |
privateIn:ProjectProblem |
|
117 |
! |
|
118 |
||
2798 | 119 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodNotListed |
120 |
instanceVariableNames:'' |
|
121 |
classVariableNames:'' |
|
122 |
poolDictionaries:'' |
|
123 |
privateIn:ProjectProblem |
|
124 |
! |
|
125 |
||
3166 | 126 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodsClassDoesNotExist |
127 |
instanceVariableNames:'' |
|
128 |
classVariableNames:'' |
|
129 |
poolDictionaries:'' |
|
130 |
privateIn:ProjectProblem |
|
131 |
! |
|
132 |
||
3449 | 133 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassProjectDefinitionIsMissing |
134 |
instanceVariableNames:'' |
|
3160 | 135 |
classVariableNames:'' |
136 |
poolDictionaries:'' |
|
137 |
privateIn:ProjectProblem |
|
138 |
! |
|
139 |
||
2854 | 140 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue |
141 |
instanceVariableNames:'errors warnings' |
|
142 |
classVariableNames:'' |
|
143 |
poolDictionaries:'' |
|
144 |
privateIn:ProjectProblem |
|
145 |
! |
|
146 |
||
147 |
Object subclass:#Error |
|
148 |
instanceVariableNames:'message startPosition endPosition' |
|
149 |
classVariableNames:'' |
|
150 |
poolDictionaries:'' |
|
151 |
privateIn:ProjectProblem::MethodCompilabilityIssue |
|
152 |
! |
|
153 |
||
154 |
Object subclass:#Warning |
|
155 |
instanceVariableNames:'message startPosition endPosition' |
|
156 |
classVariableNames:'' |
|
157 |
poolDictionaries:'' |
|
158 |
privateIn:ProjectProblem::MethodCompilabilityIssue |
|
159 |
! |
|
160 |
||
2798 | 161 |
ProjectProblem::MethodProblem subclass:#MethodInNoPackage |
162 |
instanceVariableNames:'' |
|
163 |
classVariableNames:'' |
|
164 |
poolDictionaries:'' |
|
165 |
privateIn:ProjectProblem |
|
166 |
! |
|
167 |
||
168 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButDoesNotExist |
|
169 |
instanceVariableNames:'' |
|
170 |
classVariableNames:'' |
|
171 |
poolDictionaries:'' |
|
172 |
privateIn:ProjectProblem |
|
173 |
! |
|
174 |
||
2854 | 175 |
ProjectProblem::MethodProblem subclass:#MethodSourceCorrupted |
176 |
instanceVariableNames:'' |
|
177 |
classVariableNames:'' |
|
178 |
poolDictionaries:'' |
|
179 |
privateIn:ProjectProblem |
|
180 |
! |
|
181 |
||
182 |
ProjectProblem::MethodProblem subclass:#MethodSourceNotAvailable |
|
183 |
instanceVariableNames:'' |
|
184 |
classVariableNames:'' |
|
185 |
poolDictionaries:'' |
|
186 |
privateIn:ProjectProblem |
|
187 |
! |
|
188 |
||
2798 | 189 |
ProjectProblem subclass:#ProjectDefinitionDoesNotExist |
190 |
instanceVariableNames:'' |
|
191 |
classVariableNames:'' |
|
192 |
poolDictionaries:'' |
|
193 |
privateIn:ProjectProblem |
|
194 |
! |
|
195 |
||
196 |
!ProjectProblem class methodsFor:'documentation'! |
|
197 |
||
198 |
copyright |
|
199 |
" |
|
200 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
2911 | 201 |
All Rights Reserved |
2798 | 202 |
|
203 |
This software is furnished under a license and may be used |
|
204 |
only in accordance with the terms of that license and with the |
|
205 |
inclusion of the above copyright notice. This software may not |
|
206 |
be provided or otherwise made available to, or used by, any |
|
207 |
other person. No title to or ownership of the software is |
|
208 |
hereby transferred. |
|
209 |
" |
|
3430 | 210 |
! |
211 |
||
212 |
documentation |
|
213 |
" |
|
214 |
I represent a problem as detect by the project consistency checker, |
|
215 |
which is optionally executed before committing a package to a repository. |
|
216 |
Typically, I find inconsistencies, uncompilable methods or missing prerequisites, |
|
217 |
which might lead to trouble when the package is later to be compiled to a dll via stc. |
|
3431 | 218 |
|
3547 | 219 |
[instance variables:] |
220 |
package - the package in question |
|
221 |
||
222 |
fixes - a collection of possible fixes |
|
223 |
(to be shown in the HTML view of the problem browser) |
|
224 |
||
225 |
allProblems - the collection of problems I am part of |
|
226 |
(only needed to be able to do the |
|
227 |
'fix other problems of this kind' operation, |
|
228 |
for example in the MethodOnNoPackage problem.) |
|
229 |
||
3431 | 230 |
[see also:] |
231 |
ProjectChecker ProjectDefinition |
|
3430 | 232 |
" |
2798 | 233 |
! ! |
234 |
||
235 |
!ProjectProblem class methodsFor:'instance creation'! |
|
236 |
||
3449 | 237 |
newClassIsCompiledButSuperclassIsAutoloaded |
238 |
||
239 |
^ClassIsCompiledButSuperclassIsAutoloaded new |
|
240 |
||
241 |
"Created: / 20-09-2013 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
242 |
! |
|
243 |
||
244 |
newClassIsCompiledButSuperclassProjectDefinitionIsMissing |
|
245 |
||
246 |
^ClassIsCompiledButSuperclassProjectDefinitionIsMissing new |
|
247 |
||
248 |
"Created: / 05-10-2013 / 12:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
249 |
! |
|
250 |
||
2911 | 251 |
newClassListedBeforeItsPool |
252 |
||
253 |
^ClassListedBeforeItsPool new |
|
254 |
||
255 |
"Created: / 13-09-2012 / 17:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
! |
|
257 |
||
258 |
newClassListedBeforeItsSuperclass |
|
259 |
||
260 |
^ClassListedBeforeItsSuperclass new |
|
261 |
||
262 |
"Created: / 13-09-2012 / 17:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
263 |
! |
|
264 |
||
2798 | 265 |
newClassListedButDoesNotExist |
266 |
||
267 |
^ClassListedButDoesNotExist new |
|
268 |
||
269 |
"Created: / 23-02-2012 / 13:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
270 |
! |
|
271 |
||
2911 | 272 |
newClassListedMultipleTimes |
273 |
||
274 |
^ClassListedMultipleTimes new |
|
275 |
||
276 |
"Created: / 13-09-2012 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
277 |
! |
|
278 |
||
2798 | 279 |
newClassNotListed |
280 |
||
281 |
^ClassNotListed new |
|
282 |
||
283 |
"Created: / 23-02-2012 / 13:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
284 |
! |
|
285 |
||
286 |
newClassUsesPoolButItDoesNotExist |
|
287 |
||
288 |
^ClassUsesPoolButItDoesNotExist new |
|
289 |
||
290 |
"Created: / 23-02-2012 / 13:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
291 |
! |
|
292 |
||
293 |
newClassUsesPoolButItIsNotASharedPool |
|
294 |
||
295 |
^ClassUsesPoolButItIsNotASharedPool new |
|
296 |
||
297 |
"Created: / 23-02-2012 / 13:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
298 |
! |
|
299 |
||
2911 | 300 |
newClassUsesPoolInNamespaceButNamespaceIsNotDefined |
301 |
||
302 |
^ClassUsesPoolInNamespaceButNamespaceIsNotDefined new |
|
303 |
||
304 |
"Created: / 13-09-2012 / 16:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 |
! |
|
306 |
||
2798 | 307 |
newExtensionMethodListedButDoesNotExist |
308 |
||
309 |
^ExtensionMethodListedButDoesNotExist new |
|
310 |
||
311 |
"Created: / 23-02-2012 / 14:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
! |
|
313 |
||
3166 | 314 |
newExtensionMethodListedButInDifferentPackage |
315 |
||
316 |
^ExtensionMethodListedButInDifferentPackage new |
|
317 |
! |
|
318 |
||
2798 | 319 |
newExtensionMethodNotListed |
320 |
||
321 |
^ExtensionMethodNotListed new |
|
322 |
||
323 |
"Created: / 23-02-2012 / 14:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
! |
|
325 |
||
3166 | 326 |
newExtensionMethodsClassDoesNotExist |
327 |
||
328 |
^ExtensionMethodsClassDoesNotExist new |
|
329 |
! |
|
330 |
||
2854 | 331 |
newMethodCompilabilityIssue |
332 |
||
333 |
^MethodCompilabilityIssue new |
|
334 |
||
335 |
"Created: / 11-04-2012 / 15:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
336 |
! |
|
337 |
||
2798 | 338 |
newMethodInNoPackage |
339 |
||
340 |
^MethodInNoPackage new |
|
341 |
||
342 |
"Created: / 23-02-2012 / 14:27:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
343 |
! |
|
344 |
||
2854 | 345 |
newMethodSourceCorrupted |
346 |
||
347 |
^MethodSourceCorrupted new |
|
348 |
||
349 |
"Created: / 11-04-2012 / 12:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
350 |
! |
|
351 |
||
352 |
newMethodSourceNotAvailable |
|
353 |
||
354 |
^MethodSourceNotAvailable new |
|
355 |
||
356 |
"Created: / 11-04-2012 / 12:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
357 |
! |
|
358 |
||
2798 | 359 |
newProjectDefinitionDoesNotExist |
360 |
||
361 |
^ProjectDefinitionDoesNotExist new |
|
362 |
||
363 |
"Created: / 23-02-2012 / 13:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
364 |
! ! |
|
365 |
||
366 |
!ProjectProblem methodsFor:'accessing'! |
|
367 |
||
3547 | 368 |
allProblems:something |
369 |
allProblems := something. |
|
370 |
! |
|
371 |
||
3549 | 372 |
countOtherProblemsOfThisKind |
373 |
^ allProblems |
|
374 |
count: |
|
375 |
[:problem | |
|
376 |
problem class == self class |
|
377 |
and:[ problem ~~ self |
|
378 |
and:[ problem alreadyFixed not]] |
|
379 |
]. |
|
380 |
! |
|
381 |
||
2798 | 382 |
description |
383 |
"Return a (HTML) describing the problem." |
|
384 |
||
385 |
^self subclassResponsibility |
|
386 |
||
387 |
"Created: / 23-02-2012 / 13:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
388 |
! |
|
389 |
||
2854 | 390 |
descriptionAndFixes |
391 |
"Return a (HTML) describing the problem plus possible fixes." |
|
392 |
||
3169 | 393 |
|descriptionText fixes| |
394 |
||
395 |
(self alreadyFixed) ifTrue:[^ 'Already fixed.']. |
|
396 |
||
397 |
descriptionText := self description. |
|
398 |
||
399 |
"/ don't use cached fixes (after a fix, the problem may return an empty fix list) |
|
400 |
fixes := self fixes. |
|
401 |
fixes isEmpty ifTrue:[ ^ descriptionText ]. |
|
2854 | 402 |
|
403 |
^String streamContents:[:html | |
|
3169 | 404 |
html nextPutAll: descriptionText. |
2798 | 405 |
|
3169 | 406 |
html nextPutAll: '<br><br>'. |
407 |
fixes size == 1 ifTrue:[ |
|
408 |
html nextPutLine: 'Possible fix:'. |
|
409 |
] ifFalse:[ |
|
410 |
html nextPutLine: 'Possible fixes:'. |
|
411 |
]. |
|
412 |
html nextPutLine:'<ul>'. |
|
413 |
fixes withIndexDo:[:fix :index| |
|
414 |
html |
|
415 |
nextPutAll:'<li><a action="doit: self application doFix: '; |
|
416 |
nextPutAll: index printString; |
|
417 |
nextPutAll:'">'; |
|
418 |
nextPutAll: fix first; |
|
419 |
nextPutAll:'</a></li>'. |
|
420 |
]. |
|
421 |
html nextPutLine:'</ul>'. |
|
2854 | 422 |
]. |
2798 | 423 |
|
2854 | 424 |
"Created: / 26-07-2012 / 09:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
425 |
! |
|
426 |
||
2798 | 427 |
label |
428 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
429 |
||
430 |
^self subclassResponsibility |
|
431 |
||
432 |
"Created: / 23-02-2012 / 13:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
433 |
! |
|
434 |
||
435 |
package |
|
436 |
^ package |
|
437 |
! |
|
438 |
||
439 |
package:aSymbol |
|
2854 | 440 |
package := aSymbol asSymbol. |
441 |
||
442 |
"Modified: / 11-04-2012 / 16:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 443 |
! |
444 |
||
445 |
packageDefinitionClass |
|
446 |
^ProjectDefinition definitionClassForPackage: package |
|
447 |
||
448 |
"Created: / 23-02-2012 / 13:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
449 |
! |
|
450 |
||
451 |
severity |
|
452 |
"Return a severity - one of #error, #warning, #info" |
|
453 |
||
2911 | 454 |
^#warning "/by default |
2798 | 455 |
|
456 |
"Created: / 23-02-2012 / 13:09:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
457 |
! ! |
|
458 |
||
2854 | 459 |
!ProjectProblem methodsFor:'fixing'! |
460 |
||
3549 | 461 |
allUnfixedProblemsOfMyKindDo:aBlock |
462 |
allProblems do:[:p | |
|
463 |
(p class == self class and:[ p alreadyFixed not]) ifTrue:[ |
|
464 |
aBlock value:p |
|
465 |
] |
|
466 |
] |
|
467 |
! |
|
468 |
||
3169 | 469 |
alreadyFixed |
470 |
^ false |
|
471 |
! |
|
472 |
||
2854 | 473 |
doFix: index |
474 |
self initializeFixes. |
|
3169 | 475 |
^ (fixes at: index) second value |
2854 | 476 |
|
477 |
"Created: / 26-07-2012 / 10:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3549 | 478 |
! |
479 |
||
480 |
fixes |
|
481 |
"Return (possibly empty) list of actions that |
|
482 |
the user may take to fix/investigate the problem. |
|
483 |
Returned value should be list of pairs (label, action block). |
|
484 |
To be overriden in subclasses. |
|
485 |
||
486 |
The list should be an array of pairs ( fix label , fix block ). |
|
487 |
Fix block should return true, if the fix was successful, |
|
488 |
false otherwise" |
|
489 |
||
490 |
^#() |
|
491 |
||
492 |
"Created: / 26-07-2012 / 09:46:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 493 |
! ! |
494 |
||
495 |
!ProjectProblem methodsFor:'initialization'! |
|
496 |
||
497 |
initializeFixes |
|
498 |
||
499 |
fixes isNil ifTrue:[ |
|
2911 | 500 |
fixes := self fixes |
2854 | 501 |
]. |
502 |
||
503 |
"/ super initialize. -- commented since inherited method does nothing |
|
504 |
||
505 |
"Created: / 26-07-2012 / 09:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
506 |
! ! |
|
507 |
||
2798 | 508 |
!ProjectProblem methodsFor:'printing & storing'! |
509 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
510 |
displayOn:aGCOrStream |
3169 | 511 |
|lbl| |
512 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
513 |
"/ 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
|
514 |
"/ 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
|
515 |
(aGCOrStream isStream) ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
516 |
^ super displayOn:aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
517 |
]. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
518 |
|
3169 | 519 |
lbl := self label. |
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
520 |
self alreadyFixed ifTrue:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
521 |
aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
522 |
nextPutAll:lbl string; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
523 |
emphasis:#italic; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
524 |
nextPutAll:' (already fixed)' |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
525 |
] ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
526 |
aGCOrStream nextPutAll:lbl. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
527 |
]. |
2798 | 528 |
|
529 |
"Created: / 14-02-2012 / 17:02:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
530 |
! |
|
531 |
||
532 |
printOn:aStream |
|
533 |
"append a printed representation if the receiver to the argument, aStream" |
|
534 |
||
535 |
super printOn:aStream. |
|
536 |
aStream nextPut:$(. |
|
537 |
self severity printOn:aStream. |
|
538 |
aStream nextPut:$:; space. |
|
539 |
self label printOn:aStream. |
|
540 |
aStream nextPut:$). |
|
541 |
||
542 |
"Modified: / 23-02-2012 / 16:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
543 |
! ! |
|
544 |
||
545 |
!ProjectProblem methodsFor:'utilities-HTML'! |
|
546 |
||
547 |
linkToClass: classOrclassName |
|
2854 | 548 |
| className | |
2798 | 549 |
|
550 |
className := classOrclassName isBehavior |
|
2911 | 551 |
ifTrue: [classOrclassName storeString] |
552 |
ifFalse:[classOrclassName]. |
|
2798 | 553 |
|
554 |
^'<A INFO="Click to browse class" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1"><CODE>%1</CODE></A>' |
|
2911 | 555 |
bindWith: className |
2798 | 556 |
|
557 |
"Created: / 23-02-2012 / 13:44:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
558 |
! |
|
559 |
||
560 |
linkToClass: classOrclassName selector: selector |
|
2854 | 561 |
^self linkToClass: classOrclassName selector: selector omitClassName: false |
562 |
||
563 |
"Created: / 23-02-2012 / 13:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
564 |
! |
|
565 |
||
566 |
linkToClass: classOrclassName selector: selector omitClassName: omitClassName |
|
2798 | 567 |
|
568 |
| className | |
|
569 |
className := classOrclassName isBehavior |
|
2911 | 570 |
ifTrue: [classOrclassName name] |
571 |
ifFalse:[classOrclassName]. |
|
2854 | 572 |
^omitClassName ifTrue:[ |
2911 | 573 |
'<A INFO="Click to browse method" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1 selector: %2"><CODE>#%3</CODE></A>' |
574 |
bindWith: className |
|
575 |
with: selector storeString |
|
576 |
with: selector |
|
2854 | 577 |
] ifFalse:[ |
2911 | 578 |
'<A INFO="Click to browse method" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1 selector: %2"><CODE>%1>>%3</CODE></A>' |
579 |
bindWith: className |
|
580 |
with: selector storeString |
|
581 |
with: selector |
|
2854 | 582 |
] |
2798 | 583 |
|
2854 | 584 |
"Created: / 26-07-2012 / 10:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 585 |
! ! |
586 |
||
587 |
!ProjectProblem::ClassProblem methodsFor:'accessing'! |
|
588 |
||
589 |
className |
|
590 |
^ className |
|
591 |
! |
|
592 |
||
593 |
className:something |
|
594 |
className := something. |
|
2854 | 595 |
! |
596 |
||
597 |
klass |
|
598 |
"Return the class which is subject of the problem" |
|
2911 | 599 |
|
3143 | 600 |
"/ | class | |
601 |
"/ |
|
602 |
"/ (className endsWith: ' class') ifTrue:[ |
|
603 |
"/ class := Smalltalk at: (className copyTo: className size - 6) asSymbol. |
|
604 |
"/ class := class theMetaclass. |
|
605 |
"/ ] ifFalse:[ |
|
606 |
"/ class := Smalltalk at: className asSymbol |
|
607 |
"/ ]. |
|
608 |
"/ ^class |
|
2854 | 609 |
|
3143 | 610 |
"/ the above is exactly: |
3154 | 611 |
^ Smalltalk classNamed:className |
2854 | 612 |
|
613 |
"Created: / 26-07-2012 / 10:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 614 |
! ! |
615 |
||
3198 | 616 |
!ProjectProblem::ClassProblem methodsFor:'fixing'! |
617 |
||
618 |
doUpdateAllProjectDefinitions |
|
619 |
"full update the project definition class; |
|
620 |
will do a rescan to add all missing items" |
|
621 |
||
622 |
| def | |
|
623 |
||
624 |
def := self packageDefinitionClass. |
|
625 |
def isNil ifTrue:[ ^ false ]. |
|
626 |
||
627 |
def |
|
628 |
updateMethodsCodeUsingCompiler:Compiler |
|
629 |
ignoreOldDefinition:false. |
|
630 |
||
631 |
UserNotification notify: ('Project definitions updated. Do not forget to check in build support files!!'). |
|
632 |
^true |
|
633 |
! ! |
|
634 |
||
3549 | 635 |
!ProjectProblem::InconsistentProjectDefinition methodsFor:'fixing'! |
2911 | 636 |
|
3160 | 637 |
fixes |
2911 | 638 |
|
3160 | 639 |
^Array |
3198 | 640 |
with: (Array with: 'Full update of the project definitions (rescan)' with: [ self doUpdateAllProjectDefinitions ]) |
2911 | 641 |
! ! |
642 |
||
3449 | 643 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'! |
644 |
||
645 |
poolName |
|
646 |
^ poolName |
|
647 |
! |
|
648 |
||
649 |
poolName:something |
|
650 |
poolName := something. |
|
651 |
! ! |
|
652 |
||
653 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'! |
|
654 |
||
655 |
description |
|
656 |
"Return a (HTML) describing the problem." |
|
657 |
||
658 |
^ |
|
659 |
'Class %2 is listed in project definition (%1) before one of its pools (%3). |
|
660 |
<br>Such class will fail to compile (if the package is being stc-compiled) |
|
661 |
and load (if the package is being loaded from source). |
|
662 |
<br>Make sure class (%3) is listed before (%2). |
|
663 |
||
664 |
' |
|
665 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
666 |
with: (self linkToClass: className) |
|
667 |
with: (self linkToClass: poolName) |
|
668 |
||
669 |
"Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
670 |
! |
|
671 |
||
672 |
label |
|
673 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
674 |
||
675 |
^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass |
|
676 |
||
677 |
"Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
678 |
! ! |
|
679 |
||
680 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'! |
|
681 |
||
682 |
superClassName |
|
683 |
^ superClassName |
|
684 |
! |
|
685 |
||
686 |
superClassName:something |
|
687 |
superClassName := something. |
|
688 |
! ! |
|
689 |
||
690 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'! |
|
691 |
||
692 |
description |
|
693 |
"Return a (HTML) describing the problem." |
|
694 |
||
695 |
^ |
|
696 |
'Class %2 is listed in project definition (%1) before its superclass %3. |
|
697 |
<br>The package can be stc-compiled |
|
698 |
(because the generated makefile compiles in correct order) |
|
699 |
but the class may fail to load from source. |
|
700 |
<br>Make sure %3 is listed before %2. |
|
701 |
||
702 |
' |
|
703 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
704 |
with: (self linkToClass: className) |
|
705 |
with: (self linkToClass: superClassName) |
|
706 |
||
707 |
"Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
708 |
! |
|
709 |
||
710 |
label |
|
711 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
712 |
||
713 |
^'Class %1 listed in project definition "%2" before its superclass' bindWith: className allBold with:self packageDefinitionClass |
|
714 |
||
715 |
"Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
716 |
! ! |
|
717 |
||
2911 | 718 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing'! |
719 |
||
3160 | 720 |
severity |
721 |
"Return a severity - one of #error, #warning, #info" |
|
722 |
||
723 |
^#error |
|
724 |
||
725 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
726 |
! ! |
|
727 |
||
728 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing-description'! |
|
729 |
||
2911 | 730 |
description |
731 |
"Return a (HTML) describing the problem." |
|
3550 | 732 |
|
733 |
|msg| |
|
2911 | 734 |
|
3550 | 735 |
self klass isNil ifTrue:[ |
736 |
msg := |
|
737 |
'Class "<code>%1</code>" is listed in the project definition but not present in the system. |
|
738 |
<br> |
|
2911 | 739 |
You should either create it or remove it from %2.' |
3550 | 740 |
] ifFalse:[ |
741 |
msg := |
|
742 |
'Class "<code>%1</code>" is listed in the project definition but is located in another package ("',self klass package,'") |
|
743 |
<br> |
|
744 |
You should either move the class to this package it or remove it from the list in %2.' |
|
745 |
]. |
|
746 |
^ msg |
|
747 |
bindWith: className |
|
748 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
|
2911 | 749 |
|
750 |
"Modified: / 28-02-2012 / 22:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
751 |
! |
|
752 |
||
753 |
label |
|
3160 | 754 |
^'Missing class: ', className allBold |
2911 | 755 |
|
756 |
"Modified: / 23-02-2012 / 13:20:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
757 |
! ! |
|
758 |
||
3550 | 759 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'fixing'! |
760 |
||
761 |
alreadyFixed |
|
762 |
| cls def | |
|
763 |
||
764 |
def := self packageDefinitionClass. |
|
765 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
766 |
||
767 |
(def compiled_classNames includes:className) ifFalse:[^ true]. |
|
768 |
||
769 |
cls := self klass. |
|
770 |
cls isNil ifTrue:[^ false]. |
|
771 |
||
772 |
^ cls package = self package |
|
773 |
! |
|
774 |
||
775 |
doMoveClassToPackage |
|
776 |
| cls | |
|
777 |
||
778 |
cls := self klass. |
|
779 |
cls isNil ifTrue:[ ^ false ]. |
|
780 |
cls package:(cls package). |
|
781 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
|
782 |
^true |
|
783 |
! |
|
784 |
||
785 |
doRemoveClassFromProjectDefinition |
|
786 |
| def cls | |
|
787 |
||
788 |
def := self packageDefinitionClass. |
|
789 |
def isNil ifTrue:[ ^ false ]. |
|
790 |
cls := self klass. |
|
791 |
cls isNil ifTrue:[ ^ false ]. |
|
792 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
793 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
794 |
^true |
|
795 |
! |
|
796 |
||
797 |
fixes |
|
798 |
|allFixes| |
|
799 |
||
800 |
allFixes := OrderedCollection new. |
|
801 |
allFixes add:{ |
|
802 |
'Remove from project definition' . |
|
803 |
[ self doRemoveClassFromProjectDefinition ] |
|
804 |
}. |
|
805 |
self klass notNil ifTrue:[ |
|
806 |
allFixes add:{ |
|
807 |
'Move class to package' . |
|
808 |
[ self doMoveClassToPackage ] |
|
809 |
}. |
|
810 |
]. |
|
811 |
allFixes addAll:super fixes. |
|
812 |
^ allFixes |
|
813 |
! ! |
|
814 |
||
3160 | 815 |
!ProjectProblem::ClassListedMultipleTimes methodsFor:'accessing-description'! |
2911 | 816 |
|
817 |
description |
|
818 |
"Return a (HTML) describing the problem." |
|
819 |
||
820 |
^ |
|
821 |
'A class %1 is listed more than once in %2. |
|
822 |
||
823 |
Such package will fail to compile, as linker will complain |
|
3147 | 824 |
about multiple definitions of the same symbols. Make sure each |
2911 | 825 |
class is listed only once. |
826 |
' |
|
827 |
bindWith: (self linkToClass: className) |
|
3154 | 828 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
2911 | 829 |
|
830 |
"Modified: / 13-09-2012 / 17:40:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
831 |
! |
|
832 |
||
833 |
label |
|
834 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
835 |
||
3160 | 836 |
^'Class %1 listed multiple times in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
2911 | 837 |
|
838 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
839 |
! ! |
|
840 |
||
3160 | 841 |
!ProjectProblem::ClassNotListed methodsFor:'accessing-description'! |
2798 | 842 |
|
843 |
description |
|
844 |
"Return a (HTML) describing the problem." |
|
845 |
||
846 |
^ |
|
3147 | 847 |
'Class %1 is not listed in project definition (%2). |
848 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
2854 | 849 |
at all.' |
850 |
bindWith: (self linkToClass: className) |
|
851 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
852 |
||
853 |
"Modified: / 26-07-2012 / 10:27:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
854 |
! |
|
855 |
||
3143 | 856 |
label |
857 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
858 |
||
3160 | 859 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
3143 | 860 |
|
861 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
862 |
! ! |
|
863 |
||
864 |
!ProjectProblem::ClassNotListed methodsFor:'fixing'! |
|
865 |
||
3549 | 866 |
alreadyFixed |
867 |
| cls def | |
|
868 |
||
869 |
def := self packageDefinitionClass. |
|
870 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
871 |
||
872 |
cls := self klass. |
|
873 |
"/ One may "fix" the problem by actually removing the class. |
|
874 |
"/ In this case, consider problem as "fixed". |
|
875 |
cls isNil ifTrue:[^ true]. |
|
876 |
||
877 |
^ (def compiled_classNames includes:className) |
|
878 |
! |
|
879 |
||
880 |
doIncludeAllClassesInProject |
|
881 |
"Include all unlisted subject classes in project definition. |
|
882 |
Return false if fix fails, true otherwise" |
|
883 |
||
884 |
|any| |
|
885 |
||
886 |
any := false. |
|
887 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
888 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
889 |
]. |
|
890 |
^ any |
|
891 |
! |
|
892 |
||
2854 | 893 |
doIncludeInProject |
894 |
"Include subject class in project definition. Return false if |
|
895 |
fix fails, true otherwise" |
|
2798 | 896 |
|
3160 | 897 |
^ self doIncludeInProjectAsAutoloaded:false |
2854 | 898 |
! |
2798 | 899 |
|
2854 | 900 |
doIncludeInProjectAsAutoloaded |
901 |
"Include subject class in project definition. Return false if |
|
902 |
fix fails, true otherwise" |
|
3160 | 903 |
|
904 |
^ self doIncludeInProjectAsAutoloaded:true |
|
905 |
! |
|
906 |
||
907 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
908 |
"Include subject class in project definition. Return false if |
|
909 |
fix fails, true otherwise" |
|
910 |
||
2854 | 911 |
| def cls | |
3160 | 912 |
|
2854 | 913 |
def := self packageDefinitionClass. |
914 |
def isNil ifTrue:[ ^ false ]. |
|
915 |
cls := self klass. |
|
916 |
cls isNil ifTrue:[ ^ false ]. |
|
3160 | 917 |
asAutoloaded ifTrue:[ |
918 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
919 |
] ifFalse:[ |
|
920 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
921 |
]. |
|
3144 | 922 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
2854 | 923 |
^true |
924 |
||
925 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
926 |
! |
|
927 |
||
928 |
fixes |
|
3549 | 929 |
|numOther fixes| |
2854 | 930 |
|
3549 | 931 |
numOther := self countOtherProblemsOfThisKind. |
932 |
fixes := OrderedCollection new. |
|
933 |
fixes add:{ 'Add class to project (as compiled)' . |
|
934 |
[ self doIncludeInProject ] |
|
935 |
}. |
|
936 |
numOther > 0 ifTrue:[ |
|
937 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
938 |
[ self doIncludeAllClassesInProject ] |
|
939 |
}. |
|
940 |
]. |
|
941 |
||
942 |
fixes |
|
943 |
add:{ 'Add class to project as autoloaded' . |
|
944 |
[ self doIncludeInProjectAsAutoloaded ] |
|
945 |
}; |
|
946 |
add:{ 'Full update of the project definitions (rescan)' . |
|
947 |
[ self doUpdateAllProjectDefinitions ] |
|
948 |
}. |
|
949 |
^ fixes |
|
2854 | 950 |
|
951 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 952 |
! ! |
953 |
||
3449 | 954 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'accessing'! |
3160 | 955 |
|
2798 | 956 |
description |
957 |
"Return a (HTML) describing the problem." |
|
958 |
||
959 |
^ |
|
3449 | 960 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass %1 is |
961 |
is autoloaded. Such class won''t compile because of missing superclass .H/.STH file. |
|
962 |
To fix it, either make %1 autoloaded ot make %2 compiled.' |
|
963 |
bindWith: (self linkToClass: className) |
|
964 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
2798 | 965 |
|
3449 | 966 |
"Modified: / 20-09-2013 / 11:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 967 |
! |
968 |
||
969 |
label |
|
970 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
971 |
||
3449 | 972 |
^ 'Class ', className , ' is compiled but its superclass is autoloaded' |
973 |
||
974 |
"Modified: / 20-09-2013 / 11:00:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
975 |
! ! |
|
976 |
||
977 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'fixing'! |
|
978 |
||
979 |
doIncludeInProjectAsAutoloaded |
|
980 |
"Include subject class in project definition. Return false if |
|
981 |
fix fails, true otherwise" |
|
982 |
||
983 |
^ self doIncludeInProjectAsAutoloaded:true |
|
984 |
! |
|
985 |
||
986 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
987 |
"Include subject class in project definition. Return false if |
|
988 |
fix fails, true otherwise" |
|
989 |
||
990 |
| def cls | |
|
2911 | 991 |
|
3449 | 992 |
def := self packageDefinitionClass. |
993 |
def isNil ifTrue:[ ^ false ]. |
|
994 |
cls := self klass. |
|
995 |
cls isNil ifTrue:[ ^ false ]. |
|
996 |
asAutoloaded ifTrue:[ |
|
997 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
998 |
] ifFalse:[ |
|
999 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1000 |
]. |
|
1001 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1002 |
^true |
|
1003 |
||
1004 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1005 |
! |
|
1006 |
||
1007 |
fixes |
|
1008 |
||
1009 |
^Array |
|
1010 |
with: (Array with: 'Add class ', className , ' to project as autoloaded' with: [ self doIncludeInProjectAsAutoloaded ]) |
|
1011 |
||
1012 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1013 |
"Modified: / 20-09-2013 / 11:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1014 |
! ! |
1015 |
||
1016 |
!ProjectProblem::ClassUsesPoolProblem methodsFor:'accessing'! |
|
1017 |
||
2798 | 1018 |
poolName |
1019 |
^ poolName |
|
1020 |
! |
|
1021 |
||
1022 |
poolName:something |
|
1023 |
poolName := something. |
|
1024 |
! ! |
|
1025 |
||
3160 | 1026 |
!ProjectProblem::ClassUsesPoolButItIsNotASharedPool methodsFor:'accessing-description'! |
2798 | 1027 |
|
1028 |
description |
|
1029 |
"Return a (HTML) describing the problem." |
|
1030 |
||
1031 |
^ |
|
3147 | 1032 |
'A class %1 uses pool %2 but it does not exist. |
2798 | 1033 |
|
3154 | 1034 |
The pool should be removed from the class definition; |
3147 | 1035 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1036 |
bindWith: (self linkToClass: className) |
3154 | 1037 |
with: (self linkToClass: poolName) |
2798 | 1038 |
|
1039 |
"Modified: / 23-02-2012 / 13:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1040 |
! |
|
1041 |
||
1042 |
label |
|
1043 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1044 |
||
3160 | 1045 |
^'Used pool %1 is not a SharedPool' bindWith: className allBold |
2798 | 1046 |
|
1047 |
"Modified: / 23-02-2012 / 13:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1048 |
! ! |
1049 |
||
3160 | 1050 |
!ProjectProblem::ClassUsesPoolInNamespaceButNamespaceIsNotDefined methodsFor:'accessing-description'! |
2911 | 1051 |
|
1052 |
description |
|
1053 |
"Return a (HTML) describing the problem." |
|
1054 |
||
1055 |
^ |
|
3147 | 1056 |
'A class %1 uses pool %2 from same namespace as the class, |
1057 |
but the namespace is not explicitly named in the shared pools definition. |
|
2911 | 1058 |
|
1059 |
Due to a bug in stc, such code will fail to compile. A pool definition |
|
3147 | 1060 |
must contain a fully qualified class name including namespace.' |
2911 | 1061 |
bindWith: (self linkToClass: className) |
3154 | 1062 |
with: (self linkToClass: poolName) |
2911 | 1063 |
|
1064 |
"Modified: / 13-09-2012 / 16:32:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1065 |
! |
1066 |
||
2911 | 1067 |
label |
1068 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1069 |
||
3160 | 1070 |
^ 'Missing namespace prefix in shared pools definition of %1' bindWith: className allBold |
2911 | 1071 |
|
1072 |
"Modified: / 13-09-2012 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1073 |
! ! |
|
1074 |
||
3160 | 1075 |
!ProjectProblem::ClassUsesPoolButItDoesNotExist methodsFor:'accessing-description'! |
2911 | 1076 |
|
1077 |
description |
|
1078 |
"Return a (HTML) describing the problem." |
|
1079 |
||
1080 |
^ |
|
3147 | 1081 |
'A class %1 uses pool %2 but it does not exist. |
2911 | 1082 |
|
3154 | 1083 |
The pool should be removed from the class definition; |
3147 | 1084 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1085 |
bindWith: (self linkToClass: className) with: poolName |
1086 |
||
1087 |
"Modified: / 13-09-2012 / 16:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1088 |
! |
1089 |
||
2911 | 1090 |
label |
1091 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1092 |
||
3160 | 1093 |
^'Missing pool: ' , className allBold |
2911 | 1094 |
|
1095 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1096 |
! ! |
1097 |
||
1098 |
!ProjectProblem::MethodProblem methodsFor:'accessing'! |
|
1099 |
||
1100 |
className:something selector: sel |
|
1101 |
className := something. |
|
1102 |
selector := sel |
|
1103 |
||
1104 |
"Created: / 23-02-2012 / 14:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1105 |
! |
|
1106 |
||
2854 | 1107 |
method |
1108 |
| class | |
|
1109 |
||
1110 |
class := self klass. |
|
3166 | 1111 |
class isNil ifTrue:[ ^ nil ]. |
2854 | 1112 |
^class compiledMethodAt: selector |
1113 |
||
1114 |
"Created: / 26-07-2012 / 10:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1115 |
! |
|
1116 |
||
1117 |
method: method |
|
1118 |
||
1119 |
self className: method mclass name selector: method selector |
|
1120 |
||
1121 |
"Created: / 11-04-2012 / 12:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1122 |
! |
|
1123 |
||
2798 | 1124 |
selector |
1125 |
^ selector |
|
1126 |
! |
|
1127 |
||
1128 |
selector:something |
|
1129 |
selector := something. |
|
1130 |
! ! |
|
1131 |
||
3204 | 1132 |
!ProjectProblem::MethodProblem methodsFor:'fixes'! |
1133 |
||
1134 |
doRemoveMethodFromExtensionsList |
|
1135 |
"update the extension method info in the project definition. |
|
1136 |
Return false if fix fails, true otherwise" |
|
1137 |
||
1138 |
| def mthd | |
|
1139 |
||
1140 |
def := self packageDefinitionClass. |
|
1141 |
def isNil ifTrue:[ ^ false ]. |
|
1142 |
mthd := self method. |
|
1143 |
mthd isNil ifTrue:[ ^ false ]. |
|
1144 |
||
1145 |
def excludeMethods:(Array with:mthd) usingCompiler:nil. |
|
1146 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1147 |
^true |
|
1148 |
! |
|
1149 |
||
1150 |
doRemoveNamedMethodFromExtensionsList |
|
1151 |
"update the extension method info in the project definition. |
|
1152 |
Return false if fix fails, true otherwise" |
|
1153 |
||
1154 |
| def | |
|
1155 |
||
1156 |
def := self packageDefinitionClass. |
|
1157 |
def isNil ifTrue:[ ^ false ]. |
|
1158 |
||
1159 |
def excludeMethodFor:selector inClassNamed:className usingCompiler:nil. |
|
1160 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1161 |
^true |
|
1162 |
! ! |
|
1163 |
||
2798 | 1164 |
!ProjectProblem::MethodProblem methodsFor:'utilities-HTML'! |
1165 |
||
1166 |
linkToMethod |
|
1167 |
||
1168 |
^self linkToClass: className selector: selector |
|
1169 |
||
1170 |
"Created: / 23-02-2012 / 14:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1171 |
! ! |
|
1172 |
||
3166 | 1173 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'accessing-description'! |
1174 |
||
1175 |
description |
|
1176 |
"Return a (HTML) describing the problem." |
|
1177 |
||
3168 | 1178 |
|mthd text| |
3166 | 1179 |
|
3168 | 1180 |
(mthd := self method) isNil ifTrue:[ ^ 'Method removed.' ]. |
3169 | 1181 |
|
3168 | 1182 |
mthd package = mthd mclass package ifTrue:[ |
1183 |
text := |
|
1184 |
'Method %1 listed in %3 but is in its classes package (%4). |
|
1185 |
Maybe the method used to be an extension but is now a proper part of the class. |
|
1186 |
||
3169 | 1187 |
It is recommended to remove the method name from the extensions list (%3).' |
3168 | 1188 |
] ifFalse:[ |
1189 |
text := |
|
1190 |
'Method %1 listed in %3 but is in a different package (%4). |
|
3166 | 1191 |
The package will compile but may fail to (auto)load from sources. |
1192 |
||
3169 | 1193 |
It is recommended to either remove the method name from the extensions list (%3) |
3166 | 1194 |
or move the method it to the correct package.' |
3168 | 1195 |
]. |
1196 |
^ text |
|
1197 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1198 |
with: selector |
|
1199 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1200 |
with: mthd package |
|
3166 | 1201 |
|
1202 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1203 |
! |
|
1204 |
||
1205 |
label |
|
1206 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1207 |
||
3168 | 1208 |
|mthd text| |
1209 |
||
1210 |
text := 'Extension method %1 >> %2 listed but in different package'. |
|
1211 |
||
1212 |
(mthd := self method) notNil ifTrue:[ |
|
1213 |
mthd package = mthd mclass package ifTrue:[ |
|
1214 |
text := 'Extension method %1 >> %2 listed but in classes package' |
|
1215 |
] |
|
1216 |
]. |
|
1217 |
^ text |
|
3166 | 1218 |
bindWith: className allBold |
1219 |
with: selector allBold |
|
1220 |
||
1221 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1222 |
! ! |
|
1223 |
||
1224 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixes'! |
|
1225 |
||
3169 | 1226 |
alreadyFixed |
1227 |
|mthd| |
|
1228 |
||
1229 |
(self packageDefinitionClass extensionMethods includes:self method) ifFalse:[^ true]. |
|
1230 |
^ ((mthd := self method) notNil |
|
1231 |
and:[ mthd package = package ]) |
|
1232 |
! |
|
1233 |
||
3166 | 1234 |
doMoveMethodToProject |
1235 |
self method package:package |
|
3549 | 1236 |
! ! |
1237 |
||
1238 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixing'! |
|
3166 | 1239 |
|
1240 |
fixes |
|
3168 | 1241 |
|mthd| |
1242 |
||
1243 |
(mthd := self method) isNil ifTrue:[ ^ #() ]. |
|
3166 | 1244 |
|
3169 | 1245 |
"/ mthd package = mthd mclass package ifTrue:[ |
1246 |
"/ ^Array |
|
1247 |
"/ with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
|
1248 |
"/ ]. |
|
1249 |
"/ |
|
3166 | 1250 |
^Array |
3169 | 1251 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
3166 | 1252 |
with: (Array with: 'Move method into package' with: [ self doMoveMethodToProject ]) |
1253 |
||
1254 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1255 |
! ! |
|
1256 |
||
3160 | 1257 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'accessing-description'! |
2798 | 1258 |
|
1259 |
description |
|
1260 |
"Return a (HTML) describing the problem." |
|
1261 |
||
3154 | 1262 |
^'Method %1 is not listed in %2. |
3143 | 1263 |
<br>It should either be listed in the project definition, or moved to the owning classes package' |
2798 | 1264 |
bindWith: (self linkToMethod) |
3169 | 1265 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
2798 | 1266 |
|
1267 |
"Modified: / 23-02-2012 / 14:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1268 |
! |
|
1269 |
||
1270 |
label |
|
1271 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1272 |
||
3160 | 1273 |
^'Extension method %1 >> %2 not listed in project definition "%3"' bindWith: className allBold with: selector allBold with:self packageDefinitionClass |
2798 | 1274 |
|
1275 |
"Modified: / 23-02-2012 / 14:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1276 |
! ! |
|
1277 |
||
3143 | 1278 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'fixing'! |
1279 |
||
3169 | 1280 |
alreadyFixed |
1281 |
^ (self packageDefinitionClass extensionMethods includes:self method) |
|
1282 |
! |
|
1283 |
||
3143 | 1284 |
doMoveToClassesPackage |
3154 | 1285 |
"move the extension method to the owning classes package. |
3143 | 1286 |
Return false if fix fails, true otherwise" |
1287 |
||
1288 |
| cls mthd | |
|
1289 |
||
1290 |
cls := self klass. |
|
1291 |
cls isNil ifTrue:[ ^ false ]. |
|
1292 |
mthd := cls compiledMethodAt:selector. |
|
1293 |
mthd package:(cls package). |
|
1294 |
UserNotification notify: ('Do not forget to check in the method''s package (or class) ("%1")!!' bindWith:cls package). |
|
1295 |
^true |
|
1296 |
! |
|
1297 |
||
1298 |
doUpdateExtensionMethodsInProject |
|
3154 | 1299 |
"update the extension method info in the project definition. |
3143 | 1300 |
Return false if fix fails, true otherwise" |
1301 |
||
3169 | 1302 |
| def mthd | |
3143 | 1303 |
|
1304 |
def := self packageDefinitionClass. |
|
1305 |
def isNil ifTrue:[ ^ false ]. |
|
3169 | 1306 |
mthd := self method. |
1307 |
mthd isNil ifTrue:[ ^ false ]. |
|
1308 |
||
1309 |
def includeMethods:(Array with:mthd) usingCompiler:nil. |
|
3143 | 1310 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
1311 |
^true |
|
1312 |
! |
|
1313 |
||
1314 |
fixes |
|
1315 |
^Array |
|
3200 | 1316 |
with: (Array with: 'Add method to project' with: [ self doUpdateExtensionMethodsInProject ]) |
3169 | 1317 |
with: (Array with: 'Move to classes package' with: [ self doMoveToClassesPackage ]) |
3198 | 1318 |
with: (Array with: 'Full update of the project definitions (rescan)' with: [ self doUpdateAllProjectDefinitions ]) |
3143 | 1319 |
! ! |
1320 |
||
3166 | 1321 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'accessing-description'! |
1322 |
||
1323 |
description |
|
1324 |
"Return a (HTML) describing the problem." |
|
1325 |
||
1326 |
^'Method %1 >> %2 listed in %3 but class does not exist. |
|
1327 |
The package will compile but may fail to (auto)load from sources. |
|
1328 |
||
1329 |
It is recommended to remove the method from the list (%3).' |
|
1330 |
bindWith: className |
|
1331 |
with: selector |
|
1332 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1333 |
! |
|
1334 |
||
1335 |
label |
|
1336 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1337 |
||
1338 |
^'Extension method %1 >> %2 listed but class not existing' |
|
1339 |
bindWith: className allBold |
|
1340 |
with: selector allBold |
|
1341 |
||
1342 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1343 |
! ! |
|
1344 |
||
3549 | 1345 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'fixing'! |
3204 | 1346 |
|
1347 |
fixes |
|
1348 |
^Array |
|
1349 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1350 |
||
1351 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1352 |
! ! |
|
1353 |
||
3449 | 1354 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'accessing'! |
3160 | 1355 |
|
1356 |
description |
|
1357 |
"Return a (HTML) describing the problem." |
|
1358 |
||
1359 |
^ |
|
3449 | 1360 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass''s package |
1361 |
definition is missing. Such class won''t compile because superclass''s package |
|
1362 |
will be likely missing.' |
|
1363 |
bindWith: (self linkToClass: className) |
|
1364 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
3160 | 1365 |
|
3449 | 1366 |
"Modified: / 05-10-2013 / 12:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1367 |
! |
1368 |
||
1369 |
label |
|
1370 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1371 |
||
3449 | 1372 |
^ 'Class ', className , ' is compiled but its superclass''s package definition is missing' |
3160 | 1373 |
|
3449 | 1374 |
"Modified: / 05-10-2013 / 12:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1375 |
! ! |
1376 |
||
2854 | 1377 |
!ProjectProblem::MethodCompilabilityIssue methodsFor:'accessing'! |
1378 |
||
3160 | 1379 |
severity |
1380 |
^ errors notNil ifTrue:[#error] ifFalse:[#warning] |
|
1381 |
||
1382 |
"Modified: / 11-04-2012 / 15:40:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1383 |
! ! |
|
1384 |
||
1385 |
!ProjectProblem::MethodCompilabilityIssue methodsFor:'accessing-description'! |
|
1386 |
||
2854 | 1387 |
description |
1388 |
"Return a (HTML) describing the problem." |
|
1389 |
||
1390 |
| issuePrinter | |
|
1391 |
||
3488 | 1392 |
issuePrinter := |
1393 |
[:stream :issue| |
|
1394 |
stream nextPutAll:'<li>'. |
|
1395 |
issue descriptionOn: stream. |
|
1396 |
stream nextPutAll:'</li>'. |
|
1397 |
stream cr. |
|
1398 |
]. |
|
2854 | 1399 |
|
1400 |
^ String streamContents:[:s| |
|
3488 | 1401 |
s |
1402 |
nextPutAll: 'The following problems have been found in '; |
|
1403 |
nextPutAll: self linkToMethod; |
|
1404 |
nextPutAll: ':'; cr; |
|
1405 |
nextPutAll: '<ul>'. |
|
1406 |
errors ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1407 |
warnings ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1408 |
s |
|
1409 |
nextPutAll: '</ul>'. |
|
2854 | 1410 |
|
3488 | 1411 |
errors notNil ifTrue:[ |
1412 |
s nextPutAll: |
|
3147 | 1413 |
'STC won''t compile such code, therefore you must fix it before committing' |
3488 | 1414 |
]. |
2854 | 1415 |
] |
1416 |
||
1417 |
"Modified: / 11-04-2012 / 15:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1418 |
! |
|
1419 |
||
1420 |
label |
|
1421 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1422 |
||
3160 | 1423 |
^ (errors notNil |
1424 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
|
1425 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
|
1426 |
||
2854 | 1427 |
|
1428 |
"Modified: / 11-04-2012 / 16:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1429 |
! ! |
|
1430 |
||
1431 |
!ProjectProblem::MethodCompilabilityIssue methodsFor:'error handling'! |
|
1432 |
||
3162 | 1433 |
addError:aMessage from: position to: endPos |
1434 |
errors isNil ifTrue:[ errors := OrderedCollection new]. |
|
1435 |
errors add: (Error message: aMessage from: position to: endPos) |
|
1436 |
! |
|
1437 |
||
1438 |
addWarning:aMessage from: position to: endPos |
|
1439 |
warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
|
1440 |
warnings add: (Warning message: aMessage from: position to: endPos) |
|
1441 |
! |
|
1442 |
||
2854 | 1443 |
correctableError:aMessage position:position to:endPos from:aCompiler |
1444 |
"error notification during fileIn. |
|
1445 |
This is sent by the compiler/evaluator if it detects errors." |
|
1446 |
||
1447 |
self error:aMessage position:position to:endPos from:aCompiler. |
|
1448 |
^ false. "/ no correction |
|
1449 |
||
1450 |
"Created: / 30-07-1999 / 18:11:15 / cg" |
|
1451 |
"Modified: / 02-11-2010 / 12:58:54 / cg" |
|
1452 |
! |
|
1453 |
||
1454 |
correctableSelectorWarning:aMessage position:position to:endPos from:aCompiler |
|
1455 |
"warning notification during fileIn. |
|
1456 |
This is sent by the compiler/evaluator if it detects errors." |
|
1457 |
||
1458 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1459 |
^ false. "/ no correction |
|
1460 |
||
1461 |
"Modified: / 02-11-2010 / 12:59:04 / cg" |
|
1462 |
! |
|
1463 |
||
1464 |
correctableWarning:aMessage position:position to:endPos from:aCompiler |
|
1465 |
"error notification during fileIn. |
|
1466 |
This is sent by the compiler/evaluator if it detects errors." |
|
1467 |
||
1468 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1469 |
^ false |
|
1470 |
||
1471 |
"Created: / 02-11-2010 / 13:29:40 / cg" |
|
1472 |
! |
|
1473 |
||
1474 |
error:aMessage position:position to:endPos from:aCompiler |
|
1475 |
"error notification during fileIn. |
|
1476 |
This is sent by the compiler/evaluator if it detects errors." |
|
1477 |
||
2911 | 1478 |
"Argh!!!!!!!! If its an ignorable error, why signal error!!!!!! Bad design, |
1479 |
even worse workaround. Sigh." |
|
3162 | 1480 |
(thisContext findNextContextWithSelector:#ignorableParseError: or:nil or:nil) notNil |
1481 |
"/ thisContext sender sender sender sender selector == #ignorableParseError: |
|
1482 |
ifTrue:[ ^ self ]. |
|
2911 | 1483 |
|
3162 | 1484 |
self addError:aMessage from: position to: endPos |
2854 | 1485 |
|
1486 |
"Created: / 30-07-1999 / 18:10:30 / cg" |
|
2911 | 1487 |
"Modified: / 10-09-2012 / 11:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1488 |
! |
1489 |
||
1490 |
unusedVariableWarning:aMessage position:position to:endPos from:aCompiler |
|
1491 |
"warning notification during fileIn. |
|
1492 |
This is sent by the compiler/evaluator if it detects errors." |
|
1493 |
||
1494 |
^ self warning:aMessage position:position to:endPos from:aCompiler |
|
1495 |
! |
|
1496 |
||
1497 |
warning:aMessage position:position to:endPos from:aCompiler |
|
1498 |
"warning notification during fileIn - ignore it. |
|
1499 |
This is sent by the compiler/evaluator if it detects errors." |
|
1500 |
||
2911 | 1501 |
"/ No, do not show warnings now, too many false positives |
2854 | 1502 |
"/ warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
1503 |
"/ warnings add: (Warning message: aMessage from: position to: endPos). |
|
1504 |
||
1505 |
"Created: / 30-07-1999 / 18:11:05 / cg" |
|
1506 |
"Modified (comment): / 12-04-2012 / 18:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1507 |
! ! |
|
1508 |
||
1509 |
!ProjectProblem::MethodCompilabilityIssue methodsFor:'queries'! |
|
1510 |
||
1511 |
hasIssue |
|
1512 |
^ (errors ? warnings) notNil |
|
1513 |
||
1514 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1515 |
! ! |
|
1516 |
||
1517 |
!ProjectProblem::MethodCompilabilityIssue::Error class methodsFor:'instance creation'! |
|
1518 |
||
1519 |
message: message from: startPosition to: endPosition |
|
1520 |
||
1521 |
^self new |
|
2911 | 1522 |
message: message; |
1523 |
startPosition: startPosition; |
|
1524 |
endPosition: endPosition; |
|
1525 |
yourself. |
|
2854 | 1526 |
|
1527 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1528 |
! ! |
|
1529 |
||
1530 |
!ProjectProblem::MethodCompilabilityIssue::Error methodsFor:'accessing'! |
|
1531 |
||
1532 |
endPosition |
|
1533 |
^ endPosition |
|
1534 |
! |
|
1535 |
||
1536 |
endPosition:something |
|
1537 |
endPosition := something. |
|
1538 |
! |
|
1539 |
||
1540 |
message |
|
1541 |
^ message |
|
1542 |
! |
|
1543 |
||
1544 |
message:something |
|
1545 |
message := something. |
|
1546 |
! |
|
1547 |
||
1548 |
startPosition |
|
1549 |
^ startPosition |
|
1550 |
! |
|
1551 |
||
1552 |
startPosition:something |
|
1553 |
startPosition := something. |
|
1554 |
! ! |
|
1555 |
||
3160 | 1556 |
!ProjectProblem::MethodCompilabilityIssue::Error methodsFor:'accessing-description'! |
1557 |
||
1558 |
descriptionOn: stream |
|
1559 |
||
1560 |
stream nextPutAll: message; space; nextPutAll:'(error)' |
|
1561 |
||
1562 |
"Created: / 11-04-2012 / 15:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1563 |
! ! |
|
1564 |
||
2854 | 1565 |
!ProjectProblem::MethodCompilabilityIssue::Warning class methodsFor:'instance creation'! |
1566 |
||
1567 |
message: message from: startPosition to: endPosition |
|
1568 |
||
1569 |
^self new |
|
2911 | 1570 |
message: message; |
1571 |
startPosition: startPosition; |
|
1572 |
endPosition: endPosition; |
|
1573 |
yourself. |
|
2854 | 1574 |
|
1575 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1576 |
! ! |
|
1577 |
||
1578 |
!ProjectProblem::MethodCompilabilityIssue::Warning methodsFor:'accessing'! |
|
1579 |
||
1580 |
endPosition |
|
1581 |
^ endPosition |
|
1582 |
! |
|
1583 |
||
1584 |
endPosition:something |
|
1585 |
endPosition := something. |
|
1586 |
! |
|
1587 |
||
1588 |
message |
|
1589 |
^ message |
|
1590 |
! |
|
1591 |
||
1592 |
message:something |
|
1593 |
message := something. |
|
1594 |
! |
|
1595 |
||
1596 |
startPosition |
|
1597 |
^ startPosition |
|
1598 |
! |
|
1599 |
||
1600 |
startPosition:something |
|
1601 |
startPosition := something. |
|
1602 |
! ! |
|
1603 |
||
3160 | 1604 |
!ProjectProblem::MethodCompilabilityIssue::Warning methodsFor:'accessing-description'! |
2798 | 1605 |
|
3160 | 1606 |
descriptionOn: stream |
2798 | 1607 |
|
3160 | 1608 |
stream nextPutAll: message; space"/; nextPutAll:'(warning)' |
2798 | 1609 |
|
3160 | 1610 |
"Created: / 11-04-2012 / 15:52:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1611 |
! ! |
|
1612 |
||
1613 |
!ProjectProblem::MethodInNoPackage methodsFor:'accessing-description'! |
|
1614 |
||
3217 | 1615 |
alreadyFixed |
3449 | 1616 |
| m | |
1617 |
||
1618 |
"/ One may "fix" the problem by actually removing the method. |
|
3549 | 1619 |
"/ In this case, consider problem as "fixed". |
3449 | 1620 |
m := self method. |
1621 |
^ m isNil or:[self method package ~= PackageId noProjectID] |
|
1622 |
||
1623 |
"Modified (format): / 19-12-2013 / 15:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3217 | 1624 |
! |
1625 |
||
3160 | 1626 |
description |
1627 |
"Return a (HTML) describing the problem." |
|
1628 |
||
1629 |
^ |
|
1630 |
'Method %1 does not belong to any package. Such methods |
|
1631 |
are not committed and will be lost when you restart/recompile. |
|
3342 | 1632 |
Especially, it will not be included when you generate a compiled class library. |
1633 |
However, it will be kept in the changes file, so it is not completely lost. |
|
1634 |
The method should be moved to some package, %2 maybe?' |
|
3160 | 1635 |
bindWith: (self linkToMethod) |
3342 | 1636 |
with: package |
3160 | 1637 |
|
1638 |
"Modified: / 23-02-2012 / 14:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 1639 |
! |
1640 |
||
2798 | 1641 |
label |
1642 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1643 |
||
3160 | 1644 |
^'Unpackaged method %1 >> %2' bindWith: className allBold with: selector allBold |
2798 | 1645 |
|
1646 |
"Modified: / 23-02-2012 / 14:19:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1647 |
! ! |
|
1648 |
||
3549 | 1649 |
!ProjectProblem::MethodInNoPackage methodsFor:'fixing'! |
1650 |
||
1651 |
doMoveAllListedMethodsToPackage |
|
1652 |
"move all listed methods to the package. |
|
1653 |
Return false if fix fails, true otherwise" |
|
1654 |
||
1655 |
| m any | |
|
1656 |
||
1657 |
any := false. |
|
1658 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1659 |
m := p method. |
|
1660 |
m notNil ifTrue:[ |
|
1661 |
m package: package. |
|
1662 |
any := true. |
|
1663 |
] |
|
1664 |
]. |
|
1665 |
^ any |
|
1666 |
! |
|
1667 |
||
1668 |
doMoveMethodToPackage |
|
1669 |
"move the method to the package. |
|
1670 |
Return false if fix fails, true otherwise" |
|
1671 |
||
1672 |
| m | |
|
1673 |
||
1674 |
m := self method. |
|
1675 |
m notNil ifTrue:[ |
|
1676 |
m package: package. |
|
1677 |
^ true |
|
1678 |
] ifFalse:[ |
|
1679 |
^ false |
|
1680 |
] |
|
1681 |
! |
|
1682 |
||
1683 |
fixes |
|
1684 |
|moveThisToPackage moveAllToTheirPackage| |
|
1685 |
||
1686 |
moveThisToPackage := |
|
1687 |
{ |
|
1688 |
('Move method to package ', package) . |
|
1689 |
[ self doMoveMethodToPackage ] |
|
1690 |
}. |
|
1691 |
||
1692 |
self countOtherProblemsOfThisKind > 0 ifTrue:[ |
|
1693 |
moveAllToTheirPackage := |
|
1694 |
{ |
|
1695 |
('Move all listed unpackaged methods to package ', package) . |
|
1696 |
[ self doMoveAllListedMethodsToPackage ] |
|
1697 |
}. |
|
1698 |
||
1699 |
^ { |
|
1700 |
moveThisToPackage . |
|
1701 |
moveAllToTheirPackage |
|
1702 |
} |
|
1703 |
]. |
|
1704 |
||
1705 |
^ { |
|
1706 |
moveThisToPackage |
|
1707 |
} |
|
1708 |
||
1709 |
"Created: / 26-07-2012 / 09:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1710 |
! ! |
|
1711 |
||
3160 | 1712 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'accessing-description'! |
2798 | 1713 |
|
1714 |
description |
|
1715 |
"Return a (HTML) describing the problem." |
|
1716 |
||
3166 | 1717 |
^'Method %1 listed in %3 but does not exist. |
1718 |
The package will compile but may fail to (auto)load from sources. |
|
2798 | 1719 |
|
3166 | 1720 |
It is recommended to remove the method from the list (%3).' |
1721 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1722 |
with: selector |
|
1723 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
2798 | 1724 |
|
1725 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1726 |
! |
|
1727 |
||
1728 |
label |
|
1729 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1730 |
||
3160 | 1731 |
^'Extension method %1 >> %2 listed but not existing' bindWith: className allBold with: selector allBold |
2798 | 1732 |
|
1733 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1734 |
! ! |
|
1735 |
||
3549 | 1736 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'fixing'! |
3204 | 1737 |
|
1738 |
fixes |
|
1739 |
^Array |
|
1740 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1741 |
||
1742 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1743 |
! ! |
|
1744 |
||
2854 | 1745 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing'! |
1746 |
||
3160 | 1747 |
severity |
1748 |
"Return a severity - one of #error, #warning, #info" |
|
1749 |
||
1750 |
^#error |
|
1751 |
||
1752 |
"Created: / 11-04-2012 / 12:47:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1753 |
! ! |
|
1754 |
||
1755 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing-description'! |
|
1756 |
||
2854 | 1757 |
description |
1758 |
"Return a (HTML) describing the problem." |
|
1759 |
||
1760 |
^ |
|
1761 |
'Source code for %1 is <b>corrupted</b>. This is likely because |
|
1762 |
the binary class version does not match the source file. This may happen, |
|
3488 | 1763 |
for instance, if you compile a class library and then edit the ".st" file, |
1764 |
or you have checked out from the SCM into the file system over the existing source code, |
|
1765 |
from which the class was compiled. |
|
1766 |
<P>Be very careful with checkin or fileOut (do NOT save over any existing file), |
|
1767 |
and check the results for currupt source code, |
|
1768 |
<P>Sometimes, you can fix this by disabling the "Use Local Source" in the SCM manager''s settings |
|
1769 |
dialog. If that does not help, it is recommended to leave ST/X, restore the old source or compile a system |
|
1770 |
based on the current source, restart ST/X, reapply the changes via the Changebrowser and commit then.' |
|
2911 | 1771 |
bindWith: (self linkToMethod) |
3488 | 1772 |
with: package |
2854 | 1773 |
|
1774 |
"Modified: / 11-04-2012 / 12:47:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1775 |
! |
|
1776 |
||
1777 |
label |
|
1778 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1779 |
||
3160 | 1780 |
^ 'Corrupted source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 1781 |
|
1782 |
"Modified: / 11-04-2012 / 12:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 1783 |
! ! |
1784 |
||
1785 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing'! |
|
2854 | 1786 |
|
1787 |
severity |
|
1788 |
"Return a severity - one of #error, #warning, #info" |
|
1789 |
||
1790 |
^#error |
|
1791 |
||
3160 | 1792 |
"Created: / 11-04-2012 / 12:47:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1793 |
! ! |
1794 |
||
3160 | 1795 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing-description'! |
2854 | 1796 |
|
1797 |
description |
|
1798 |
"Return a (HTML) describing the problem." |
|
1799 |
||
1800 |
^ |
|
3147 | 1801 |
'Source code for %1 is not available. Check your package path |
2854 | 1802 |
and/or source code management settings. |
1803 |
' |
|
2911 | 1804 |
bindWith: (self linkToMethod) |
3154 | 1805 |
with: package |
2854 | 1806 |
|
1807 |
"Modified: / 11-04-2012 / 12:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1808 |
! |
|
1809 |
||
1810 |
label |
|
1811 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1812 |
||
3160 | 1813 |
^ 'Unavailable source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 1814 |
|
1815 |
"Modified: / 11-04-2012 / 12:41:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 1816 |
! ! |
1817 |
||
1818 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing'! |
|
2854 | 1819 |
|
1820 |
severity |
|
1821 |
"Return a severity - one of #error, #warning, #info" |
|
1822 |
||
1823 |
^#error |
|
1824 |
||
3160 | 1825 |
"Created: / 11-04-2012 / 12:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1826 |
! ! |
1827 |
||
3160 | 1828 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing-description'! |
2798 | 1829 |
|
1830 |
description |
|
1831 |
"Return a (HTML) describing the problem." |
|
1832 |
||
3152 | 1833 |
package = 'stx' ifTrue:[ |
3198 | 1834 |
^ |
3154 | 1835 |
'Move your code to another package. |
3198 | 1836 |
<br>The package name "stx" is reserveed for exept''s ST/X development.' |
3152 | 1837 |
]. |
1838 |
||
2798 | 1839 |
^ |
3152 | 1840 |
'A project definition class for package "%1" does not exist. |
1841 |
<br>Project definition classes keep the meta information of a package, |
|
1842 |
such as contents and build parameters. |
|
3198 | 1843 |
You <b>must</b> create it, otherwise package management won''t work, |
1844 |
and the package cannot be compiled to a binary dll.' |
|
3152 | 1845 |
bindWith: package |
2798 | 1846 |
|
1847 |
"Modified: / 23-02-2012 / 13:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1848 |
! |
|
1849 |
||
1850 |
label |
|
3152 | 1851 |
^'Project definition class for "%1" does not exist' bindWith: package |
2798 | 1852 |
|
1853 |
"Modified: / 23-02-2012 / 13:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1854 |
! ! |
|
1855 |
||
3152 | 1856 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'fixing'! |
1857 |
||
3225 | 1858 |
alreadyFixed |
1859 |
^ (ProjectDefinition definitionClassForPackage:package) notNil |
|
1860 |
! |
|
1861 |
||
3152 | 1862 |
doCreateAs:whatType |
3198 | 1863 |
|prjDef| |
1864 |
||
1865 |
prjDef := ProjectDefinition |
|
1866 |
definitionClassForPackage:package |
|
1867 |
projectType: whatType |
|
1868 |
createIfAbsent:true. |
|
1869 |
||
1870 |
prjDef |
|
1871 |
updateMethodsCodeUsingCompiler:Compiler |
|
1872 |
ignoreOldDefinition:true |
|
3152 | 1873 |
! |
1874 |
||
1875 |
doCreateAsGUIApplication |
|
1876 |
self doCreateAs:ProjectDefinition guiApplicationType |
|
1877 |
! |
|
1878 |
||
1879 |
doCreateAsLibrary |
|
1880 |
self doCreateAs:ProjectDefinition libraryType |
|
1881 |
! |
|
1882 |
||
1883 |
doCreateAsNonGUIApplication |
|
1884 |
self doCreateAs:ProjectDefinition nonGuiApplicationType |
|
1885 |
! |
|
1886 |
||
1887 |
fixes |
|
1888 |
package = 'stx' ifTrue:[ ^ #() ]. |
|
1889 |
||
3154 | 1890 |
^ Array |
1891 |
with: (Array with:'Create as Library' with:[ self doCreateAsLibrary ] ) |
|
1892 |
with: (Array with:'Create as GUI Application' with:[ self doCreateAsGUIApplication ] ) |
|
1893 |
with: (Array with:'Create as non-GUI Application' with:[ self doCreateAsNonGUIApplication ] ) |
|
3152 | 1894 |
! ! |
1895 |
||
2798 | 1896 |
!ProjectProblem class methodsFor:'documentation'! |
1897 |
||
2912 | 1898 |
version |
3550 | 1899 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.31 2014-04-26 09:46:13 cg Exp $' |
2912 | 1900 |
! |
1901 |
||
1902 |
version_CVS |
|
3550 | 1903 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.31 2014-04-26 09:46:13 cg Exp $' |
2912 | 1904 |
! |
1905 |
||
2854 | 1906 |
version_SVN |
3550 | 1907 |
^ '$Id: ProjectProblem.st,v 1.31 2014-04-26 09:46:13 cg Exp $' |
2798 | 1908 |
! ! |
3160 | 1909 |