slawekjaranowski commented on code in PR #2275: URL: https://github.com/apache/maven/pull/2275#discussion_r2059893883
########## maven-core/src/main/java/org/apache/maven/project/MavenProject.java: ########## @@ -1120,6 +1188,185 @@ private static String getProjectReferenceId(String groupId, String artifactId, S return buffer.toString(); } + /** + * A List implementation that logs warnings when modified directly instead of using the proper add/remove methods. + * This is a wrapper that delegates all operations to the underlying list, so modifications to this list + * will affect the original list. + * + * @param <E> the type of elements in the list + * @since 3.9.10 + */ + private static class LoggingList<E> extends AbstractList<E> { + private static final String DISABLE_WARNINGS_PROPERTY = "maven.project.sourceRoots.warningsDisabled"; + private final List<E> delegate; + private final String collectionName; + + LoggingList(List<E> delegate, String collectionName) { + this.delegate = delegate; + this.collectionName = collectionName; + } + + private void logWarning(String method) { + // Check if warnings are disabled + if (Boolean.getBoolean(DISABLE_WARNINGS_PROPERTY)) { Review Comment: Can we also check project properties here? When we only check system properties - users will can only set it on cli ... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org