Inspectopedia Help

Accessor call that can be replaced with property access syntax

Reports Java get and set method calls that can be replaced with the Kotlin synthetic properties.

Use property access syntax quick-fix can be used to amend the code automatically.

Example:

// Java: public class JavaClassWithGetter { private final String expr = "result"; // ... public String getExpr() { return expr; } }
// Kotlin: fun test(j: JavaClassWithGetter) { // ... j.getExpr() // <== The quick-fix simplifies the expression to 'j.expr' }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

UsePropertyAccessSyntax
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Kotlin | Style issues

Inspection options

Here you can find the description of settings available for the Accessor call that can be replaced with property access syntax inspection, and the reference of their default values.

Report non-trivial accessors

Not selected

Excluded methods

[java.net.Socket.getInputStream, java.net.Socket.getOutputStream, java.net.URLConnection.getInputStream, java.net.URLConnection.getOutputStream, java.util.concurrent.atomic.AtomicInteger.getAndIncrement, java.util.concurrent.atomic.AtomicInteger.getAndDecrement, java.util.concurrent.atomic.AtomicInteger.getAcquire, java.util.concurrent.atomic.AtomicInteger.getOpaque, java.util.concurrent.atomic.AtomicInteger.getPlain, java.util.concurrent.atomic.AtomicLong.getAndIncrement, java.util.concurrent.atomic.AtomicLong.getAndDecrement, java.util.concurrent.atomic.AtomicLong.getAcquire, java.util.concurrent.atomic.AtomicLong.getOpaque, java.util.concurrent.atomic.AtomicLong.getPlain, java.nio.ByteBuffer.getChar, java.nio.ByteBuffer.getDouble, java.nio.ByteBuffer.getFloat, java.nio.ByteBuffer.getInt, java.nio.ByteBuffer.getLong, java.nio.ByteBuffer.getShort]

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Kotlin, 241.18072-IJ

Last modified: 18 June 2024