Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spell 'overridden' #617

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Famix-Compatibility-Entities/FAMIXMethod.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ FAMIXMethod >> isJUnit4Test [
]

{ #category : #'Famix-Extensions' }
FAMIXMethod >> isOverriden [
<FMProperty: #isOverriden type: #Boolean>
FAMIXMethod >> isOverridden [
<FMProperty: #isOverridden type: #Boolean>
<derived>
<FMComment: 'The method is overrided in a sub class'>
"If we have a stub and we don't have the container, we can't have the information"
Expand Down
10 changes: 5 additions & 5 deletions src/Famix-Java-Entities/FamixJavaMethod.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ FamixJavaMethod >> isJUnit4Test [
]

{ #category : #testing }
FamixJavaMethod >> isOverriden [
FamixJavaMethod >> isOverridden [
"If we have a stub and we don't have the container, we can't have the information"

<FMProperty: #isOverriden type: #Boolean>
<FMProperty: #isOverridden type: #Boolean>
<derived>
<FMComment: 'The method is overrided in a sub class'>
(self parentType isNil and: [ self isStub ])
Expand Down Expand Up @@ -257,7 +257,7 @@ FamixJavaMethod >> numberOfInvokedMethods [
]

{ #category : #testing }
FamixJavaMethod >> overridenMethod [
FamixJavaMethod >> overriddenMethod [

^ (self parentType superclass ifNotNil: [ :superclass |
superclass lookUp: self signature ]) ifNil: [
Expand All @@ -268,9 +268,9 @@ FamixJavaMethod >> overridenMethod [
FamixJavaMethod >> overridesMethod [

self deprecated: 'This method seems to not be used anymore.'.
"Please consider using #overridenMethod instead.
"Please consider using #overriddenMethod instead.
We are not automatically replacing it because the behavior is not identical:
#overridenMethod is a detect and not a collect + it goes through intefaces."
#overriddenMethod is a detect and not a collect + it goes through intefaces."

^ self belongsTo superclassHierarchy
collect: [ :each | each implementationOf: self signature ]
Expand Down
40 changes: 20 additions & 20 deletions src/Famix-Java-Tests/FamixJavaMethodTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ FamixJavaMethodTest >> testIsStubWhenParentIsStub [

{ #category : #tests }
FamixJavaMethodTest >> testOverride [
| overridenMethod c1 c2 package |
| overriddenMethod c1 c2 package |
package := FamixJavaPackage new.
c1 := FamixJavaClass new
parentPackage: package;
yourself.
c2 := FamixJavaClass new
parentPackage: package;
yourself.
overridenMethod := FamixJavaMethod new
overriddenMethod := FamixJavaMethod new
name: 'method';
signature: 'method()';
parentType: c1;
Expand All @@ -117,67 +117,67 @@ FamixJavaMethodTest >> testOverride [
subclass: c2;
superclass: c1).
self assert: method isOverriding.
self assert: overridenMethod isOverriden
self assert: overriddenMethod isOverridden
]

{ #category : #tests }
FamixJavaMethodTest >> testOverridenMethod [
FamixJavaMethodTest >> testOverriddenMethod [

| signature overridenMethod localClass superclass |
| signature overriddenMethod localClass superclass |
signature := 'javaMethod()'.
method signature: signature.
overridenMethod := FamixJavaMethod new signature: signature.
overriddenMethod := FamixJavaMethod new signature: signature.

localClass := FamixJavaClass named: #LocalClass.
superclass := FamixJavaClass named: #Superclass.

localClass addMethod: method.
superclass addMethod: overridenMethod.
superclass addMethod: overriddenMethod.

FamixJavaInheritance new
superclass: superclass;
subclass: localClass.

self assert: method overridenMethod equals: overridenMethod
self assert: method overriddenMethod equals: overriddenMethod
]

{ #category : #tests }
FamixJavaMethodTest >> testOverridenMethodFromInterface [
FamixJavaMethodTest >> testOverriddenMethodFromInterface [

| signature interfaceOverridenMethod localClass interface |
| signature interfaceOverriddenMethod localClass interface |
signature := 'javaMethod()'.
method signature: signature.
interfaceOverridenMethod := FamixJavaMethod new signature: signature.
interfaceOverriddenMethod := FamixJavaMethod new signature: signature.

localClass := FamixJavaClass named: #LocalClass.
interface := FamixJavaInterface named: #Interface.

localClass addMethod: method.
interface addMethod: interfaceOverridenMethod.
interface addMethod: interfaceOverriddenMethod.

FamixJavaImplementation new
interface: interface;
implementingClass: localClass.

self assert: method overridenMethod equals: interfaceOverridenMethod
self assert: method overriddenMethod equals: interfaceOverriddenMethod
]

{ #category : #tests }
FamixJavaMethodTest >> testOverridenMethodOnlyOneLevel [
FamixJavaMethodTest >> testOverriddenMethodOnlyOneLevel [

| signature overridenMethod localClass superclass superSuperclass otherOverridenMethod |
| signature overriddenMethod localClass superclass superSuperclass otherOverriddenMethod |
signature := 'javaMethod()'.
method signature: signature.
overridenMethod := FamixJavaMethod new signature: signature.
otherOverridenMethod := FamixJavaMethod new signature: signature.
overriddenMethod := FamixJavaMethod new signature: signature.
otherOverriddenMethod := FamixJavaMethod new signature: signature.

localClass := FamixJavaClass named: #LocalClass.
superclass := FamixJavaClass named: #Superclass.
superSuperclass := FamixJavaClass named: #SuperSuperclass.

localClass addMethod: method.
superclass addMethod: overridenMethod.
superSuperclass addMethod: otherOverridenMethod.
superclass addMethod: overriddenMethod.
superSuperclass addMethod: otherOverriddenMethod.

FamixJavaInheritance new
superclass: superclass;
Expand All @@ -186,7 +186,7 @@ FamixJavaMethodTest >> testOverridenMethodOnlyOneLevel [
superclass: superSuperclass;
subclass: superclass.

self assert: method overridenMethod equals: overridenMethod
self assert: method overriddenMethod equals: overriddenMethod
]

{ #category : #tests }
Expand Down
4 changes: 2 additions & 2 deletions src/Famix-PharoSmalltalk-Entities/FamixStMethod.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ FamixStMethod >> isJUnit4Test [
]

{ #category : #testing }
FamixStMethod >> isOverriden [
FamixStMethod >> isOverridden [
"If we have a stub and we don't have the container, we can't have the information"

<FMProperty: #isOverriden type: #Boolean>
<FMProperty: #isOverridden type: #Boolean>
<derived>
<FMComment: 'The method is overrided in a sub class'>
(self parentType isNil and: [ self isStub ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ FamixSmalltalkMethodTest >> testOverride [
subclass: c2;
superclass: c1).
self assert: newM1 isOverriding.
self assert: m1 isOverriden
self assert: m1 isOverridden
]

{ #category : #tests }
Expand Down
12 changes: 6 additions & 6 deletions src/Famix-Traits/FamixTClassMetrics.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,21 @@ FamixTClassMetrics >> numberOfMethodsInherited: aNumber [
]

{ #category : #metrics }
FamixTClassMetrics >> numberOfMethodsOverriden [
FamixTClassMetrics >> numberOfMethodsOverridden [

<FMProperty: #numberOfMethodsOverriden type: #Number>
<FMProperty: #numberOfMethodsOverridden type: #Number>
<derived>
<FMComment:
'The number of methods in a class overriden with respect to super classes'>
'The number of methods in a class overridden with respect to super classes'>
^ self
lookUpPropertyNamed: #numberOfMethodsOverriden
lookUpPropertyNamed: #numberOfMethodsOverridden
computedAs: [
self numberOfMethods - self numberOfLocallyDefinedMethods ]
]

{ #category : #metrics }
FamixTClassMetrics >> numberOfMethodsOverriden: aNumber [
self cacheAt: #numberOfMethodsOverriden put: aNumber
FamixTClassMetrics >> numberOfMethodsOverridden: aNumber [
self cacheAt: #numberOfMethodsOverridden put: aNumber
]

{ #category : #metrics }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FamixMetaModelClassesShouldNotOverrideRule >> checkClass: aContext [

(self metaModelClasses includes: class)
ifTrue: [
self selectorsThatShouldNotBeOverriden do: [:each |
self selectorsThatShouldNotBeOverridden do: [:each |
(class includesSelector: each)
ifTrue: [
result addClass: class selector: each
Expand Down Expand Up @@ -49,11 +49,11 @@ FamixMetaModelClassesShouldNotOverrideRule >> name [
{ #category : #accessing }
FamixMetaModelClassesShouldNotOverrideRule >> rationale [

^ 'check if a metamodel class (MooseEntity and all its subclasses) override some methods that it should not override. Those methods are specified by FamixMetaModelClassesShouldNotOverrideRule >> selectorsThatShouldNotBeOverriden'
^ 'check if a metamodel class (MooseEntity and all its subclasses) override some methods that it should not override. Those methods are specified by FamixMetaModelClassesShouldNotOverrideRule >> selectorsThatShouldNotBeOverridden'
]

{ #category : #accessing }
FamixMetaModelClassesShouldNotOverrideRule >> selectorsThatShouldNotBeOverriden [
FamixMetaModelClassesShouldNotOverrideRule >> selectorsThatShouldNotBeOverridden [

^ #(#mooseName #printString)
]
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ LANFamixPropertiesTest >> testClassLinesOfCode [
LANFamixPropertiesTest >> testClassMethods [
self assert: self nodeClass numberOfMethods equals: 12.
self assert: (self nodeClass propertyNamed: #numberOfMethodsInherited) equals: 0.
self assert: (self nodeClass propertyNamed: #numberOfMethodsOverriden) equals: 0.
self assert: (self nodeClass propertyNamed: #numberOfMethodsOverridden) equals: 0.
self
assert: (self nodeClass propertyNamed: #numberOfLocallyDefinedMethods)
equals: (self nodeClass propertyNamed: #numberOfMethods).
self
assert: (self workstationClass propertyNamed: #numberOfMethodsInherited)
equals: 9.
self assert: (self workstationClass propertyNamed: #numberOfLocallyDefinedMethods) equals: 1.
self assert: (self workstationClass propertyNamed: #numberOfMethodsOverriden) equals: 3.
self assert: (self workstationClass propertyNamed: #numberOfMethodsOverridden) equals: 3.
self
assert:
(self workstationClass propertyNamed: #numberOfLocallyDefinedMethods)
+ (self workstationClass propertyNamed: #numberOfMethodsOverriden)
+ (self workstationClass propertyNamed: #numberOfMethodsOverridden)
equals: (self workstationClass propertyNamed: #numberOfMethods)
]

Expand Down Expand Up @@ -260,8 +260,8 @@ LANFamixPropertiesTest >> testNoDuplicatesOfClassVariables [
]

{ #category : #testing }
LANFamixPropertiesTest >> testOverridenMethods [
self assert: (self model entityNamed: #Smalltalk::LANOutputServer) numberOfMethodsOverriden equals: 2
LANFamixPropertiesTest >> testOverriddenMethods [
self assert: (self model entityNamed: #Smalltalk::LANOutputServer) numberOfMethodsOverridden equals: 2
]

{ #category : #testing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ LANImporterTest >> testMethodIsAbstract [
LANImporterTest >> testMethodOverriding [

self assert: (self model entityNamed: (LANOutputServer>>#canOutput) mooseName) isOverriding.
self assert: (self model entityNamed: (LANNode>>#canOutput) mooseName) isOverriden
self assert: (self model entityNamed: (LANNode>>#canOutput) mooseName) isOverridden
]

{ #category : #tests }
Expand Down