Skip to content

Commit

Permalink
visit transient attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Jun 4, 2024
1 parent e10fcbd commit bb67f31
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Famix2Java-Tests/FAMIX2JavaVisitorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,33 @@ FAMIX2JavaVisitorTest >> testVisitPrivateMethod [
}'
]

{ #category : #test }
FAMIX2JavaVisitorTest >> testVisitPrivateTransientAttribute [

| attribute attributeClass attributeDeclaredType sourceAnchor model resultString |
model := FamixJavaModel new.
attributeDeclaredType := FamixJavaClass new.
attributeDeclaredType name: 'AttributeClass'.
attribute := FamixJavaAttribute new.
attribute name: 'anAttribute'.
attribute isPrivate: true.
attribute isTransient: true.
attribute declaredType: attributeDeclaredType.
sourceAnchor := FamixJavaSourceTextAnchor new.
sourceAnchor source: ''.
attribute sourceAnchor: sourceAnchor.
attributeClass := FamixJavaClass new.
attributeClass addAttribute: attribute.
model addAll: {
attribute.
attributeClass.
sourceAnchor }.
resultString := String streamContents: [ :stream |
visitor currentStream: stream.
attribute accept: visitor ].
self assert: resultString equals: 'private transient AttributeClass anAttribute;'
]

{ #category : #test }
FAMIX2JavaVisitorTest >> testVisitPublicMethod [

Expand Down
1 change: 1 addition & 0 deletions src/Famix2Java/FAMIX2JavaVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ FAMIX2JavaVisitor >> visitAttribute: aAttribute [
aAttribute isProtected ifTrue: [ self << 'protected ' ].
aAttribute isPublic ifTrue: [ self << 'public ' ].
aAttribute isClassSide ifTrue: [ self << 'static ' ].
aAttribute isTransient ifTrue: [ self << 'transient ' ].
"Declared Type"
aAttribute declaredType
ifNotNil: [ self printDeclaredType: aAttribute declaredType ]
Expand Down

0 comments on commit bb67f31

Please sign in to comment.