DeLombok with Maven

62 views
Skip to first unread message

tackIT Easy

unread,
Apr 2, 2023, 5:03:49 AM4/2/23
to Project Lombok
Hello,

I'm using DeLombok with Maven to compile my classes.

But strangely I have an error I expect to be a bug.

Could someone confirm ?

Thanks

Original Java:

private static void executeCommand(@NonNull final String command, @NonNull final String filename, @NonNull String algorithm) {

try {

switch (command) {

case "create":

System.exit(new Checksum().createChecksumFile(filename, algorithm));

break;

case "validate":

System.exit(new Checksum().validateChecksum(filename, algorithm));

break;

default:

displayClassUsage();

System.exit(0);

}

} catch (final FileNotFoundException fne) {

log.error(FILE_NOT_FOUND, filename, fne);

System.exit(0);

} catch (final SecurityException se) {

log.error(NO_ACCESS_PERMISSION_TO_FILE, filename, se);

System.exit(0);

} catch (final IOException e) {

log.error(FILE_NOT_FOUND, filename, e);

System.exit(0);

} catch (final NoSuchAlgorithmException nsae) {

log.error(CHECKUM_ALGORITHM_NOT_AVAILABLE, algorithm, filename, nsae);

System.exit(0);

} catch (final Exception e) {

log.error(UNEXPECTED_CHECKUM_PROBLEM_WITH_FILE, filename, e);

System.exit(0);

}

}

DeLombok Java:
private static void executeCommand(@NonNull final String command, @NonNull final String filename, @NonNull String algorithm) {
if (command == null) {
throw new NullPointerException("command is marked non-null but is null");
}
if (filename == null) {
throw new NullPointerException("filename is marked non-null but is null");
}
if (algorithm == null) {
throw new NullPointerException("algorithm is marked non-null but is null");
}
try {
switch (command) {
default:
System.exit(new Checksum().createChecksumFile(filename, algorithm));
break;
default:
System.exit(new Checksum().validateChecksum(filename, algorithm));
break;
default:
displayClassUsage();
System.exit(0);
}
} catch (final FileNotFoundException fne) {
log.error(FILE_NOT_FOUND, filename, fne);
System.exit(0);
} catch (final SecurityException se) {
log.error(NO_ACCESS_PERMISSION_TO_FILE, filename, se);
System.exit(0);
} catch (final IOException e) {
log.error(FILE_NOT_FOUND, filename, e);
System.exit(0);
} catch (final NoSuchAlgorithmException nsae) {
log.error(CHECKUM_ALGORITHM_NOT_AVAILABLE, algorithm, filename, nsae);
System.exit(0);
} catch (final Exception e) {
log.error(UNEXPECTED_CHECKUM_PROBLEM_WITH_FILE, filename, e);
System.exit(0);
}
}

You see that there are 2x default in the switch command. This generate a compilation error.

Help highly appreciated.


Thanks



Dirk Steinkamp

unread,
May 21, 2023, 1:03:26 PM5/21/23
to Project Lombok
Did you open an issue for it on https://github.com/projectlombok/lombok/issues ? I think that would be a better place to keep track of it.
And please state the version you're using.
I found discussing issues on lombok's github page to be a good way of interaction that lead to progress.
Reply all
Reply to author
Forward
0 new messages