ProjectProblem.st
changeset 3449 f56d3fc6a39d
parent 3431 731fc5928190
child 3488 9a9a7d10aff1
--- a/ProjectProblem.st	Wed Feb 05 18:52:01 2014 +0100
+++ b/ProjectProblem.st	Wed Feb 05 18:52:02 2014 +0100
@@ -32,6 +32,20 @@
 	privateIn:ProjectProblem
 !
 
+ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool
+	instanceVariableNames:'poolName'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:ProjectProblem
+!
+
+ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass
+	instanceVariableNames:'superClassName'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:ProjectProblem
+!
+
 ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButDoesNotExist
 	instanceVariableNames:''
 	classVariableNames:''
@@ -53,8 +67,8 @@
 	privateIn:ProjectProblem
 !
 
-ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool
-	instanceVariableNames:'poolName'
+ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassIsAutoloaded
+	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:ProjectProblem
@@ -116,8 +130,8 @@
 	privateIn:ProjectProblem
 !
 
-ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass
-	instanceVariableNames:'superClassName'
+ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassProjectDefinitionIsMissing
+	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:ProjectProblem
@@ -209,6 +223,20 @@
 
 !ProjectProblem class methodsFor:'instance creation'!
 
+newClassIsCompiledButSuperclassIsAutoloaded
+
+    ^ClassIsCompiledButSuperclassIsAutoloaded new
+
+    "Created: / 20-09-2013 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+newClassIsCompiledButSuperclassProjectDefinitionIsMissing
+
+    ^ClassIsCompiledButSuperclassProjectDefinitionIsMissing new
+
+    "Created: / 05-10-2013 / 12:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 newClassListedBeforeItsPool
 
     ^ClassListedBeforeItsPool new
@@ -579,6 +607,81 @@
         with: (Array with: 'Full update of the project definitions (rescan)' with: [ self doUpdateAllProjectDefinitions ])
 ! !
 
+!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'!
+
+poolName
+    ^ poolName
+!
+
+poolName:something
+    poolName := something.
+! !
+
+!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'!
+
+description
+    "Return a (HTML) describing the problem."
+
+    ^
+'Class %2 is listed in project definition (%1) before one of its pools (%3).
+<br>Such class will fail to compile (if the package is being stc-compiled)
+and load (if the package is being loaded from source).
+<br>Make sure class (%3) is listed before (%2).
+
+'
+bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true)
+    with: (self linkToClass: className)
+    with: (self linkToClass: poolName)
+
+    "Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+label
+    "Return the label (possibly instance if a Text) shortly describing the problem"
+
+    ^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass
+
+    "Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'!
+
+superClassName
+    ^ superClassName
+!
+
+superClassName:something
+    superClassName := something.
+! !
+
+!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'!
+
+description
+    "Return a (HTML) describing the problem."
+
+    ^
+'Class %2 is listed in project definition (%1) before its superclass %3.
+<br>The package can be stc-compiled 
+(because the generated makefile compiles in correct order)
+but the class may fail to load from source.
+<br>Make sure %3 is listed before %2.
+
+'
+bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true)
+    with: (self linkToClass: className)
+    with: (self linkToClass: superClassName)
+
+    "Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+label
+    "Return the label (possibly instance if a Text) shortly describing the problem"
+
+    ^'Class %1 listed in project definition "%2" before its superclass' bindWith: className allBold with:self packageDefinitionClass 
+
+    "Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing'!
 
 severity
@@ -705,41 +808,66 @@
     "Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'!
-
-poolName
-    ^ poolName
-!
-
-poolName:something
-    poolName := something.
-! !
-
-!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'!
+!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'accessing'!
 
 description
     "Return a (HTML) describing the problem."
 
     ^
-'Class %2 is listed in project definition (%1) before one of its pools (%3).
-<br>Such class will fail to compile (if the package is being stc-compiled)
-and load (if the package is being loaded from source).
-<br>Make sure class (%3) is listed before (%2).
+'Class %1 is compiled (i.e., not autoloaded) but its superclass %1 is
+is autoloaded. Such class won''t compile because of missing superclass .H/.STH file.
+To fix it, either make %1 autoloaded ot make %2 compiled.'
+bindWith: (self linkToClass: className)
+    with: (self linkToClass: (Smalltalk at: className) superclass name)
 
