Skip to content

Fix existing cases of getFileContents() usage #11166

@romani

Description

@romani

after #9889

We need to fix all existing cases of getFileContents() usage by usage on AST based logic.

/**
* Returns the file contents associated with the tree.
*
* @return the file contents
* @deprecated
* Usage of this method is no longer accepted.
* Please use AST based methods instead.
* @noinspection WeakerAccess
* @noinspectionreason WeakerAccess - we avoid 'protected' when possible
*/
@Deprecated(since = "9.3")
public final FileContents getFileContents() {

The same is true for methods getLine and getLines that do allow to have access to not AST content.

Suppression

<!-- these are legacy use cases until #11166 -->

cases:

  • MissingOverrideCheck.java
  • PackageAnnotationCheck.java
  • AvoidEscapedUnicodeCharactersCheck.java
  • FallThroughCheck.java
  • PackageDeclarationCheck.java
  • ImportControlCheck.java
  • UnusedImportsCheck.java
  • MissingJavadocPackageCheck.java
  • OuterTypeFilenameCheck.java
  • RegexpCheck.java (not applicable as it is operates on text file, not java files, by design)
  • RegexpSinglelineJavaCheck.java (this is by design match to raw string, same a RegexpCheck)
  • MethodLengthCheck.java
  • EmptyLineSeparatorCheck.java
  • JavadocMetadataScraper.java

it is better to resolve each case in separate PR. Each PR should remove the suppression to show the issue is fixed. haanhvu@1439170#diff-c1ffc75b7152435a4d5d40d7ee9b32b57402959b1ad471a41e753ea67554378b

For javadoc Check please see other issues, each Check in separate issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions