lombok-intellij-plugin icon indicating copy to clipboard operation
lombok-intellij-plugin copied to clipboard

Java + Lombok + Kotlin - find usages did not work

Open alexey-krylov opened this issue 6 years ago • 6 comments

Short description

Unable to find fields usages of Lombok'ed Java classes in Kotlin files.

Expected behavior

Alt+F7 on field should find each usages on this field in Kotlin (also with Java).

Version information

  • IDEA Version: IntelliJ IDEA 2018.3.4 (Ultimate Edition) Build #IU-183.5429.30, built on January 29, 2019 JRE: 1.8.0_152-release-1343-b26 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0
  • JDK Version: 1.8.0_201
  • OS Type & Version: Windows 10, 64 bit
  • Lombok Plugin Version: v0.23-2018.3
  • Lombok Dependency Version: 1.18.4

Steps to reproduce

  1. Create project with modules in Java and Kotlin
  2. In Java module create class Foo with lombok @Data annotation
  3. In Kotlin module create some service that uses Foo class attributes from Java module
  4. Go to Foo.java and try to find usages for attributes that is used in Kotlin module - nothing will be found

Sample project

https://github.com/alexey-krylov/kotlin-java-lombok-search-issue-project

To reproduce search usages issue go to Foo.java and try to find usages of 'uuid' field. It should find one usage in class FooService.kt, but it doesn't.

Additional information

Stacktrace

alexey-krylov avatar Feb 18 '19 09:02 alexey-krylov

As i workaround now i'm using @FieldDefaults(level = AccessLevel.PUBLIC) on all fields, in this case all usages is seen by IDEA

alexey-krylov avatar Feb 18 '19 11:02 alexey-krylov

Also i've created issue here: https://youtrack.jetbrains.com/issue/IDEA-207470

alexey-krylov avatar Feb 18 '19 14:02 alexey-krylov

same issue

xinatcg avatar Jun 08 '20 07:06 xinatcg

it seem like kotlin use property and lombok generate getter, they are confused in IDEA. I can only add a getter to the field

xinatcg avatar Jun 08 '20 07:06 xinatcg

Dear Big man, is the problem solved? Ask for help me!

BrokerXu avatar Apr 08 '22 06:04 BrokerXu

No, it's still an issue. The workaround with setting all fields to public does work, but it also means you have publicly accessible fields, obviously.

FichteFoll avatar Nov 10 '23 10:11 FichteFoll