Skip to content

Commit

Permalink
Remove ineffective stub handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Jul 2, 2024
1 parent 3810b4e commit bf47b28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 77 deletions.
21 changes: 0 additions & 21 deletions src/Famix-Value-Entities/FamixValueOfType.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,6 @@ FamixValueOfType >> addValueInDictionary: anObject [
^ self valueInDictionaries add: anObject
]

{ #category : #'ston persistence' }
FamixValueOfType >> asJsonString [
"Currently does not work. Ideas:
- Find a way to serialize any object while handling circular dependencies.
- Use the json stored in the root value to read it into raw objects and traverse the path to this value."

self flag: #TODO.
^ self asNeoJSONObject asString
]

{ #category : #'ston persistence' }
FamixValueOfType >> asNeoJSONObject [

self flag: #TODO. "see #asJsonString"
^ self typedEntity
ifNotNil: [ "at root"
NeoJSONObject fromString: (self cacheAt: #json ifAbsent: '{}') ]
ifNil: [ "how to iterate until root?"
NeoJSONObject fromString: (self cacheAt: #json ifAbsent: '{}') ]
]

{ #category : #accessing }
FamixValueOfType >> attributeInObjects [
"Relation named: #attributeInObjects type: #FamixValueOfObjectAttribute opposite: #value"
Expand Down
59 changes: 3 additions & 56 deletions src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -186,49 +186,7 @@ FamixValue2FASTJavaVisitor >> makeHelperClass [
expression:
(model newNewExpression type:
(model newClassTypeExpression typeName:
(model newTypeName name: 'ObjectMapper')))) }).
(model newMethodEntity
typeParameters:
{ (model newTypeParameterExpression name: 'T') };
type:
(model newClassTypeExpression typeName:
(model newTypeName name: 'T'));
name: 'deserialize';
parameters: {
(model newParameter
variable: (model newVariableExpression name: 'json');
type: (model newClassTypeExpression typeName:
(model newTypeName name: 'String'))).
(model newParameter
variable: (model newVariableExpression name: 'clazz');
type: (model newClassTypeExpression
typeName: (model newTypeName name: 'Class');
arguments: { (model newClassTypeExpression typeName:
(model newTypeName name: 'T')) })) };
modifiers: {
(model newModifier token: 'public').
(model newModifier token: 'static') };
statementBlock: (model newStatementBlock statements: {
(model newTryCatchStatement
try: (model newStatementBlock statements:
{ (model newReturnStatement expression:
(model newMethodInvocation
receiver: (model newIdentifier name: 'mapper');
name: 'readValue';
arguments: {
(model newVariableExpression name: 'json').
(model newVariableExpression name: 'clazz') })) });
catches: { (model newCatchPartStatement
catchedTypes:
{ (model newClassTypeExpression typeName:
(model newTypeName name: 'IOException')) };
body: (model newStatementBlock statements:
{ (model newExpressionStatement expression:
(model newMethodInvocation
receiver: (model newIdentifier name: 'e');
name: 'printStackTrace')) });
parameter: (model newVariableExpression name: 'e')) }).
(model newReturnStatement expression: model newNullLiteral) })) }
(model newTypeName name: 'ObjectMapper')))) }) }
]

{ #category : #ast }
Expand Down Expand Up @@ -450,20 +408,9 @@ FamixValue2FASTJavaVisitor >> visitObjectOfRegularType: object [

{ #category : #visiting }
FamixValue2FASTJavaVisitor >> visitObjectStub: object [
"Previously tried to recreate stubs by deserializing their JSON representation, but getting a correct JSON string is a challenge."

self statementBlock addStatement: (self model newVarDeclStatement
type: (object asFASTJavaTypeExpressionOn: self);
addDeclarator: (self model newVariableDeclarator
variable: (self makeVariableExpression: object);
expression: (model newMethodInvocation
name: 'deserialize';
arguments: {
(model newStringLiteral primitiveValue:
object asJsonString).
(model newClassProperty
type: (object asFASTJavaTypeExpressionOn: self);
fieldName: 'class') }));
yourself)
self shouldBeImplemented
]

{ #category : #visiting }
Expand Down

0 comments on commit bf47b28

Please sign in to comment.