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