invariant:ex2
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| invariant:ex2 [2007/02/25 17:48] – bdefrain | invariant:ex2 [2021/02/05 13:53] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Invariants: Mandate setters ====== | + | [[invariant: |
| + | [[invariant: | ||
| + | [[invariant: | ||
| + | [[invariant: | ||
| + | [[invariant: | ||
| + | [[invariant: | ||
| **Task:** Signal a warning for assignments to private fields outside of setter methods. | **Task:** Signal a warning for assignments to private fields outside of setter methods. | ||
| Line 16: | Line 21: | ||
| **Tools:** The '' | **Tools:** The '' | ||
| </ | </ | ||
| + | |||
| + | You should get eleven warnings from this aspect. Notice that a lot of them are from within constructors. Actually, the common coding convention is that no private field should be assigned to outside of setter methods //or constructors// | ||
| + | |||
| + | <note tip> | ||
| + | **Tools:** Another '' | ||
| + | </ | ||
| + | |||
| + | After you specify your pointcut correctly, you'll still find that the convention is violated twice in the figures package. You should see two errors in the '' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | Don't correct these set statements. Instead, when done, disable your aspect: right-click on it and select **Build Path** -> **Exclude**. Continue with [[invariant: | ||
invariant/ex2.1172422114.txt.gz · Last modified: by bdefrain
