... | ... | @@ -2,7 +2,7 @@ |
|
|
* Classes should be immutable where possible
|
|
|
* Classes that may be used by multiple threads must be thread-safe
|
|
|
* If a class is used by a single thread and is not thread-safe, add a comment
|
|
|
* Fields that are accessed by multiple threads must be volatile or guarded by locks
|
|
|
* Fields that are used by multiple threads must be volatile or guarded by locks
|
|
|
* If a field or method is guarded by a lock, add a comment
|
|
|
|
|
|
#### Visibility
|
... | ... | @@ -11,9 +11,10 @@ |
|
|
* Fields should be final where possible
|
|
|
* Inner classes should be static where possible
|
|
|
|
|
|
#### Instantiation
|
|
|
* Don't allow `this` to escape the constructor
|
|
|
#### Constructors and Dependencies
|
|
|
* Never allow `this` to escape the constructor
|
|
|
* Complex dependencies should be injected or constructed by factories
|
|
|
* Avoid static methods, except for simple and ubiquitous tasks
|
|
|
* Use executors rather than creating threads where possible
|
|
|
|
|
|
#### Exceptions
|
... | ... | |