diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index 412a77417e..0e91edf6ac 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2024 The Project Lombok Authors.
+ * Copyright (C) 2013-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
@@ -906,7 +906,7 @@ public enum JavadocTag {
private Pattern pattern;
JavadocTag(String regexpFragment) {
- pattern = Pattern.compile("\\s?^[ \\t]*\\**[ \\t]*" + regexpFragment + "(\\S|\\s)*?(?=(\\s^\\s*\\**\\s*@|\\Z))", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
+ pattern = Pattern.compile("\\s?^[ \\t]*\\**[ \\t]*" + regexpFragment + ".*?(?=(\\s^\\s*\\**\\s*@|\\Z))", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
}
}
@@ -978,7 +978,7 @@ public static String addJavadocLine(String in, String line) {
public static String getParamJavadoc(String methodComment, String param) {
if (methodComment == null || methodComment.isEmpty()) return methodComment;
- Pattern pattern = Pattern.compile("@param " + param + " (\\S|\\s)+?(?=^ ?@|\\z)", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
+ Pattern pattern = Pattern.compile("@param " + param + " .+?(?=^ ?@|\\z)", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
Matcher matcher = pattern.matcher(methodComment);
if (matcher.find()) {
return matcher.group();
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 4fc948a680..94b057795e 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2024 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
@@ -2799,8 +2799,8 @@ public static Annotation[][] getRecordFieldAnnotations(TypeDeclaration typeDecla
return annotations;
}
- private static final Pattern JAVADOC_PATTERN = Pattern.compile("^\\s*\\/\\*\\*((?:\\S|\\s)*?)\\*\\/", Pattern.MULTILINE);
- private static final Pattern LEADING_ASTERISKS_PATTERN = Pattern.compile("(?m)^\\s*\\* ?");
+ private static final Pattern JAVADOC_PATTERN = Pattern.compile("^\\s*\\/\\*\\*(.*?)\\*\\/", Pattern.MULTILINE | Pattern.DOTALL);
+ private static final Pattern LEADING_ASTERISKS_PATTERN = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE);
public static String getDocComment(EclipseNode eclipseNode) {
if (eclipseNode.getAst().getSource() == null) return null;
diff --git a/test/transform/resource/after-delombok/GetterSetterJavadoc.java b/test/transform/resource/after-delombok/GetterSetterJavadoc.java
index 76afbd2d66..f1bb0324a6 100644
--- a/test/transform/resource/after-delombok/GetterSetterJavadoc.java
+++ b/test/transform/resource/after-delombok/GetterSetterJavadoc.java
@@ -163,3 +163,207 @@ public GetterSetterJavadoc5 fieldName(final int fieldName) {
return this;
}
}
+class GetterSetterJavadocLong {
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ *
The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ */
+ private String userId;
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public GetterSetterJavadocLong() {
+ }
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ * The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ */
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public String getUserId() {
+ return this.userId;
+ }
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ * The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ *
+ * @param userId the unique identifier assigned to a user. This value must be non-null
+ * and conform to the format defined by the system. Passing a null or
+ * invalid ID may result in an {@link IllegalArgumentException} or
+ * similar error.
+ * @param databaseConnection the connection to the database used for retrieving or
+ * persisting the user ID. This parameter is required for
+ * database-related operations and must be properly closed
+ * after use to prevent resource leaks.
+ * @param userRole the role associated with the user (e.g., "admin", "user", "guest").
+ * This parameter may influence access control and permissions
+ * granted to the user within the system.
+ */
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public void setUserId(final String userId) {
+ this.userId = userId;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof GetterSetterJavadocLong)) return false;
+ final GetterSetterJavadocLong other = (GetterSetterJavadocLong) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ final java.lang.Object this$userId = this.getUserId();
+ final java.lang.Object other$userId = other.getUserId();
+ if (this$userId == null ? other$userId != null : !this$userId.equals(other$userId)) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof GetterSetterJavadocLong;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $userId = this.getUserId();
+ result = result * PRIME + ($userId == null ? 43 : $userId.hashCode());
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ @lombok.Generated
+ public java.lang.String toString() {
+ return "GetterSetterJavadocLong(userId=" + this.getUserId() + ")";
+ }
+}
diff --git a/test/transform/resource/after-ecj/GetterSetterJavadoc.java b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
index 03ac4075ff..89b6af5add 100644
--- a/test/transform/resource/after-ecj/GetterSetterJavadoc.java
+++ b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
@@ -132,3 +132,148 @@ class GetterSetterJavadoc3 {
return this;
}
}
+@lombok.Data class GetterSetterJavadocLong {
+ private String userId;
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ * The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ */
+ public @java.lang.SuppressWarnings("all") @lombok.Generated String getUserId() {
+ return this.userId;
+ }
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ * The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ *
+ * @param userId the unique identifier assigned to a user. This value must be non-null
+ * and conform to the format defined by the system. Passing a null or
+ * invalid ID may result in an {@link IllegalArgumentException} or
+ * similar error.
+ * @param databaseConnection the connection to the database used for retrieving or
+ * persisting the user ID. This parameter is required for
+ * database-related operations and must be properly closed
+ * after use to prevent resource leaks.
+ * @param userRole the role associated with the user (e.g., "admin", "user", "guest").
+ * This parameter may influence access control and permissions
+ * granted to the user within the system.
+ */
+ public @java.lang.SuppressWarnings("all") @lombok.Generated void setUserId(final String userId) {
+ this.userId = userId;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof GetterSetterJavadocLong)))
+ return false;
+ final GetterSetterJavadocLong other = (GetterSetterJavadocLong) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ final java.lang.Object this$userId = this.getUserId();
+ final java.lang.Object other$userId = other.getUserId();
+ if (((this$userId == null) ? (other$userId != null) : (! this$userId.equals(other$userId))))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") @lombok.Generated boolean canEqual(final java.lang.Object other) {
+ return (other instanceof GetterSetterJavadocLong);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $userId = this.getUserId();
+ result = ((result * PRIME) + (($userId == null) ? 43 : $userId.hashCode()));
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated java.lang.String toString() {
+ return (("GetterSetterJavadocLong(userId=" + this.getUserId()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") @lombok.Generated GetterSetterJavadocLong() {
+ super();
+ }
+}
\ No newline at end of file
diff --git a/test/transform/resource/before/GetterSetterJavadoc.java b/test/transform/resource/before/GetterSetterJavadoc.java
index 2ad46f8d45..b14f2c024b 100644
--- a/test/transform/resource/before/GetterSetterJavadoc.java
+++ b/test/transform/resource/before/GetterSetterJavadoc.java
@@ -62,3 +62,67 @@ class GetterSetterJavadoc5 {
*/
@lombok.Getter @lombok.Setter private int fieldName;
}
+
+@lombok.Data
+class GetterSetterJavadocLong {
+ /**
+ * This field represents the unique identifier for a user in the system. It is used
+ * throughout the application to uniquely identify and retrieve user-related data.
+ * The ID is typically generated by the database and is guaranteed to be unique
+ * within the context of the system.
+ *
+ * The ID is an integral part of various operations, including but not limited to:
+ *
+ * - Authenticating users during login processes.
+ * - Associating user-specific preferences and settings.
+ * - Tracking user activity and logs for auditing purposes.
+ * - Facilitating relationships between users and other entities such as orders,
+ * messages, or roles within the system.
+ *
+ *
+ * Key characteristics of the {@code userId} field:
+ *
+ * - Immutability: Once assigned, the ID must not be modified to
+ * ensure data integrity.
+ * - Security: Access to this field should be controlled to prevent
+ * unauthorized modifications or data leakage.
+ * - Uniqueness: The ID must be unique within the system. For
+ * distributed systems, consider using GUIDs or UUIDs to avoid collisions.
+ *
+ *
+ * Example usage:
+ *
+ * User user = userService.getUserById(userId);
+ * if (user != null) {
+ * System.out.println("User found: " + user.getName());
+ * } else {
+ * System.out.println("User not found.");
+ * }
+ *
+ *
+ * Developers should ensure that the ID complies with constraints imposed by the
+ * database schema, such as length and format restrictions. Furthermore, it is
+ * recommended to validate the ID before persisting or using it in critical operations.
+ *
+ *
For methods or constructors that accept the {@code userId} as a parameter, the
+ * following guidelines should be followed:
+ *
+ * - Validate the format of the ID to ensure it adheres to system requirements.
+ * - Handle null or empty values gracefully, providing appropriate error messages
+ * or default behavior where necessary.
+ *
+ *
+ * @param userId the unique identifier assigned to a user. This value must be non-null
+ * and conform to the format defined by the system. Passing a null or
+ * invalid ID may result in an {@link IllegalArgumentException} or
+ * similar error.
+ * @param databaseConnection the connection to the database used for retrieving or
+ * persisting the user ID. This parameter is required for
+ * database-related operations and must be properly closed
+ * after use to prevent resource leaks.
+ * @param userRole the role associated with the user (e.g., "admin", "user", "guest").
+ * This parameter may influence access control and permissions
+ * granted to the user within the system.
+ */
+ private String userId;
+}