Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Lombok 1.18.8 changes the exception message for @NonNull #2122

Closed
robwettach opened this issue May 8, 2019 · 2 comments
Closed

[BUG] Lombok 1.18.8 changes the exception message for @NonNull #2122

robwettach opened this issue May 8, 2019 · 2 comments
Labels
accepted The issue/enhancement is valid, sensible, and explained in sufficient detail

Comments

@robwettach
Copy link

robwettach commented May 8, 2019

Describe the bug
In Lombok 1.18.6 and earlier, the error message produced by the @NonNull annotation was "${fieldName} is marked @NonNull but is null" (previous), but was recently changed to "${fieldName} is marked non-null but is null" (current).

To Reproduce
Steps to reproduce the behavior, preferably in the form of the smallest java source file you can make that will show the problem when compiled with javac -cp lombok.jar ExampleFile.java or as sole java file in a fresh new eclipse project.

import lombok.NonNull;

public class ExampleFile {
    public static void example(@NonNull String field) {

    }

    public static void main(String[] args) {
        try {
            example(null);
        } catch (NullPointerException e) {
            if (!e.getMessage().equals("field is marked @NonNull but is null")) {
                throw new AssertionError("Lombok exception message changed");
            }
        }
    }
}

Expected behavior
I expect the exception message to be stable across releases unless called out as a (Improbable) Breaking Change in the release notes.

Version info (please complete the following information):

  • Lombok version: 1.18.8
  • Platform: javac 1.8.0_202

Additional context
This causes unit tests that assert the exception message content to fail.

@rzwitserloot
Copy link
Collaborator

Pff, not sure it's a good idea to test the content of exception traces, but, touché I guess.

This might be a first, but, discussed it with @rspilker and we'll retroactively update the changelog.

For some context for the change: Turns out not every annotation that marks a parameter as 'null not allowed' is specifically called @NonNull which is why we slightly changed the message.

@rzwitserloot rzwitserloot added accepted The issue/enhancement is valid, sensible, and explained in sufficient detail soon labels May 9, 2019
@rzwitserloot
Copy link
Collaborator

Okay, the site's been updated: https://projectlombok.org/changelog

I'm afraid we can't retroactively change lombok.jar on maven and such (and therefore won't change it on our site either; let's not introduce 2 binarily different lombok jars both tagged with the same stable release version number).

But it will be in changelogs in lombok.jars released from today onwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The issue/enhancement is valid, sensible, and explained in sufficient detail
Projects
None yet
Development

No branches or pull requests

2 participants