| Summary: | [compiler][null] Allow to specify that repeated calls will return the same results (e.g., for getters) | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Marcel Bruch <marcel.bruch> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.5.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
(In reply to Marcel Bruch from comment #0) > WDYT? local variable |
My code makes an explicit null check: if (problem.getBug() != null && problem.getBug().getBugId() == 0) { Since #getBug() is a getter and no subsequent call like #setBug() happened, null analysis should assume that #getBug() will not be null when called the second time. It's clear to me that generally assuming that a method will be idempotent (as long as no other call on the receiver was made) would be a strong claim. However, it might be valid to allow a API providers to specify that behavior via annotation attributes. E.g. via @Nullable(idempotent=true) Bug getBug() (not sure idempotent is the correct word to use here). WDYT?