question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong compile error in IDE for generated Lenses

See original GitHub issue

Sometimes there is an error in your IDE with the generated L object after the Gradle build were successfull.

val name = inspector.sub(L.Person.name)

This is of course confusing and we should try to check if we can tell the IDE where to find this generated sources.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jwstegemanncommented, Dec 22, 2020

Classes annotated with @Lenses have to be in the commonMain SourceSet (as described here https://docs.fritz2.dev/Lenses.html). Also you should put your data model classes in a package different from root to avoid name conflicts.

We add commonMain to our project template to make this more obvious…

0reactions
jamoweicommented, Jan 26, 2021

I had this problem too. IntelliJ Idea also told me about “duplicate roots detected” and that it fixed it by removing some duplicates. I then started to compare my build.gradle.kts with the one from https://github.com/jamowei/fritz2-ktor-todomvc until I found my problem:

    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
        withJava() // remove this
    }

I had to remove the withJava() call and after that IntelliJ Idea didn’t complain anymore and it startet to find the generated lenses (after running gradle jsMainClasses). I don’t even known where I had this from and my project still runs fine in the backend and frontend.

I hope this information can help other people.

Yes, I had the same problem in this project too. And I also had to remove the ẁithJava() call. But then the run tasks stopped working and I must changed more things in my build file in order to get it work again. Now it should work fine without withJava(). Hopefully the current version of build.gradle.kts is a good place to take from.

If you have some improvements please let me know or give me a PR! Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

False compile error - IDEs Support (IntelliJ Platform) | JetBrains
Hi,Something strange is happening in Idea..When I build my project, Idea tells me that I have 3 compile errors. Then I go to...
Read more >
Visual Studio Code Extension: Error Lens - YouTube
In this video, I'm going to explain about the extension called ErrorLens for Visual Studio Code. It is a great extension to catch...
Read more >
Fix the top 10 most common compile time errors in Java
Here are the 10 most commonly encountered Java compile errors, ... If not, the compiler generates the following Java compile time error:
Read more >
Compiler Error Messages Considered Unhelpful
Diagnostic error messages generated by compilers and interpreters, including error, warning, and run-time messages, have been re- searched for over 50 years ...
Read more >
IDEA JetBrains IntelliJ - Compile error on 'make' but fine when ...
The error message is basically saying that that method doesn't exist but believes the old method still exists! I click on the 'make'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found