-'
-bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true)
-    with: (self linkToClass: className)
-    with: (self linkToClass: poolName)
-
-    "Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-09-2013 / 11:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 label
     "Return the label (possibly instance if a Text) shortly describing the problem"
 
-    ^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass
+    ^ 'Class ', className , ' is compiled but its superclass is autoloaded'
+
+    "Modified: / 20-09-2013 / 11:00:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'fixing'!
+
+doIncludeInProjectAsAutoloaded
+    "Include subject class in project definition. Return false if
+     fix fails, true otherwise"
+
+    ^ self doIncludeInProjectAsAutoloaded:true
+!
+
+doIncludeInProjectAsAutoloaded:asAutoloaded
+    "Include subject class in project definition. Return false if
+     fix fails, true otherwise"
+
+    | def cls |
 
-    "Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    def := self packageDefinitionClass.
+    def isNil ifTrue:[ ^ false ].
+    cls := self klass.
+    cls isNil ifTrue:[ ^ false ].
+    asAutoloaded ifTrue:[
+        def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil.
+    ] ifFalse:[
+        def includeClasses:(Array with: cls) usingCompiler: nil.
+    ].
+    UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className).
+    ^true
+
+    "Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fixes
+
+    ^Array
+        with: (Array with: 'Add class ', className , ' to project as autoloaded' with: [ self doIncludeInProjectAsAutoloaded ])
+
+    "Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-09-2013 / 11:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ProjectProblem::ClassUsesPoolProblem methodsFor:'accessing'!
@@ -1078,42 +1206,27 @@
     "Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'!
-
-superClassName
-    ^ superClassName
-!
-
-superClassName:something
-    superClassName := something.
-! !
-
-!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'!
+!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'accessing'!
 
 description
     "Return a (HTML) describing the problem."
 
     ^
-'Class %2 is listed in project definition (%1) before its superclass %3.
-<br>The package can be stc-compiled 
-(because the generated makefile compiles in correct order)
-but the class may fail to load from source.
-<br>Make sure %3 is listed before %2.
+'Class %1 is compiled (i.e., not autoloaded) but its superclass''s package 
+definition is missing. Such class won''t compile because superclass''s package
+will be likely missing.'
+bindWith: (self linkToClass: className)
+    with: (self linkToClass: (Smalltalk at: className) superclass name)
 
-'
-bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true)
-    with: (self linkToClass: className)
-    with: (self linkToClass: superClassName)
-
-    "Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-10-2013 / 12:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 label
     "Return the label (possibly instance if a Text) shortly describing the problem"
 
-    ^'Class %1 listed in project definition "%2" before its superclass' bindWith: className allBold with:self packageDefinitionClass 
+    ^ 'Class ', className , ' is compiled but its superclass''s package definition is missing'
 
-    "Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-10-2013 / 12:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ProjectProblem::MethodCompilabilityIssue methodsFor:'accessing'!
@@ -1375,7 +1488,14 @@
 !ProjectProblem::MethodInNoPackage methodsFor:'accessing-description'!
 
 alreadyFixed
-    ^ (self method package ~= PackageId noProjectID)        
+    | m |
+
+    "/ One may "fix" the problem by actually removing the method. 
+    "/ In this case, consired problem as "fixed".
+    m :=  self method.
+    ^ m isNil or:[self method package ~= PackageId noProjectID]
+
+    "Modified (format): / 19-12-2013 / 15:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 description
@@ -1585,14 +1705,14 @@
 !ProjectProblem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.26 2014-01-13 13:12:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.27 2014-02-05 17:52:02 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.26 2014-01-13 13:12:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.27 2014-02-05 17:52:02 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: ProjectProblem.st,v 1.26 2014-01-13 13:12:55 cg Exp $'
+    ^ '$Id: ProjectProblem.st,v 1.27 2014-02-05 17:52:02 cg Exp $'
 ! !