Ex 5.2 - InsufficientDocumentation about non-overridable methods...

0b101101101
Endlosschleifenbastler
Endlosschleifenbastler
Beiträge: 179
Registriert: 15. Apr 2015 18:24

Ex 5.2 - InsufficientDocumentation about non-overridable methods...

Beitrag von 0b101101101 » 4. Dez 2017 15:03

In the lectures it says that an overridable method must declare that it uses other overridable methods. But I think that all methods (even non-overridable public methods) must declare use of overridable methods, or else it would be possible to change the behavior of these overridable methods.

In summary: Both overridable and non-overridable methods must declare all transitively used fields and overridable methods to comply, right?

eichberg
Dozentin/Dozent
Beiträge: 448
Registriert: 25. Sep 2007 12:12
Kontaktdaten:

Re: Ex 5.2 - InsufficientDocumentation about non-overridable methods...

Beitrag von eichberg » 4. Dez 2017 15:33

Even a final(non-overridable) method which calls another (instance) method (target) generally has to document self-use. E.g., let's assume we want to implement an InstrumentedHashSet which counts additions and let's assume that the addAll method defined by the superclass HashSet is final; now – to ensure that we count correctly when we "just" override add - we have to know (and also be able to rely on it(!)) that addAll is implemented in terms of add.

Finn
Neuling
Neuling
Beiträge: 10
Registriert: 23. Jun 2015 11:19

Re: Ex 5.2 - InsufficientDocumentation about non-overridable methods...

Beitrag von Finn » 7. Feb 2018 19:49

We are currently redoing the exercises and don't understand why push() and pop() are not annotated with @InsufficientDocumentation.

In our opinion use of the variable entries should be documented, as overriding only one of them results in unexpected behavior.

Can you please explain why the documentation is complete without mentioning this?

Antworten

Zurück zu „Archiv“