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.

Compiler warnings not reported correctly when combined with Lombok

See original GitHub issue

This is one of the symptoms I reported in #137, which I said was resolved, but I was mistaken (sorry!).

When compiling with both the Manifold and Lombok plugins, javac does not report warnings correctly.

For example, given this input:

class Test {int x = 1/0;}

Compiling with -Xlint:all should print this output:

Test.java:1: warning: [divzero] division by zero
class Test {int x = 1/0;}
                      ^
1 warning

However, the last line (“1 warning”) is missing.

Compiling with -Xlint:all -Werror should print this output:

Test.java:1: warning: [divzero] division by zero
class Test {int x = 1/0;}
                      ^
error: warnings found and -Werror specified
1 error
1 warning

…as well as setting a nonzero exit code, and exiting without producing a .class file. However, the last three lines do not appear, and the compilation succeeds.

I can reproduce the problem with the Test class above using this Maven build configuration:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <encoding>UTF-8</encoding>
          <compilerId>javac</compilerId>
          <source>11</source>
          <target>11</target>
          <showWarnings>true</showWarnings>
          <compilerArgs>
            <arg>-Xlint:all</arg>
            <arg>-Werror</arg>
            <arg>-Xplugin:Manifold no-bootstrap</arg>
          </compilerArgs>
          <annotationProcessorPaths>
            <processorPath>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>1.18.10</version>
            </processorPath>
            <processorPath>
              <groupId>systems.manifold</groupId>
              <artifactId>manifold</artifactId>
              <version>2019.1.32</version>
            </processorPath>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
    </plugins>
  </build>

Without the -Xplugin:Manifold arg, it behaves as expected.

Relevant versions:

  • Windows 10
  • OpenJDK 11.0.2+9
  • Manifold 2019.1.32
  • Lombok 1.18.10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
HuanRuancommented, May 14, 2020

That is amazing @rsmckinney , thanks a lot.

1reaction
iadcodecommented, May 20, 2020

All appears to be working in the new release, thanks @rsmckinney!

Read more comments on GitHub >

github_iconTop Results From Across the Web

MapStruct and Lombok not working together - Stack Overflow
The reason why it does not work is because Maven only uses the MapStruct processor and not the Lombok one. The annotationProcessorPaths tells...
Read more >
Lombok not working with JDK 11 modules (Jigsaw) #1723
I'm using: Java 11 Lombok 1.18.4 (also tried 1.18.5 edge) Gradle 5.0 (also tried with 4.9) PS: I have requires static lombok in...
Read more >
Lombok Changelog
Issue #3053. BUGFIX: Combining @NonNullByDefault and lombok.addNullAnnotations would generate two @Nullable annotations and thus generate a compiler error.
Read more >
Re: [aspectj-users] Warning when using lombok's with aspectj
I haven't done much investigation work into the combination. If you do it in two steps you'd be fine (Lombok then binary weave)...
Read more >
Aspectj and Lombok mutually exclusive? - Google Groups
The workaround is to switch it to another operating mode, that is leaving the compiler alone and having Aspectj to work on the...
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