Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-131887

JavaClassNameCheck duplicates imports if the class is in default the package

    Details

    • Type: Bug
    • Status: In Review
    • Resolution: Unresolved
    • Affects Version/s: 7.4.0 CE GA1
    • Fix Version/s: None
    • Labels:
      None

      Description

      The Java class in the attached project is in the default package (it has not package declaration). When I run the JavaClassNameCheck Source Formatter check, the class's import list is duplicated.

      Steps

      1. Unzip the attached project
      2. cd project-uses-default-package/
      3. Run
        ./gradlew formatSource

      Output:

      > Task :formatSource
      Scanning for files...
      Initializing checks...
      /home/jhinkey/projects/project-uses-default-java-package/source-formatter-suppressions.xml (SourceCheck:XMLIndentationCheck)
      /home/jhinkey/projects/project-uses-default-java-package/java/DocumentFolder_DELETE_ById.java (JavaParser)
      /home/jhinkey/projects/project-uses-default-java-package/java/DocumentFolder_DELETE_ById.java (SourceCheck:JavaClassNameCheck)
      Processing checks: 7% completed
      

      Actual result:
      The class's import list is duplicated...

      import com.liferay.headless.delivery.client.resource.v1_0.DocumentResource;
      
      import com.liferay.headless.delivery.client.resource.v1_0.DocumentResource;
      
      public class Document_DELETE_ById {
      ...
      

      Expected result:

      The class's source is formatted and its import list is untouched.

        Attachments

          Activity

            People

            Assignee:
            michael.saechang Michael Saechang
            Reporter:
            james.hinkey James Hinkey (Inactive)
            Participants of an Issue:
            Recent user:
            Daniel Lee
            Engineering Assignee:
            Alan Huang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              35 weeks, 1 day ago

                Packages

                Version Package