summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
4625926)
In case we do not have any properties we end up emitting a local
variable which we'll never use -- generating a compiler warning.
Improve InterfaceTemplate to check for this condition and emit the
prime only if there are actually at least one property.
Change-Id: I3341ca075e8c7c0b671a76f226b7bdb99cb12465
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
* @throws «NPE.importedName» if {@code obj} is {@code null}
*/
static int «BINDING_HASHCODE_NAME»(final «type.fullyQualifiedNonNull» obj) {
* @throws «NPE.importedName» if {@code obj} is {@code null}
*/
static int «BINDING_HASHCODE_NAME»(final «type.fullyQualifiedNonNull» obj) {
- «FOR property : typeAnalysis.value»
- result = prime * result + «property.importedUtilClass».hashCode(obj.«property.getterMethodName»());
- «ENDFOR»
+ «val props = typeAnalysis.value»
+ «IF !props.empty»
+ final int prime = 31;
+ «FOR property : props»
+ result = prime * result + «property.importedUtilClass».hashCode(obj.«property.getterMethodName»());
+ «ENDFOR»
+ «ENDIF»
«IF augmentable»
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
«IF augmentable»
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
result = prime * result + Objects.hashCode(obj.getTest());
return result;
}
result = prime * result + Objects.hashCode(obj.getTest());
return result;
}
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
result = prime * result + Objects.hashCode(obj.getTest1());
result = prime * result + Objects.hashCode(obj.getTest2());
return result;
result = prime * result + Objects.hashCode(obj.getTest1());
result = prime * result + Objects.hashCode(obj.getTest2());
return result;
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
int result = 1;
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
int result = 1;
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
result = prime * result + Objects.hashCode(obj.getTest());
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
result = prime * result + Objects.hashCode(obj.getTest());
for (var augmentation : obj.augmentations().values()) {
result += augmentation.hashCode();
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
* @throws NullPointerException if {@code obj} is {@code null}
*/
static int bindingHashCode(final test.@NonNull test obj) {
result = prime * result + Objects.hashCode(obj.getTest1());
result = prime * result + Objects.hashCode(obj.getTest2());
for (var augmentation : obj.augmentations().values()) {
result = prime * result + Objects.hashCode(obj.getTest1());
result = prime * result + Objects.hashCode(obj.getTest2());
for (var augmentation : obj.augmentations().values()) {