Hi everybody,
I hope my question is not off topic:
I am currently trying to figure out how to describe generic methods in Famix 3.0 (for the
.NET FamixGenerator)
For example in Java you can write the following code.
public class ClassWithGenericMethod {
public static <TResult> TResult getTheGeneric(String resource) {
return null;
}
public static <TValue> void useTheGeneric(TValue value) {
System.out.println("value '"+value +"' type:
"+value.getClass());
}
If I run InFamix on this code I get an Famix file containing something like:
1 method:
(FAMIX.Method (id: 24)
(sourceAnchor (ref: 60))
(parentType (ref: 30))
(declaredType (ref: 33))
(name 'getTheGeneric')
(signature 'getTheGeneric(_unknown_path::String)')
(hasClassScope true)
(isPublic true)
(isPureAccessor true)
(ATFD 0.00)
(ALD 0.00)
(CYCLO 1.00)
(DR 0.00)
(ICDO 1.00)
(ICIO 1.00)
(LOC 3.00)
(LOCOMM 1.00)
(LDA 1.00)
(MAXNESTING 1.00)
(NOAV 0.00)
(NOOC 0.00)
(NOPAR 1.00)
(OCDO 0.00)
(OCIO 0.00)
)
But id 33 is not existing.
2 method:
(FAMIX.Method (id: 25)
(sourceAnchor (ref: 61))
(parentType (ref: 30))
(declaredType (ref: 28))
(name 'useTheGeneric')
(signature 'useTheGeneric(_unknown_path::TValue)')
(hasClassScope true)
(isPublic true)
(ATFD 0.00)
(ALD 0.00)
(CYCLO 1.00)
(DR 0.00)
(ICDO 1.00)
(ICIO 1.00)
(LOC 3.00)
(LOCOMM 1.00)
(LDA 1.00)
(MAXNESTING 1.00)
(NOAV 2.00)
(NOOC 2.00)
(NOPAR 1.00)
(OCDO 0.00)
(OCIO 0.00)
)
(FAMIX.Parameter (id: 35)
(name 'value')
(parentBehaviouralEntity (ref: 25))
(declaredType (ref: 36))
(position 0)
)
But id 36 is not existing.
I am wondering if there should be something like ParameterizableMethod (like
ParameterizableClass?
Can anybody give me some clues?
Thank you very much
Thomas
-----------
Thomas Haug
Principal Consultant
MATHEMA Software GmbH
Anschrift:
Henkestraße 91
91052 E r l a n g e n
Telefon:
09131/8903- 0
Telefax:
09131/8903-55
E-Mail:
thomas.haug(a)mathema.de
Internet:
http://www.mathema.de
Handelsregister:
HR B 8965, Fürth/Bayern
Geschäftsführer:
Michael Wiedeking
Andreas Hanke