Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Item tags for tile icon suggestion #2194

Merged
merged 4 commits into from
Sep 18, 2020
Merged

Conversation

mueller-ma
Copy link
Member

I used an array for the tags, because it can be put in a bundle. Android Studio suggested to override equals() and hashCode(), so I added the auto generated functions.

Signed-off-by: mueller-ma mueller-ma@users.noreply.github.com

@maniac103
Copy link
Contributor

Android Studio suggested to override equals() and hashCode(), so I added the auto generated functions.

I think AS is wrong there, as - AFAIK - data classes already implement those.

@mueller-ma
Copy link
Member Author

Android Studio suggested to override equals() and hashCode()

With and without these functions the unit tests I added fail. So both, the auto generated one by AS and the auto generated one by Kotlin, are invalid.

@mueller-ma
Copy link
Member Author

I did some more testing: For Items without members the custom equals() works well, but not the one generated by data class. For Items with members both equals() functions fail.

I used an array for the tags, because it can be put in a bundle. Android Studio suggested to override `equals()` and `hashCode()`, so I added the auto generated functions.

Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com>
Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com>
Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com>
@maniac103
Copy link
Contributor

maniac103 commented Sep 18, 2020

maniac103@0b8e571 is the fix for the issue - its commit message has the explanation for the failure ;-) See here for the Array vs. List difference.

- The automatically generated equals() method for ParsedState failed,
  since Location doesn't have an equals method and thus reference
  equality was checked, which is not what we intended
- The tags field also was compared by reference instead of by value,
  (which is a notable difference between Array<*>, which is compared by
  reference, and List<*>, which is compared by value)

Signed-off-by: Danny Baumann <dannybaumann@web.de>
@mueller-ma mueller-ma merged commit 1140c5b into openhab:master Sep 18, 2020
@mueller-ma mueller-ma deleted the tags branch September 18, 2020 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants