Library does not match the bytecode for class XXX
See original GitHub issueShort description
When using libraries built with lombok and attaching source with lombok annotations, IntelliJ complains about mismatch between source and class file.
Expected behavior
IntelliJ should not complain about mismatch since the source, when lombok-ed, will compile to the provided class.
Version information
- IDEA Version: IntelliJ IDEA 2017.3.2 (Community Edition) Build #IC-173.4127.27, built on December 25, 2017 JRE: 1.8.0_152-release-1024-b8 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.10.0-42-generic
- JDK Version: 1.8.0_111
- OS Type & Version: Ubuntu 16.04 LTS
- Lombok Plugin Version: 0.15.17.2
- Lombok Dependency Version: 1.16.6
Steps to reproduce
- In a source root run the following
mvn archetype:generate -DgroupId=com.test.rb.m1 -DartifactId=module1 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
mvn archetype:generate -DgroupId=com.test.rb.m2 -DartifactId=module2 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
- update module 1 pom.xml: 2.1 add lombok dependency
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
<scope>provided</scope>
</dependency>
2.2 add source plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
- update module 1 App.java:
@Setter
@Getter
public class App {
private String myField;
@SneakyThrows
public void ex() {
throw new Exception("ex");
}
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
- update module 2 pom.xml - add dependency on module 1:
<dependency>
<groupId>com.test.rb.m1</groupId>
<artifactId>module1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
- run “mvn install” on module 1
- open module 2 in IntelliJ, open class “com.test.rb.m1.App”
IntelliJ shows a red error “Library source does not match the bytecode for class App”
Sample project
Please provide a sample project that exhibits the problem.
See lombok_bug.tar.gz](https://github.com/mplushnikov/lombok-intellij-plugin/files/1620326/lombok_bug.tar.gz)
You should also include .idea
folder so we can inspect the settings.
- [X ] Sample project provided - [
- [X ] I am able to reproduce this error on the sample project by following the steps described above
Additional information
no
Stacktrace
none
Issue Analytics
- State:
- Created 6 years ago
- Reactions:30
- Comments:10
Top GitHub Comments
@mplushnikov Any updates on this?
I’ve done a work a round that helped me to solve this problem. Using this plugin (https://plugins.gradle.org/plugin/io.freefair.lombok) what I do is to
delombok
my files and use them to create the source. It’s not the best solution but at least now the source is pure Java and it can be debugged.build.gradle