GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [kotlin] New Rule: LooseCoupling · Issue #7092 · pmd/pmd Closed Labels a:new-ruleProposal to add a new built-in rule Milestone DescriptionProposed Rule Name: Proposed Category: Best Practices Description: This rule also serves as a real-world demonstration of the new Kotlin XPath type functions and Kotlin-specific nuance vs. the Java rule: in Java, Verified against a real, unrelated open-source Kotlin Android app (525 Code Sample: class Example { // violation - concrete type used for a property internal val subscriptions: ArrayList<Closeable> = ArrayList() // violation - concrete type used for a var private var members: ArrayList<Int> = arrayListOf() // violation - concrete return type, but only ever read downstream // (order is preserved by the runtime object regardless of the declared type, // so loosening to Map is safe here - Kotlin's Map iteration order comes from // the underlying object, not the declared interface) private fun sortItems(items: Collection<Item>): LinkedHashMap<String, Item> { // ... } // preferred approach private val subscriptions: MutableList<Closeable> = mutableListOf() private fun sortItems(items: Collection<Item>): Map<String, Item> { // ... } } Possible Properties:
Not in scope / possible follow-up:
Related:
Reacted by Jeroen Borgers Activity
MetadataMetadataAssigneesLabelsa:new-ruleProposal to add a new built-in rule TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |