java:S1451 - False positives on package-info.java files

This example below results in a false positive for rule java:S1451. The violation disappears when the Javadoc is removed. Since the purpose of a package-info file is to:

  • Provide Javadoc comments describing the package’s purpose, usage, and contents.
  • Hold package-level annotations.
  • Include file-level comments (e.g., copyright, license).

The rule must change, not the code.

Regards,

Jim Kaib

/*
 * Copyright (c) 2025 Your Company Name. All Rights Reserved.
 * This software is the confidential and proprietary information of
 * Your Company Name ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it
 * only in accordance with the terms of the license agreement you entered
 * into with Your Company Name.
 */
/**
 * Provides classes for handling data within the application.
 */
package com.yourcompany.yourapp.data;

Hi @jkaibjr,

Thanks for reporting this issue. Unfortunately, I am unable to reproduce the issue.

Can you share in which product and version you are seeing the issue and which version of Java you are using in your project.

Thanks in advance,

Dorian