mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
Find Usages mixed reads and writes of a Java field, including Lombok getter and setter calls, because jdtls has no read/write classification in its references. The usages popup and Find window now have Read and Write toggles. Read-write accesses stay visible in either mode and unclassified results are kept. Classification comes from a jdtls extension in `plugins/java-usages`, embedded as a jar and installed beside the other bundles. The checked-in jar was rebuilt from source with ECJ and matches byte for byte. Any extension failure falls back to standard references, so a jdtls upgrade can lose the filter but not Find Usages; rebuilding the jar on an upgrade is manual and described in the plugin README. Older installed jars are removed. Other languages keep their plain result count. Co-authored-by: NingYuanLin <57001533+NingYuanLin@users.noreply.github.com>
25 lines
1.0 KiB
Java
25 lines
1.0 KiB
Java
import lombok.*;
|
|
import lombok.experimental.Accessors;
|
|
interface Counter { int getCount(); void setCount(int value); }
|
|
@Data class Bean implements Counter { public int count; public Bean next; public int[] items; }
|
|
class Child extends Bean {}
|
|
@Data @Accessors(fluent=true, chain=true) class Fluent { public int score; }
|
|
class Use {
|
|
void uses(Bean b, Child c, Counter i, Fluent f) {
|
|
int read = b.count; // read
|
|
b.count = 1; // write
|
|
b.count += 2; // readWrite
|
|
b.count++; // readWrite
|
|
--b.count; // readWrite
|
|
b.setCount(b.getCount()); // setter write, getter read; nested invocation ranges
|
|
c.setCount(c.getCount()); // inherited
|
|
i.setCount(i.getCount()); // interface
|
|
java.util.function.IntSupplier ref = b::getCount; // unknown
|
|
java.util.function.IntConsumer writeRef = b::setCount; // unknown
|
|
f.score = f.score(); // field write, fluent read
|
|
f.score(f.score()); // fluent setter write, getter read
|
|
b.items[0] = 1; // reading array field, writing element
|
|
b.next.count = 2; // reading receiver field, writing count
|
|
}
|
|
}
|