Skip to content

Miha-x64/Mikes_IDEA_extensions

Repository files navigation

Mike's IDEA extensions

IntelliJ IDEA Plugin IntelliJ IDEA Plugin

Code quality goodifier, RAM saver, performance watcher, mood upgrader, vector drawable optimizer, color previewer.

UAST (Java + Kotlin) inspections

  • Atomic can be replaced with volatile
  • Allocation should be cached (new Gson(), new OkHttpClient())
  • BigDecimal|BigInteger instantiation can be replaced with constant by stokito
  • (BigDecimal|BigInteger).compareTo(ZERO) can be replaced with signum() by stokito

Kotlin inspections

  • Heavyweight property delegation
  • Declaration name is Java keyword
  • Inline function leaks anonymous declaration which will be inlined to the call-site if called from another module
  • Anonymous function won't be inlined; function cannot be inlined if it is a receiver of an extension function
  • Nullable argument to string concatenation should be re-implemented in more reliable way
  • Boxed primitive array allocation

Android inspections

  • <include layout="?themeAttribute"> requires Marshmallow
  • <drawable android:tint> requires Lollipop
  • <layer-list><item android:gravity> requires Marshmallow
  • @TargetApi should be replaced with @RequiresApi
  • Use of reflective ObjectAnimator/PropertyValuesHolder
  • Use of attributes like android.R.attr.enabled in context where state attributes expected, like android.R.attr.state_enabled
  • Color.parseColor(<constant expression>) should be replaced with an integer literal
  • Useless resource element
    • Drawables: single-item layer-lists, single stateless item selectors, insetless insets, empty shapes
    • Vector drawables: empty paths and clip-paths, invisible paths, suboptimal paths, useless clip-paths and groups, attributes with no effect
    • Animations and animators: empty and single-element sets
    • Layouts: overridden attributes in (layout_margin|padding)(Left|Top|Right|Bottom|Start|End|Horizontal|Vertical|*)
  • Android utility methods should be replaced with Kotlin extensions
  • setOnClickListener doesn't work on RecyclerView, on VideoView before API 26
  • Kotlin Android Extensions are deprecated
  • Drawable subclass should override getConstantState()
  • Activity#onCreate(, PersistableBundle) will highly likely not be called
  • <AnyScrollableView> should have an ID to save its scroll position

Editor tweaks

  • Inlay hints when upcasting to interface, e. g.
    putExtra(listas Serializable)
  • Inlay hints when overriding an interface method, e. g.
    @Override from Runnable,
    override fun Runnable.run()
  • Inlay hints for vararg array allocation:
    String.format("%d", new[]{1});
    maxOf(1, *[2, 3, 4])
  • ARGB Color swatches in gutter, folding int literals to #[AA]RRGGBB, color picker for Android, pasting CSS colors as int literals
  • Backing property folding for Kotlin
  • Live templates for SVG and Android Vector Drawable pathData
  • Live templates for implementing Property for ObjectAnimator

Plugin page on JetBrains marketplace