From df06171e52aac3c6198cad1922dbb27b501983d8 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 22 Mar 2024 13:37:46 +0100 Subject: [PATCH 1/3] Make comments children of commented entities This change adds the trait TEntityMetaLevelDependency to TWithComment and add a containment relation between the comment and the commented entity. --- .../FamixJavaAnnotationType.class.st | 2 +- .../FamixJavaAnnotationTypeAttribute.class.st | 6 ++- .../FamixJavaAttribute.class.st | 6 ++- .../FamixJavaClass.class.st | 11 ++--- .../FamixJavaComment.class.st | 2 +- .../FamixJavaEnum.class.st | 2 +- .../FamixJavaEnumValue.class.st | 6 ++- .../FamixJavaException.class.st | 2 +- .../FamixJavaInterface.class.st | 2 +- .../FamixJavaLocalVariable.class.st | 6 ++- .../FamixJavaMethod.class.st | 2 +- .../FamixJavaPackage.class.st | 2 +- .../FamixJavaParameter.class.st | 6 ++- .../FmxPackageAddition.class.st | 3 +- .../FamixGenerator.class.st | 5 ++- .../FamixStClass.class.st | 11 ++--- .../FamixStComment.class.st | 2 +- .../FamixStMethod.class.st | 2 +- .../FamixTest1Class.class.st | 2 +- .../FamixTest1Comment.class.st | 2 +- .../FamixTest1Method.class.st | 2 +- .../TEntityMetaLevelDependencyTest.class.st | 41 ++++++++++++++----- .../FamixTest2Class.class.st | 2 +- .../FamixTest2Comment.class.st | 2 +- .../FamixTest3Class.class.st | 2 +- .../FamixTest3Comment.class.st | 2 +- .../FamixTest3MooseQueryTest.class.st | 9 +++- .../FamixTest6Comment.class.st | 2 +- .../FamixTest6Entity.class.st | 7 ++++ .../FamixTest7Class.class.st | 2 +- .../FamixTest7Comment.class.st | 2 +- .../FamixTestComposed1Class.class.st | 2 +- .../FamixTestComposed1Comment.class.st | 2 +- .../FamixTestComposed2Class.class.st | 2 +- .../FamixTestComposed2Comment.class.st | 2 +- src/Famix-Traits/FamixTCanBeAbstract.trait.st | 2 +- src/Famix-Traits/FamixTCanBeFinal.trait.st | 2 +- src/Famix-Traits/FamixTClass.trait.st | 2 +- .../FamixTClassWithVisibility.trait.st | 2 +- src/Famix-Traits/FamixTComment.trait.st | 12 +++++- src/Famix-Traits/FamixTException.trait.st | 2 +- src/Famix-Traits/FamixTSourceEntity.trait.st | 2 +- src/Famix-Traits/FamixTWithComments.trait.st | 2 +- .../MooseMSEImporterTestClass.class.st | 2 +- .../MooseMSEImporterTestComment.class.st | 2 +- 45 files changed, 132 insertions(+), 61 deletions(-) diff --git a/src/Famix-Java-Entities/FamixJavaAnnotationType.class.st b/src/Famix-Java-Entities/FamixJavaAnnotationType.class.st index e33f94bc0..10c286064 100644 --- a/src/Famix-Java-Entities/FamixJavaAnnotationType.class.st +++ b/src/Famix-Java-Entities/FamixJavaAnnotationType.class.st @@ -12,6 +12,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| ### Outgoing dependencies | Relation | Origin | Opposite | Type | Comment | @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `instances` | `FamixTAnnotationType` | `annotationType` | `FamixTTypedAnnotationInstance` | Annotations of this type| diff --git a/src/Famix-Java-Entities/FamixJavaAnnotationTypeAttribute.class.st b/src/Famix-Java-Entities/FamixJavaAnnotationTypeAttribute.class.st index cfb57092b..8771b841a 100644 --- a/src/Famix-Java-Entities/FamixJavaAnnotationTypeAttribute.class.st +++ b/src/Famix-Java-Entities/FamixJavaAnnotationTypeAttribute.class.st @@ -7,6 +7,11 @@ |---| | `parentType` | `FamixTAttribute` | `attributes` | `FamixTWithAttributes` | Type declaring the attribute. belongsTo implementation| +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| + ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | |---| @@ -17,7 +22,6 @@ |---| | `annotationAttributeInstances` | `FamixTAnnotationTypeAttribute` | `annotationTypeAttribute` | `FamixTTypedAnnotationInstanceAttribute` | A collection of AnnotationInstanceAttribute which hold the usages of this attribute in actual AnnotationInstances| | `annotationTypeAttribute` | `FamixTTypedAnnotationInstanceAttribute` | `annotationAttributeInstances` | `FamixTAnnotationTypeAttribute` | This corresponds to the type of the attribute in an AnnotationInstance| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaAttribute.class.st b/src/Famix-Java-Entities/FamixJavaAttribute.class.st index 0affa36c3..ea166ed16 100644 --- a/src/Famix-Java-Entities/FamixJavaAttribute.class.st +++ b/src/Famix-Java-Entities/FamixJavaAttribute.class.st @@ -7,6 +7,11 @@ |---| | `parentType` | `FamixTAttribute` | `attributes` | `FamixTWithAttributes` | Type declaring the attribute. belongsTo implementation| +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| + ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | |---| @@ -15,7 +20,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaClass.class.st b/src/Famix-Java-Entities/FamixJavaClass.class.st index 7aa5072fb..91137d941 100644 --- a/src/Famix-Java-Entities/FamixJavaClass.class.st +++ b/src/Famix-Java-Entities/FamixJavaClass.class.st @@ -12,6 +12,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -31,7 +32,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| @@ -176,11 +176,12 @@ FamixJavaClass >> methodsWithoutSutbsAndConstructors [ { #category : #accessing } FamixJavaClass >> numberOfComments [ "Overrides to include method comments in the numberOfComments of the class" - ^ self - lookUpPropertyNamed: #numberOfComments - computedAs: [ self children asArray - inject: self comments size into: [ :sum :child | child numberOfComments + sum ] ] + ^ self lookUpPropertyNamed: #numberOfComments computedAs: [ + self children asArray inject: self comments size into: [ :sum :child | + (child class includesTrait: FamixTWithComments) + ifTrue: [ child numberOfComments + sum ] + ifFalse: [ sum ] ] ] ] { #category : #'Famix-Extensions' } diff --git a/src/Famix-Java-Entities/FamixJavaComment.class.st b/src/Famix-Java-Entities/FamixJavaComment.class.st index 609ecc342..778030ad0 100644 --- a/src/Famix-Java-Entities/FamixJavaComment.class.st +++ b/src/Famix-Java-Entities/FamixJavaComment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Java-Entities/FamixJavaEnum.class.st b/src/Famix-Java-Entities/FamixJavaEnum.class.st index 2969c19f9..518ae1cff 100644 --- a/src/Famix-Java-Entities/FamixJavaEnum.class.st +++ b/src/Famix-Java-Entities/FamixJavaEnum.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `enumValues` | `FamixTWithEnumValues` | `parentEnum` | `FamixTEnumValue` | | | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| @@ -30,7 +31,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Java-Entities/FamixJavaEnumValue.class.st b/src/Famix-Java-Entities/FamixJavaEnumValue.class.st index 720db95b1..0df37a4e2 100644 --- a/src/Famix-Java-Entities/FamixJavaEnumValue.class.st +++ b/src/Famix-Java-Entities/FamixJavaEnumValue.class.st @@ -7,6 +7,11 @@ |---| | `parentEnum` | `FamixTEnumValue` | `enumValues` | `FamixTWithEnumValues` | The Enum declaring this value. It offers the implementation of belongsTo| +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| + ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | |---| @@ -15,7 +20,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaException.class.st b/src/Famix-Java-Entities/FamixJavaException.class.st index 41c2010d8..cc5b907c5 100644 --- a/src/Famix-Java-Entities/FamixJavaException.class.st +++ b/src/Famix-Java-Entities/FamixJavaException.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| | `types` | `FamixTWithTypes` | `typeContainer` | `FamixTType` | Types contained (declared) in this entity, if any. #types is declared in ContainerEntity because different kinds of container can embed types. Types are usually contained in a Famix.Namespace. But types can also be contained in a Famix.Class or Famix.Method (in Java with inner classes for example). Famix.Function can also contain some types such as structs.| @@ -32,7 +33,6 @@ |---| | `annotationInstances` | `FamixTWithAnnotationInstances` | `annotatedEntity` | `FamixTAnnotationInstance` | This property corresponds to the set of annotations associated to the entity| | `catchingEntities` | `FamixTThrowable` | `caughtExceptions` | `FamixTWithExceptions` | | -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaringEntities` | `FamixTThrowable` | `declaredExceptions` | `FamixTWithExceptions` | | | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaInterface.class.st b/src/Famix-Java-Entities/FamixJavaInterface.class.st index f6f114847..602095b25 100644 --- a/src/Famix-Java-Entities/FamixJavaInterface.class.st +++ b/src/Famix-Java-Entities/FamixJavaInterface.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -29,7 +30,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| diff --git a/src/Famix-Java-Entities/FamixJavaLocalVariable.class.st b/src/Famix-Java-Entities/FamixJavaLocalVariable.class.st index 2f3eccbe9..5620fe252 100644 --- a/src/Famix-Java-Entities/FamixJavaLocalVariable.class.st +++ b/src/Famix-Java-Entities/FamixJavaLocalVariable.class.st @@ -7,6 +7,11 @@ |---| | `parentBehaviouralEntity` | `FamixTLocalVariable` | `localVariables` | `FamixTWithLocalVariables` | Behavioural entity declaring this local variable. belongsTo implementation| +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| + ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | |---| @@ -15,7 +20,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaMethod.class.st b/src/Famix-Java-Entities/FamixJavaMethod.class.st index 9ceb1f063..bc738a25b 100644 --- a/src/Famix-Java-Entities/FamixJavaMethod.class.st +++ b/src/Famix-Java-Entities/FamixJavaMethod.class.st @@ -10,6 +10,7 @@ ### Children | Relation | Origin | Opposite | Type | Comment | |---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `implicitVariables` | `FamixTWithImplicitVariables` | `parentBehaviouralEntity` | `FamixTImplicitVariable` | Implicit variables used locally by this behaviour.| | `localVariables` | `FamixTWithLocalVariables` | `parentBehaviouralEntity` | `FamixTLocalVariable` | Variables locally defined by this behaviour.| | `parameters` | `FamixTWithParameters` | `parentBehaviouralEntity` | `FamixTParameter` | List of formal parameters declared by this behaviour.| @@ -31,7 +32,6 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `caughtExceptions` | `FamixTWithExceptions` | `catchingEntities` | `FamixTThrowable` | The exceptions caught by the method| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredExceptions` | `FamixTWithExceptions` | `declaringEntities` | `FamixTThrowable` | The exceptions declared by the method| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaPackage.class.st b/src/Famix-Java-Entities/FamixJavaPackage.class.st index b5e8577a2..40ad59461 100644 --- a/src/Famix-Java-Entities/FamixJavaPackage.class.st +++ b/src/Famix-Java-Entities/FamixJavaPackage.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `childEntities` | `FamixTPackage` | `parentPackage` | `FamixTPackageable` | | +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | @@ -20,7 +21,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Java-Entities/FamixJavaParameter.class.st b/src/Famix-Java-Entities/FamixJavaParameter.class.st index 35d43b11a..f1abdc0e5 100644 --- a/src/Famix-Java-Entities/FamixJavaParameter.class.st +++ b/src/Famix-Java-Entities/FamixJavaParameter.class.st @@ -7,6 +7,11 @@ |---| | `parentBehaviouralEntity` | `FamixTParameter` | `parameters` | `FamixTWithParameters` | Behavioural entity containing this parameter. belongsTo implementation| +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| + ### Incoming dependencies | Relation | Origin | Opposite | Type | Comment | |---| @@ -15,7 +20,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st b/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st index b9280e9ca..51ae08976 100644 --- a/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st +++ b/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st @@ -33,7 +33,8 @@ FmxPackageAddition class >> named: aName [ { #category : #accessing } FmxPackageAddition >> apply [ - self packageOrganizer createPackageNamed: self packageName + + self packageOrganizer addPackage: self packageName ] { #category : #accessing } diff --git a/src/Famix-MetamodelGeneration/FamixGenerator.class.st b/src/Famix-MetamodelGeneration/FamixGenerator.class.st index 4c5d11131..91d9004ad 100644 --- a/src/Famix-MetamodelGeneration/FamixGenerator.class.st +++ b/src/Famix-MetamodelGeneration/FamixGenerator.class.st @@ -987,6 +987,8 @@ FamixGenerator >> defineHierarchy [ tClassWithVisibility --|> tHasVisibility. tClassGroup --|> tTypeGroup. + + tComment --|> #TEntityMetaLevelDependency. tCompilationUnit --|> tFile. @@ -1251,7 +1253,8 @@ FamixGenerator >> defineRelations [ comment: 'The exceptions caught by the method'). ((tComment property: #commentedEntity) - comment: 'Source code commented by the comment') + comment: 'Source code commented by the comment'; + container) *- ((tWithComments property: #comments) comment: 'List of comments for the entity'). diff --git a/src/Famix-PharoSmalltalk-Entities/FamixStClass.class.st b/src/Famix-PharoSmalltalk-Entities/FamixStClass.class.st index 6fe56b84b..3f55d0ba4 100644 --- a/src/Famix-PharoSmalltalk-Entities/FamixStClass.class.st +++ b/src/Famix-PharoSmalltalk-Entities/FamixStClass.class.st @@ -12,6 +12,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -28,7 +29,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| @@ -176,11 +176,12 @@ FamixStClass >> methodsWithoutSutbsAndConstructors [ { #category : #accessing } FamixStClass >> numberOfComments [ "Overrides to include method comments in the numberOfComments of the class" - ^ self - lookUpPropertyNamed: #numberOfComments - computedAs: [ self methods asArray - inject: self comments size into: [ :sum :child | child numberOfComments + sum ] ] + ^ self lookUpPropertyNamed: #numberOfComments computedAs: [ + self children asArray inject: self comments size into: [ :sum :child | + (child class includesTrait: FamixTWithComments) + ifTrue: [ child numberOfComments + sum ] + ifFalse: [ sum ] ] ] ] { #category : #metrics } diff --git a/src/Famix-PharoSmalltalk-Entities/FamixStComment.class.st b/src/Famix-PharoSmalltalk-Entities/FamixStComment.class.st index 540f177eb..10f7936f4 100644 --- a/src/Famix-PharoSmalltalk-Entities/FamixStComment.class.st +++ b/src/Famix-PharoSmalltalk-Entities/FamixStComment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-PharoSmalltalk-Entities/FamixStMethod.class.st b/src/Famix-PharoSmalltalk-Entities/FamixStMethod.class.st index fb934a53b..9e0f152eb 100644 --- a/src/Famix-PharoSmalltalk-Entities/FamixStMethod.class.st +++ b/src/Famix-PharoSmalltalk-Entities/FamixStMethod.class.st @@ -11,6 +11,7 @@ ### Children | Relation | Origin | Opposite | Type | Comment | |---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `definedAnnotationTypes` | `FamixTWithAnnotationTypes` | `annotationTypesContainer` | `FamixTAnnotationType` | The container in which the AnnotationTypes may be declared| | `implicitVariables` | `FamixTWithImplicitVariables` | `parentBehaviouralEntity` | `FamixTImplicitVariable` | Implicit variables used locally by this behaviour.| | `localVariables` | `FamixTWithLocalVariables` | `parentBehaviouralEntity` | `FamixTLocalVariable` | Variables locally defined by this behaviour.| @@ -32,7 +33,6 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `annotationInstances` | `FamixTWithAnnotationInstances` | `annotatedEntity` | `FamixTAnnotationInstance` | This property corresponds to the set of annotations associated to the entity| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Test1-Entities/FamixTest1Class.class.st b/src/Famix-Test1-Entities/FamixTest1Class.class.st index d2e1651f2..77b934ea3 100644 --- a/src/Famix-Test1-Entities/FamixTest1Class.class.st +++ b/src/Famix-Test1-Entities/FamixTest1Class.class.st @@ -14,6 +14,7 @@ This a comment for the Class entity | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -30,7 +31,6 @@ This a comment for the Class entity ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredSourceLanguage` | `FamixTWithSourceLanguages` | `sourcedEntities` | `FamixTSourceLanguage` | The declared SourceLanguage for the source code of this entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Test1-Entities/FamixTest1Comment.class.st b/src/Famix-Test1-Entities/FamixTest1Comment.class.st index 467fb43bd..d2c078ba3 100644 --- a/src/Famix-Test1-Entities/FamixTest1Comment.class.st +++ b/src/Famix-Test1-Entities/FamixTest1Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Test1-Entities/FamixTest1Method.class.st b/src/Famix-Test1-Entities/FamixTest1Method.class.st index b765ca0f9..5469534ce 100644 --- a/src/Famix-Test1-Entities/FamixTest1Method.class.st +++ b/src/Famix-Test1-Entities/FamixTest1Method.class.st @@ -10,6 +10,7 @@ ### Children | Relation | Origin | Opposite | Type | Comment | |---| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `implicitVariables` | `FamixTWithImplicitVariables` | `parentBehaviouralEntity` | `FamixTImplicitVariable` | Implicit variables used locally by this behaviour.| | `localVariables` | `FamixTWithLocalVariables` | `parentBehaviouralEntity` | `FamixTLocalVariable` | Variables locally defined by this behaviour.| | `parameters` | `FamixTWithParameters` | `parentBehaviouralEntity` | `FamixTParameter` | List of formal parameters declared by this behaviour.| @@ -29,7 +30,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaredSourceLanguage` | `FamixTWithSourceLanguages` | `sourcedEntities` | `FamixTSourceLanguage` | The declared SourceLanguage for the source code of this entity| | `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Test1-Tests/TEntityMetaLevelDependencyTest.class.st b/src/Famix-Test1-Tests/TEntityMetaLevelDependencyTest.class.st index 30042e4e4..e6cbbc5ad 100644 --- a/src/Famix-Test1-Tests/TEntityMetaLevelDependencyTest.class.st +++ b/src/Famix-Test1-Tests/TEntityMetaLevelDependencyTest.class.st @@ -51,13 +51,33 @@ TEntityMetaLevelDependencyTest >> testAllChildren [ { #category : #tests } TEntityMetaLevelDependencyTest >> testAllChildrenTypes [ - self - assertCollection: c1 allChildrenTypes - hasSameElements: {FamixTParameter . FamixTImplicitVariable . FamixTest1Attribute . FamixTAttribute . FamixTest1Method . FamixTLocalVariable . FamixTMethod}. - self - assertCollection: c2 allChildrenTypes - hasSameElements: {FamixTParameter . FamixTImplicitVariable . FamixTest1Attribute . FamixTAttribute . FamixTest1Method . FamixTLocalVariable . FamixTMethod}. - self assertCollection: m1 allChildrenTypes hasSameElements: {FamixTImplicitVariable . FamixTParameter . FamixTLocalVariable} + + self assertCollection: c1 allChildrenTypes hasSameElements: { + FamixTParameter. + FamixTImplicitVariable. + FamixTest1Attribute. + FamixTAttribute. + FamixTest1Method. + FamixTLocalVariable. + FamixTMethod. + FamixTComment. + FamixTest1Comment }. + self assertCollection: c2 allChildrenTypes hasSameElements: { + FamixTParameter. + FamixTImplicitVariable. + FamixTest1Attribute. + FamixTAttribute. + FamixTest1Method. + FamixTLocalVariable. + FamixTMethod. + FamixTComment. + FamixTest1Comment }. + self assertCollection: m1 allChildrenTypes hasSameElements: { + FamixTImplicitVariable. + FamixTParameter. + FamixTLocalVariable. + FamixTComment. + FamixTest1Comment } ] { #category : #tests } @@ -139,9 +159,10 @@ TEntityMetaLevelDependencyTest >> testChildren [ { #category : #tests } TEntityMetaLevelDependencyTest >> testChildrenSelectors [ - self assertCollection: m1 childrenSelectors hasSameElements: {#parameters . #localVariables . #implicitVariables}. - self assertCollection: c1 childrenSelectors hasSameElements: {#methods . #attributes}. - self assertCollection: c2 childrenSelectors hasSameElements: {#methods . #attributes} + + self assertCollection: m1 childrenSelectors hasSameElements: { #parameters. #localVariables. #implicitVariables. #comments }. + self assertCollection: c1 childrenSelectors hasSameElements: { #methods. #attributes. #comments }. + self assertCollection: c2 childrenSelectors hasSameElements: { #methods. #attributes. #comments } ] { #category : #tests } diff --git a/src/Famix-Test2-Entities/FamixTest2Class.class.st b/src/Famix-Test2-Entities/FamixTest2Class.class.st index 7e746b44d..d33a4f0e1 100644 --- a/src/Famix-Test2-Entities/FamixTest2Class.class.st +++ b/src/Famix-Test2-Entities/FamixTest2Class.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Test2-Entities/FamixTest2Comment.class.st b/src/Famix-Test2-Entities/FamixTest2Comment.class.st index 0ea730ba2..f04bcb06d 100644 --- a/src/Famix-Test2-Entities/FamixTest2Comment.class.st +++ b/src/Famix-Test2-Entities/FamixTest2Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Test3-Entities/FamixTest3Class.class.st b/src/Famix-Test3-Entities/FamixTest3Class.class.st index 8035e96da..8a61c8d05 100644 --- a/src/Famix-Test3-Entities/FamixTest3Class.class.st +++ b/src/Famix-Test3-Entities/FamixTest3Class.class.st @@ -12,6 +12,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -28,7 +29,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Test3-Entities/FamixTest3Comment.class.st b/src/Famix-Test3-Entities/FamixTest3Comment.class.st index 85e3eb6bd..d916ad85d 100644 --- a/src/Famix-Test3-Entities/FamixTest3Comment.class.st +++ b/src/Famix-Test3-Entities/FamixTest3Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Test3-Tests/FamixTest3MooseQueryTest.class.st b/src/Famix-Test3-Tests/FamixTest3MooseQueryTest.class.st index e15a0f234..3b8cd352b 100644 --- a/src/Famix-Test3-Tests/FamixTest3MooseQueryTest.class.st +++ b/src/Famix-Test3-Tests/FamixTest3MooseQueryTest.class.st @@ -66,7 +66,14 @@ FamixTest3MooseQueryTest >> testAtScopeWithNonMatchingEntitiesDo [ { #category : #tests } FamixTest3MooseQueryTest >> testChildrenTypes [ - self assertCollection: self c1 childrenTypes hasSameElements: {FamixTAttribute . FamixTMethod . FamixTest3Attribute . FamixTest3Method} + + self assertCollection: self c1 childrenTypes hasSameElements: { + FamixTAttribute. + FamixTMethod. + FamixTest3Attribute. + FamixTest3Method. + FamixTComment. + FamixTest3Comment } ] { #category : #tests } diff --git a/src/Famix-Test6-Entities/FamixTest6Comment.class.st b/src/Famix-Test6-Entities/FamixTest6Comment.class.st index 26cd96bec..5480a1ede 100644 --- a/src/Famix-Test6-Entities/FamixTest6Comment.class.st +++ b/src/Famix-Test6-Entities/FamixTest6Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Test6-Entities/FamixTest6Entity.class.st b/src/Famix-Test6-Entities/FamixTest6Entity.class.st index a3ccf0cef..bfa663553 100644 --- a/src/Famix-Test6-Entities/FamixTest6Entity.class.st +++ b/src/Famix-Test6-Entities/FamixTest6Entity.class.st @@ -27,3 +27,10 @@ FamixTest6Entity class >> metamodel [ ^ FamixTest6Model metamodel ] + +{ #category : #testing } +FamixTest6Entity >> isQueryable [ + + + ^ false +] diff --git a/src/Famix-Test7-Entities/FamixTest7Class.class.st b/src/Famix-Test7-Entities/FamixTest7Class.class.st index 1d6b536ea..01da7005a 100644 --- a/src/Famix-Test7-Entities/FamixTest7Class.class.st +++ b/src/Famix-Test7-Entities/FamixTest7Class.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Test7-Entities/FamixTest7Comment.class.st b/src/Famix-Test7-Entities/FamixTest7Comment.class.st index 518c593e6..43fdfcaf0 100644 --- a/src/Famix-Test7-Entities/FamixTest7Comment.class.st +++ b/src/Famix-Test7-Entities/FamixTest7Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Class.class.st b/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Class.class.st index ea5788a00..12830a4b4 100644 --- a/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Class.class.st +++ b/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Class.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Comment.class.st b/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Comment.class.st index eabf1f370..02b0de975 100644 --- a/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Comment.class.st +++ b/src/Famix-TestComposedSubmetamodel1-Entities/FamixTestComposed1Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Class.class.st b/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Class.class.st index 73f4b1b2a..701c54d44 100644 --- a/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Class.class.st +++ b/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Class.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Comment.class.st b/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Comment.class.st index 48c03105d..3611b4eb8 100644 --- a/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Comment.class.st +++ b/src/Famix-TestComposedSubmetamodel2-Entities/FamixTestComposed2Comment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| diff --git a/src/Famix-Traits/FamixTCanBeAbstract.trait.st b/src/Famix-Traits/FamixTCanBeAbstract.trait.st index 43190d644..eadf3b1ce 100644 --- a/src/Famix-Traits/FamixTCanBeAbstract.trait.st +++ b/src/Famix-Traits/FamixTCanBeAbstract.trait.st @@ -10,7 +10,7 @@ Trait { #name : #FamixTCanBeAbstract, #instVars : [ - '#isAbstract => FMProperty' + '#isAbstract => FMProperty defaultValue: false' ], #category : #'Famix-Traits-Traits' } diff --git a/src/Famix-Traits/FamixTCanBeFinal.trait.st b/src/Famix-Traits/FamixTCanBeFinal.trait.st index 8f04f9c72..6208a9aec 100644 --- a/src/Famix-Traits/FamixTCanBeFinal.trait.st +++ b/src/Famix-Traits/FamixTCanBeFinal.trait.st @@ -10,7 +10,7 @@ Trait { #name : #FamixTCanBeFinal, #instVars : [ - '#isFinal => FMProperty' + '#isFinal => FMProperty defaultValue: false' ], #category : #'Famix-Traits-Traits' } diff --git a/src/Famix-Traits/FamixTClass.trait.st b/src/Famix-Traits/FamixTClass.trait.st index e4ec21baf..70704a9a1 100644 --- a/src/Famix-Traits/FamixTClass.trait.st +++ b/src/Famix-Traits/FamixTClass.trait.st @@ -17,6 +17,7 @@ A class is typically scoped in a namespace. To model nested or anonymous classes | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -33,7 +34,6 @@ A class is typically scoped in a namespace. To model nested or anonymous classes ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Traits/FamixTClassWithVisibility.trait.st b/src/Famix-Traits/FamixTClassWithVisibility.trait.st index 9a88276b0..3ec58cf26 100644 --- a/src/Famix-Traits/FamixTClassWithVisibility.trait.st +++ b/src/Famix-Traits/FamixTClassWithVisibility.trait.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Famix-Traits/FamixTComment.trait.st b/src/Famix-Traits/FamixTComment.trait.st index 2468c9f44..16128835c 100644 --- a/src/Famix-Traits/FamixTComment.trait.st +++ b/src/Famix-Traits/FamixTComment.trait.st @@ -4,7 +4,7 @@ FamixTComment represents one instance of a comment (in the sense of programming ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| @@ -24,6 +24,8 @@ Trait { '#commentedEntity => FMOne type: #FamixTWithComments opposite: #comments', '#content => FMProperty' ], + #traits : 'TEntityMetaLevelDependency', + #classTraits : 'TEntityMetaLevelDependency classTrait', #category : #'Famix-Traits-Comment' } @@ -49,6 +51,7 @@ FamixTComment >> commentedEntity [ + ^ commentedEntity ] @@ -59,6 +62,13 @@ FamixTComment >> commentedEntity: anObject [ commentedEntity := anObject ] +{ #category : #navigation } +FamixTComment >> commentedEntityGroup [ + + + ^ MooseSpecializedGroup with: self commentedEntity +] + { #category : #accessing } FamixTComment >> container [ diff --git a/src/Famix-Traits/FamixTException.trait.st b/src/Famix-Traits/FamixTException.trait.st index 7ea34a052..7aa1534e9 100644 --- a/src/Famix-Traits/FamixTException.trait.st +++ b/src/Famix-Traits/FamixTException.trait.st @@ -13,6 +13,7 @@ This is the abstract representation of an Exception. It is specific to Java. It | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -30,7 +31,6 @@ This is the abstract representation of an Exception. It is specific to Java. It | Relation | Origin | Opposite | Type | Comment | |---| | `catchingEntities` | `FamixTThrowable` | `caughtExceptions` | `FamixTWithExceptions` | | -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `declaringEntities` | `FamixTThrowable` | `declaredExceptions` | `FamixTWithExceptions` | | | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| diff --git a/src/Famix-Traits/FamixTSourceEntity.trait.st b/src/Famix-Traits/FamixTSourceEntity.trait.st index e2fe34b87..b2b0058ed 100644 --- a/src/Famix-Traits/FamixTSourceEntity.trait.st +++ b/src/Famix-Traits/FamixTSourceEntity.trait.st @@ -21,7 +21,7 @@ FamixTSourcedEntity models any fact in a program source and it is the superclass Trait { #name : #FamixTSourceEntity, #instVars : [ - '#isStub => FMProperty', + '#isStub => FMProperty defaultValue: false', '#sourceAnchor => FMOne type: #FamixTSourceAnchor opposite: #element' ], #category : #'Famix-Traits-SourceAnchor' diff --git a/src/Famix-Traits/FamixTWithComments.trait.st b/src/Famix-Traits/FamixTWithComments.trait.st index 1bd7d2d40..10c77ab95 100644 --- a/src/Famix-Traits/FamixTWithComments.trait.st +++ b/src/Famix-Traits/FamixTWithComments.trait.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Children | Relation | Origin | Opposite | Type | Comment | |---| | `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| diff --git a/src/Moose-Core-Tests-Entities/MooseMSEImporterTestClass.class.st b/src/Moose-Core-Tests-Entities/MooseMSEImporterTestClass.class.st index 0170c9a94..d147e67c5 100644 --- a/src/Moose-Core-Tests-Entities/MooseMSEImporterTestClass.class.st +++ b/src/Moose-Core-Tests-Entities/MooseMSEImporterTestClass.class.st @@ -11,6 +11,7 @@ | Relation | Origin | Opposite | Type | Comment | |---| | `attributes` | `FamixTWithAttributes` | `parentType` | `FamixTAttribute` | List of attributes declared by this type.| +| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `methods` | `FamixTWithMethods` | `parentType` | `FamixTMethod` | Methods declared by this type.| ### Outgoing dependencies @@ -27,7 +28,6 @@ ### Other | Relation | Origin | Opposite | Type | Comment | |---| -| `comments` | `FamixTWithComments` | `commentedEntity` | `FamixTComment` | List of comments for the entity| | `receivingInvocations` | `FamixTInvocationsReceiver` | `receiver` | `FamixTInvocation` | List of invocations performed on this entity (considered as the receiver)| | `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| | `typedEntities` | `FamixTType` | `declaredType` | `FamixTTypedEntity` | Entities that have this type as declaredType| diff --git a/src/Moose-Core-Tests-Entities/MooseMSEImporterTestComment.class.st b/src/Moose-Core-Tests-Entities/MooseMSEImporterTestComment.class.st index 93c9da58d..588ec1fa6 100644 --- a/src/Moose-Core-Tests-Entities/MooseMSEImporterTestComment.class.st +++ b/src/Moose-Core-Tests-Entities/MooseMSEImporterTestComment.class.st @@ -2,7 +2,7 @@ ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `commentedEntity` | `FamixTComment` | `comments` | `FamixTWithComments` | Source code commented by the comment| From 02982fc72b95188bb124557d23f93a8039269a52 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 22 Mar 2024 13:45:14 +0100 Subject: [PATCH 2/3] Use compatible API --- src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st b/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st index 51ae08976..96fc08f34 100644 --- a/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st +++ b/src/Famix-MetamodelBuilder-Core/FmxPackageAddition.class.st @@ -34,7 +34,7 @@ FmxPackageAddition class >> named: aName [ { #category : #accessing } FmxPackageAddition >> apply [ - self packageOrganizer addPackage: self packageName + self packageOrganizer ensurePackage: self packageName ] { #category : #accessing } From 1a2fed34139a8065e7def2ca283873bfc037a26c Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 22 Mar 2024 13:49:16 +0100 Subject: [PATCH 3/3] Fix one more test --- src/Moose-Query-Test/MooseQueryTest.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Moose-Query-Test/MooseQueryTest.class.st b/src/Moose-Query-Test/MooseQueryTest.class.st index c8cec58a2..85c5d41fa 100644 --- a/src/Moose-Query-Test/MooseQueryTest.class.st +++ b/src/Moose-Query-Test/MooseQueryTest.class.st @@ -395,7 +395,7 @@ MooseQueryTest >> testChildren [ MooseQueryTest >> testChildrenSelectors [ self assertCollection: class1 childrenSelectors - hasSameElements: #(#types #attributes #methods #definedAnnotationTypes) + hasSameElements: #(#types #attributes #methods #definedAnnotationTypes #comments) ] { #category : #tests }