support projects with module-info.java
See original GitHub issueShort description
The plugin should support code which is modularize with Jigsaw. Simply placing a module-info.java creates problems on code which worked before. And in context of Maven projects. Unmodularized code works with Java 11.
Expected behavior
Same a before or with javac -cp lombok.jar -p lombok.jar *.java
Version information
- IDEA Version: _2018.3.2
- JDK Version: java 11 2018-09-25
- OS Type & Version: Mac OS 10.13.6 (17G4015)
- Lombok Plugin Version: v0.23-2018.3
- Lombok Dependency Version: 1.18.4, from Maven and separate download
Steps to reproduce
What steps do we need to take to reproduce this issue?
- Run the class Main => fails
- remove module-info.java => Main runs
- Revert from CVS
- place the file lombok.jar into src/main/java
- javac -cp lombok.jar -p lombok.jar *.java => Main runs
Sample project
Please provide a sample project that exhibits the problem.
You should also include .idea
folder so we can inspect the settings.
- https://github.com/bojanantonovic/lombok-jigsaw
- I am able to reproduce this error on the sample project by following the steps described above
Additional information
The usage of the Maven Lombok plugin is longterm goal. The the IntelliJ Lombok plugin should work too.
Stacktrace
No stack trace as such. But the following error text shows up:
Person.java:1: error: package lombok does not exist
import lombok.Data;
^
Person.java:3: error: cannot find symbol
@Data
^
symbol: class Data
Main.java:4: error: constructor Person in class Person cannot be applied to given types;
final Person person = new Person("A", "B", 10);
^
required: no arguments
found: String,String,int
reason: actual and formal argument lists differ in length
Main.java:6: error: cannot find symbol
System.out.println(person.getFirstName());
^
symbol: method getFirstName()
location: variable person of type Person
Main.java:7: error: cannot find symbol
System.out.println(person.getSecondName());
^
symbol: method getSecondName()
location: variable person of type Person
Main.java:8: error: cannot find symbol
System.out.println(person.getAge());
^
symbol: method getAge()
location: variable person of type Person
6 errors
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
Building Java Modules Sample - Gradle User Manual
This sample shows how to create a multi-project containing Java Modules. ... Java sources can be turned into a module by adding a...
Read more >Support for Java 9 Modules in IntelliJ IDEA 2017.1
Let's take a look at a basic example of a modular project. ... IntelliJ IDEA lets you create a new module-info.java for your...
Read more >Older projects with module-info - Apache Maven
Older projects with module-info. Projects that want to be compatible with older versions of Java (i.e 1.8 or below bytecode and API), ...
Read more >A Guide to Java 9 Modularity - Baeldung
This, of course, is the same as any other Java project so it should ... a special file at the root of our...
Read more >Embracing Java 9 and beyond with Eclipse JDT
The latest release, Eclipse Photon is now available and supports Java 9 and ... New Java Project Menu which has by default Create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding module-info.java to the project breaks intellij-lombok. Intellij Editor doesn’t show any errors but building the project fails with a bunch of “cannot find symbol”.
Removing module-info.java from the project solves the problem. But it is kind of so-so solution 😦
Gradle build the project with no issues even with modules enabled and the following dependencies: compileOnly group: ‘org.projectlombok’, name: ‘lombok’, version: ‘1.18.10’ annotationProcessor group: ‘org.projectlombok’, name: ‘lombok’, version: ‘1.18.10’
I have used a work around for this. I am working with spring boot and I use Gradle as my build tool so this may be helpful to other people with a similar setup whilst this issue gets looked at. I wanted to debug my spring boot app when I ran into this issue so I hope the configuration below will let other people set up an IntelliJ Remote Debug Configuration so they can compile and debug thier app with Lombok from IntelliJ
build.gradle
, I addedCreate a Remote Run/Debug Configuration in Intellij . See Remote Debugging with IntelliJ or Run/Debug Configuration: Remote Debug
Enable Annotation Preprocessing in IntelliJ like so
This just makes sure that IntelliJ will recognise the Lombok annotations. It does not address the compilation issue above
Set your breakpoints
run
./gradlew bootRun
from the terminal / cmdRun the Debug configuration from step 2
Your breakpoints should now be activated
If you have some tests that you want to Debug, you can do the following
Set some breakpoints in your test classes / methods
run
./gradlew test --debug-jvm
Wait for the jvm debugger to suspend and Look out for the log message below in your console
Listening for transport dt_socket at address: 5005
Your breakpoints should now be activated
Tip: if you do not want to use the
--debug-jvm
option on the command line when running the./gradlew test
command, you can add the test configuration below to youbuild.gradle
file. Note that suspend=y. This causes the debugger to suspend