Grundlefleck / autovalue-example

Trying out Google's AutoValue library https://github.com/google/auto
Apache License 2.0
6 stars 1 forks source link

not sure what's wrong here... #1

Open jnorthrup opened 9 years ago

jnorthrup commented 9 years ago

I have been scratching my head all morning as to why some autovalue code stopped working and wanted to test a sample project.. your number came up.

jim@keyframe:~$ cd work jim@keyframe:~/work$ git clone git@github.com:Grundlefleck/autovalue-example.git Cloning into 'autovalue-example'... remote: Counting objects: 127, done. remote: Total 127 (delta 0), reused 0 (delta 0) Receiving objects: 100% (127/127), 19.91 KiB | 0 bytes/s, done. Resolving deltas: 100% (45/45), done. Checking connectivity... done. jim@keyframe:~/work$ cd autovalue-example/ jim@keyframe:~/work/autovalue-example$ java -version java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode) jim@keyframe:~/work/autovalue-example$ mvn -version Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00) Maven home: /opt/maven Java version: 1.8.0_31, vendor: Oracle Corporation Java home: /vol/big240/opt/jdk1.8.0_31/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.13.0-45-generic", arch: "amd64", family: "unix" jim@keyframe:~/work/autovalue-example$ mvn clean install [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building autovalue-example 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: http://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.pom Downloaded: http://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.pom (2 KB at 9.4 KB/sec) Downloading: http://repo.maven.apache.org/maven2/com/google/guava/guava/16.0.1/guava-16.0.1.pom Downloaded: http://repo.maven.apache.org/maven2/com/google/guava/guava/16.0.1/guava-16.0.1.pom (6 KB at 152.8 KB/sec) Downloading: http://repo.maven.apache.org/maven2/com/google/guava/guava-parent/16.0.1/guava-parent-16.0.1.pom Downloaded: http://repo.maven.apache.org/maven2/com/google/guava/guava-parent/16.0.1/guava-parent-16.0.1.pom (8 KB at 137.8 KB/sec) Downloading: http://repo.maven.apache.org/maven2/org/mutabilitydetector/MutabilityDetector/0.9.2/MutabilityDetector-0.9.2.pom Downloaded: http://repo.maven.apache.org/maven2/org/mutabilitydetector/MutabilityDetector/0.9.2/MutabilityDetector-0.9.2.pom (9 KB at 44.7 KB/sec) Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.2/hamcrest-core-1.2.pom Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.2/hamcrest-core-1.2.pom (4 KB at 83.0 KB/sec) Downloading: http://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar Downloading: http://repo.maven.apache.org/maven2/com/google/guava/guava/16.0.1/guava-16.0.1.jar Downloading: http://repo.maven.apache.org/maven2/org/mutabilitydetector/MutabilityDetector/0.9.2/MutabilityDetector-0.9.2.jar Downloaded: http://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar (33 KB at 512.0 KB/sec) Downloaded: http://repo.maven.apache.org/maven2/com/google/guava/guava/16.0.1/guava-16.0.1.jar (2176 KB at 7157.2 KB/sec) Downloaded: http://repo.maven.apache.org/maven2/org/mutabilitydetector/MutabilityDetector/0.9.2/MutabilityDetector-0.9.2.jar (1811 KB at 1641.6 KB/sec) [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ autovalue-example --- [INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ autovalue-example --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /vol/big240/snap/jim/work/autovalue-example/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ autovalue-example --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to /vol/big240/snap/jim/work/autovalue-example/target/classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ autovalue-example --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /vol/big240/snap/jim/work/autovalue-example/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ autovalue-example --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /vol/big240/snap/jim/work/autovalue-example/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ autovalue-example --- [INFO] Surefire report directory: /vol/big240/snap/jim/work/autovalue-example/target/surefire-reports


T E S T S

Running com.github.grundlefleck.CarTest Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.172 sec <<< FAILURE! isImmutable(com.github.grundlefleck.CarTest) Time elapsed: 0.153 sec <<< FAILURE! org.mutabilitydetector.unittesting.MutabilityAssertionError: Expected: com.github.grundlefleck.AutoValue_Car to be IMMUTABLE but: com.github.grundlefleck.AutoValue_Car is actually NOT_IMMUTABLE Reasons: Field can have an abstract type (com.github.grundlefleck.Registration) assigned to it. [Field: registration, Class: com.github.grundlefleck.AutoValue_Car] Allowed reasons: None. at org.mutabilitydetector.unittesting.internal.AssertionReporter.assertThat(AssertionReporter.java:43) at org.mutabilitydetector.unittesting.MutabilityAsserter.assertImmutable(MutabilityAsserter.java:102) at org.mutabilitydetector.unittesting.MutabilityAssert.assertImmutable(MutabilityAssert.java:629) at com.github.grundlefleck.CarTest.isImmutable(CarTest.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Results :

Failed tests: isImmutable(com.github.grundlefleck.CarTest): (..)

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.945 s [INFO] Finished at: 2015-02-06T12:31:33-08:00 [INFO] Final Memory: 17M/208M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project autovalue-example: There are test failures. [ERROR] [ERROR] Please refer to /vol/big240/snap/jim/work/autovalue-example/target/surefire-reports for the individual test results. [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 jim@keyframe:~/work/autovalue-example$

Grundlefleck commented 9 years ago

I've just pushed a change to fix that test. There was nothing wrong with the usage auto-value, the test had a bad assertion. Should compile and test successfully now.

Out of curiousity, what issues are you seeing with auto-value?

jnorthrup commented 9 years ago

i had a few hours where nothing worked. then i came back to it after some distractions and it worked as before. maybe a maven mirror hiccup or something coincided with purely coincidental upgrade of jdk8 and maven revisions I absently performed the night before. also discovered that some amount of groovy maven accomodations will change the default target/generated-sources location to something that intellij doesn't assume. its not hard to keep the two languages seperate though so no showstoppers.