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 { ----------- 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: [hidden email] Internet: http://www.mathema.de Handelsregister: HR B 8965, Fürth/Bayern Geschäftsführer: Michael Wiedeking Andreas Hanke _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Thomas, sorry I did not spot this email earlier. Here's what I get with VerveineJ: (FAMIX.Method (id: 58) (name 'getTheGeneric') (cyclomaticComplexity 1) (declaredType (ref: 28)) (hasClassScope true) (modifiers 'public') (numberOfStatements 1) (parentType (ref: 17)) (signature 'getTheGeneric(String)') (sourceAnchor (ref: 57))) (FAMIX.Type (id: 28) (name 'TResult') (container (ref: 58)) (isStub true)) so TResult is simply a type defined by the method getTheGeneric. Same goes for TValue There is nothing special marking them as "VariableTypes" (FAMIX.Method (id: 34) (name 'useTheGeneric') (cyclomaticComplexity 1) (declaredType (ref: 50)) (hasClassScope true) (modifiers 'public') (numberOfStatements 2) (parentType (ref: 17)) (signature 'useTheGeneric(TValue)') (sourceAnchor (ref: 37))) (FAMIX.Parameter (id: 36) (name 'value') (declaredType (ref: 14)) (parentBehaviouralEntity (ref: 34))) (FAMIX.Type (id: 14) (name 'TValue') (container (ref: 34)) (isStub true)) nicolas PS: I see that verveineJ treat them as stubs. I am not sure whether this is right. It should probably not ... On 18/09/2014 20:52, Thomas Haug wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Nicolas, thank you for your answer and explanation. I would have hoped that generic methods would be expressed similar to generic types/classes. But "binding" the generic Types like TValue to the method seem to make sense and it is consistent to the way generic classes are handled in InFamix, e.g: (FAMIX.ParameterizableClass (id: 154)But how do you handle concrete usages of the generic method like ClassWithGenericMethod.useTheGeneric("hi generic method"); // type inference ClassWithGenericMethod.useTheGeneric(1.5d); // type inference InFamix generates the following: (FAMIX.Invocation based on the source code. It does not "detect" the concrete types. If you would parse compiled code this might change... Thanks once again for your feedback! Thomas Hi Thomas, _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Nicolas, I have now released a new version of the FamixGenerator (http://www.sharpmetrics.net/index.php/famix-generator), which handles generic Methods similar to VerveineJ. Cheers 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: [hidden email] Internet: http://www.mathema.de Handelsregister: HR B 8965, Fürth/Bayern Geschäftsführer: Michael Wiedeking Andreas Hanke
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |