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

Incorrect formatting when a class has no package

    Details

      Description

      I want to format my class that has no package. But the formatter incorrectly changes the type I'm using in a declaration in Document_Add.java--the formatter removes the "." between the class and the inner class in this declaration:

      DocumentResource.Builder builder = DocumentResource.builder();

      Changing it to this:

      DocumentResourceBuilder builder = DocumentResource.builder();

      *Steps:*

      1. Unzip the attached liferay-g9i6.zip
      2. cd liferay-g9i6
      3. ./gradlew formatSource

      Result:

      $ ./gradlew formatSource
      Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

      > Task :formatSource
      Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
      Scanning for files...
      Initializing checks...
      /home/jhinkey/Desktop/liferay-g9i6/Document_Add.java (SourceCheck:JavaImportsCheck)
      Processing checks: 100% completed

      Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
      Use '--warning-mode all' to show the individual deprecation warnings.
      See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings

       Changed line:

      DocumentResourceBuilder builder = DocumentResource.builder(); 

      Notice that SF removed the "." between DocumentResource and Builder.

      Expected result: Leave the line as...

      DocumentResource.Builder builder = DocumentResource.builder();

      Workaround:* Suppress the JavaImportsCheck in the suppressions XML file.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brian.chan Brian Chan
              Reporter:
              james.hinkey James Hinkey
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
              Engineering Assignee:
              Alan Huang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                26 weeks ago

                  Packages

                  Version Package
                  7.0.0 DXP FP99
                  7.0.10.16 DXP SP16
                  7.0.X
                  7.1.10 DXP FP23
                  7.1.10.6 SP6
                  7.1.X
                  7.2.10 DXP FP12
                  7.2.X
                  7.3.7 CE GA8
                  7.3.10 DXP FP2
                  7.3.X
                  7.4.0 CE GA1 DXP 7,4
                  Master