diff --git a/src/Famix-Value-Entities/FamixValueUnknownType.class.st b/src/Famix-Value-Entities/FamixValueUnknownType.class.st index 1e85936..d30d28d 100644 --- a/src/Famix-Value-Entities/FamixValueUnknownType.class.st +++ b/src/Famix-Value-Entities/FamixValueUnknownType.class.st @@ -19,7 +19,7 @@ FamixValueUnknownType class >> annotation [ ] { #category : #visiting } -FamixValueUnknownType >> acceptValueVisitor: visitor for: object [ +FamixValueUnknownType >> acceptValueVisitor: visitor forObject: object [ self error: 'Exporting an unknown type is not (yet?) supported.' ] diff --git a/src/Famix-Value-Exporter/FamixJavaType.extension.st b/src/Famix-Value-Exporter/FamixJavaType.extension.st index 3724990..ac48918 100644 --- a/src/Famix-Value-Exporter/FamixJavaType.extension.st +++ b/src/Famix-Value-Exporter/FamixJavaType.extension.st @@ -1,7 +1,13 @@ Extension { #name : #FamixJavaType } { #category : #'*Famix-Value-Exporter' } -FamixJavaType >> acceptValueVisitor: visitor for: object [ +FamixJavaType >> acceptValueVisitor: visitor forCollection: collection [ + + ^ visitor visitCollectionOfRegularType: collection +] + +{ #category : #'*Famix-Value-Exporter' } +FamixJavaType >> acceptValueVisitor: visitor forObject: object [ ^ visitor visitObjectOfRegularType: object ] diff --git a/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st b/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st index f06150d..a9f645c 100644 --- a/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st +++ b/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st @@ -228,6 +228,13 @@ FamixValue2FASTJavaVisitor >> statementBlock [ { #category : #visiting } FamixValue2FASTJavaVisitor >> visitCollection: collection [ + "Dispatch to type to handle special cases" + + ^ collection type acceptValueVisitor: self forCollection: collection +] + +{ #category : #visiting } +FamixValue2FASTJavaVisitor >> visitCollectionOfRegularType: collection [ | varName | self statementBlock addStatement: @@ -278,7 +285,7 @@ FamixValue2FASTJavaVisitor >> visitEnumValue: enumValue [ FamixValue2FASTJavaVisitor >> visitObject: object [ "Dispatch to type to handle special cases" - ^ object type acceptValueVisitor: self for: object + ^ object type acceptValueVisitor: self forObject: object ] { #category : #visiting } diff --git a/src/Famix-Value-Importer/FamixJavaEntityFinder.class.st b/src/Famix-Value-Importer/FamixJavaEntityFinder.class.st index 21ad102..46ab1f5 100644 --- a/src/Famix-Value-Importer/FamixJavaEntityFinder.class.st +++ b/src/Famix-Value-Importer/FamixJavaEntityFinder.class.st @@ -34,14 +34,24 @@ FamixJavaEntityFinder >> methodNameFromSignature: signature [ { #category : #enumerating } FamixJavaEntityFinder >> parseTypeName: name [ - "The name may not be fully qualified." + "The name may not be fully qualified. + Even if we want to find a name in java.lang or java.util packages, we want to search using the mooseName if it is parameterized. + Famix does not represent arrays, but we need the information, so we use a wrapper around the type." - (name includes: $.) ifFalse: [ ^ self findTypeWithName: name ]. - self flag: #VerveineJ. - ^ "(name beginsWithAnyOf: #( 'java.lang.' 'java.util.' )) - ifTrue: [ self findTypeWithName: (name copyAfterLast: $.) ] - ifFalse: [" - self findTypeWithMooseName: (name copyReplaceAll: '.' with: '::') "]" + | typeName dimensions type | + typeName := self translateFieldDescriptor: name. + dimensions := name occurrencesOf: $[. + type := (typeName includes: $.) + ifFalse: [ self findTypeWithName: typeName ] + ifTrue: [ + self findTypeWithMooseName: + ((typeName allButLast: dimensions * 2) + copyReplaceAll: '.' + with: '::') ]. + ^ dimensions > 0 + ifFalse: [ type ] + ifTrue: [ + (FamixValueJavaArray proxying: type) dimensions: dimensions ] ] { #category : #matching } diff --git a/src/Famix-Value-Importer/FamixValueAbstractImporter.class.st b/src/Famix-Value-Importer/FamixValueAbstractImporter.class.st index 794b555..eed1265 100644 --- a/src/Famix-Value-Importer/FamixValueAbstractImporter.class.st +++ b/src/Famix-Value-Importer/FamixValueAbstractImporter.class.st @@ -150,7 +150,7 @@ FamixValueAbstractImporter >> initialize [ FamixValueAbstractImporter >> loadType [ "Return the inferred type if it exists, otherwise the type is unknown." - ^ self typeInference ifNil: [ self getUnknownTypeNamed: 'UNKNOWN' ] + ^ self typeInference ifNil: [ self getDefaultUnknownType ] ] { #category : #enumerating }