Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin randomly generates classes that don't compile #60

Open
mpiela opened this issue Jun 17, 2019 · 1 comment
Open

Plugin randomly generates classes that don't compile #60

mpiela opened this issue Jun 17, 2019 · 1 comment

Comments

@mpiela
Copy link

mpiela commented Jun 17, 2019

In some specific case the assertions generated by the plugin do not compile. This seems to happen randomly - I've prepared a simple example module (assertj-generator-bug.zip) that on my machine fails about 50% of the time.

$ unzip assertj-generator-bug.zip
$ cd assertj-generator-bug
$ mvn clean install

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.exampl:assertj-generator-bug >------------------
[INFO] Building assertj-generator-bug 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ assertj-generator-bug ---
[INFO] Deleting /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ assertj-generator-bug ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ assertj-generator-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/classes
[INFO] 
[INFO] --- assertj-assertions-generator-maven-plugin:2.2.0:generate-assertions (default) @ assertj-generator-bug ---
[INFO] JUnit not found in project classpath => JUnitSoftAssertions entry point class won't be generated.
[INFO] 

====================================
AssertJ assertions generation report
====================================

--- Generator input parameters ---

Generating AssertJ assertions for classes:
- com.example.SomeService

--- Generator results ---

Directory where custom assertions files have been generated:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions

Custom assertions files generated:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java

Assertions entry point class has been generated in file:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/Assertions.java

SoftAssertions entry point class has been generated in file:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SoftAssertions.java

[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ assertj-generator-bug ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/USERS/mpiela/devel/tmp/assertj-generator-bug/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ assertj-generator-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[37,38] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[57,69] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[80,42] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[100,73] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[124,46] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[145,77] cannot find symbol
  symbol:   class E
  location: class com.example.SomeServiceAssert
[INFO] 6 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.157 s
[INFO] Finished at: 2019-06-17T11:55:59+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project assertj-generator-bug: Compilation failure: Compilation failure: 
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[37,38] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[57,69] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[80,42] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[100,73] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[124,46] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[145,77] cannot find symbol
[ERROR]   symbol:   class E
[ERROR]   location: class com.example.SomeServiceAssert
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@joel-costigliola
Copy link
Member

Sorry about that, I unfortunately don't have the time to maintain this project :(
But I'm happy to take PR for fixing bugs (if it is not too much work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants