diff --git a/src/core/lombok/AccessLevel.java b/src/core/lombok/AccessLevel.java index 9c138e53..86722229 100644 --- a/src/core/lombok/AccessLevel.java +++ b/src/core/lombok/AccessLevel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 The Project Lombok Authors. + * Copyright (C) 2009-2025 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,7 +25,24 @@ package lombok; * Represents an AccessLevel. Used e.g. to specify the access level for generated methods and fields. */ public enum AccessLevel { - PUBLIC, MODULE, PROTECTED, PACKAGE, PRIVATE, + /** Represents the {@code public} access level. */ + PUBLIC, + + /** + * Acts exactly like {@code PACKAGE} - the package private access level. + * @deprecated This value was created at a time when a module-level access keyword was planned as a way of being prepared for the future. But that's not the direction java went in; a 'module access level' is not likely to ever exist. This enum acts like {@code PACKAGE} in every way. + */ + @Deprecated MODULE, + + /** Represents the {@code protected} access level (any code in the same package as well as any subtype). */ + PROTECTED, + + /** Represents the default access level: package private. (any code in the same package). */ + PACKAGE, + + /** Represents the {@code private} access level. */ + PRIVATE, + /** Represents not generating anything or the complete lack of a method. */ NONE; } diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index c45d95a1..7eaaf7b6 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1393,6 +1393,7 @@ public class EclipseHandlerUtil { /** * Turns an {@code AccessLevel} instance into the flag bit used by eclipse. */ + @SuppressWarnings("deprecation") // We have to use MODULE here to make it act according to spec, which is to treat it like `PACKAGE`. public static int toEclipseModifier(AccessLevel value) { switch (value) { case MODULE: diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index f243c56a..0c075295 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -997,6 +997,7 @@ public class JavacHandlerUtil { /** * Turns an {@code AccessLevel} instance into the flag bit used by javac. */ + @SuppressWarnings("deprecation") // We have to use MODULE here to make it act according to spec, which is to treat it like `PACKAGE`. public static int toJavacModifier(AccessLevel accessLevel) { switch (accessLevel) { case MODULE: