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'
}
- 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
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.
- 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: | |
Can be installed with plugin: | Kotlin, 243.23126-IJ |
Thanks for your feedback!