Seite 1 von 1

EX06 - Scenario 3

Verfasst: 13. Jun 2018 00:46
von emod02
Hi,

the method we should annotate as fragile with a violated design principle using the FragileChange Annotion should only be the addAll Method?
If so, how should the method definition look like in the @FragileChange annotaion?
I mean the name and the return type of @MethodDef are pretty clear. But as you wrote in 1.1, only primitive types are allowed in this annotaion. And I think the type "Map<? extends K, ? extends V>" is not a primitive type to use in the paramter "params" of @MethodDef. :?

Thanks for your answers

Re: EX06 - Scenario 3

Verfasst: 13. Jun 2018 10:04
von pmueller
Hi,

you can use Map.class instead of Map<...>.
The constraint regarding the primitives only relates to the primitives and their respective Wrapper classes, i.e. you should use int.class instead of Integer.class etc.. You may use any other reference class that you think is correct.
In addition you should annotate the class, not the addAll method.

Best,
Patrick

Re: EX06 - Scenario 3

Verfasst: 14. Jun 2018 07:43
von bafnai
This is the default for the @FragileChange annotation:

Code: Alles auswählen

@FragileChange(method = @MethodDef, time = null, violatdDesignPrinciple = null)
What exactly are we supposed to enter for "method". Is it just @MethodDef(name = "addAll")?
Or are we supposed to enter the name of the method of Map.class that would cause the problems in case the addAll methods would be added?

Re: EX06 - Scenario 3

Verfasst: 14. Jun 2018 09:28
von pmueller
Hi,
bafnai hat geschrieben:
14. Jun 2018 07:43
What exactly are we supposed to enter for "method". Is it just @MethodDef(name = "addAll")?
Or are we supposed to enter the name of the method of Map.class that would cause the problems in case the addAll methods would be added?
Since you neither know the implementation of IntMap.addAll nor Map.addAll, I don't see how you could definitely pinpoint the problem to a single other method, especially since this is only a potential violation.

Best,
Patrick