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' }

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]

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Kotlin, 241.16690-IJ

Last modified: 29 April 2024