[deprecation] Marked AccessLevel.MODULE as deprecated. It was written for a future that never came to pass, and should never be used.

This commit is contained in:
Reinier Zwitserloot committed 2025-09-17 22:35:07 +02:00
1 parent 492011df4f
commit a6d556856c
3 files changed
+21 -2

No files matched your search

+19 -2
View File
@@ -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;
}
@@ -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:
@@ -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: