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

"error: variable foo is already defined in method accept" compile error is produced in case service builder entity name matches with a column name



      Important information: Service Builder solution won't be available in Liferay Workspace until a new version of it will be released.

      You can manually apply latest available Service Builder module version with following steps:

      1. Go to https://mvnrepository.com/artifact/com.liferay/com.liferay.portal.tools.service.builder and take last released version number. For example, today last released version is: 1.0.309
      2. Go to Liferay Workspace root folder
      3. Add following line to gradle.properties file:

        (replace 1.0.309 with version number obtained from maven central page)

      Steps to reproduce

      1. Create a Liferay Workspace for Liferay 7.1 or 7.0 with a service builder project, for example with blade:
        • blade init -v 7.1
        • blade create test -t service-builder
      2. Note: in order to test LPS solution, follow the steps explained above to edit gradle.properties file, so latest service builder version is applied to Liferay workspace
      3. Configure a service builder entity with following service.xml
        <service-builder  package-path="test">
        	<entity local-service="true" name="Foo" remote-service="true" uuid="true">
        		<column name="id" primary="true" type="long" />
        		<column name="foo" type="long" />
      4. Execute gradlew buildService
      5. Execute gradlew deploy
        • Expected behavior: generated code is compiled successfully
        • Wrong behavior: following compile error is produced
          > Task :modules:test:test-service:compileJava FAILED
          C:\Temp\ServiceBuilder\modules\test\test-service\src\main\java\test\model\impl\FooModelImpl.java:338: error: variable foo is already defined in method accept
                                          public void accept(Foo foo, Object foo) {
          C:\Temp\ServiceBuilder\modules\test\test-service\src\main\java\test\model\impl\FooModelImpl.java:339: error: cannot find symbol
            symbol:   method setFoo(Long)
            location: variable foo of type Object
          Note: Some input files use unchecked or unsafe operations.
          Note: Recompile with -Xlint:unchecked for details.
          2 errors
          FAILURE: Build failed with an exception.
          * What went wrong:
          Execution failed for task ':modules:test:test-service:compileJava'.
          > Compilation failed; see the compiler error output for details.


          Issue Links



              • Assignee:
                summer.zhang Summer Zhang
                jorge.diaz Jorge Diaz
                Participants of an Issue:
                Recent user:
                Jason Pince
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created:
                  Days since last comment:
                  42 weeks, 3 days ago


                  Version Package
                  7.2.1 CE GA2