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

java.lang.AssertionError: assertion failed: Modified names for XXX is empty #4185

Closed
jebbench opened this issue Jan 16, 2017 · 11 comments · Fixed by #4729
Closed

java.lang.AssertionError: assertion failed: Modified names for XXX is empty #4185

jebbench opened this issue Jan 16, 2017 · 11 comments · Fixed by #4729
Labels

Comments

@jebbench
Copy link
Contributor

Pants 1.3.0.dev3

When compiling Java classes after adding hashcode and equals methods we get the error:

11:40:05 00:00         [zinc]
                       java.lang.AssertionError: assertion failed: Modified names for work.faber.attributes.Attribute is empty
                       	at scala.Predef$.assert(Predef.scala:179)
                       	at __shaded_by_pants__.sbt.internal.inc.NamesChange.<init>(Changes.scala:31)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalNameHashing.sameAPI(IncrementalNameHashing.scala:35)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.sameClass(IncrementalCommon.scala:158)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:140)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:139)
                       	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       	at scala.collection.immutable.Set$Set2.foreach(Set.scala:94)
                       	at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
                       	at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.changedIncremental(IncrementalCommon.scala:139)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:47)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:78)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:77)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:122)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$.compile(Incremental.scala:77)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:60)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:132)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.incrementalCompile(IncrementalCompilerImpl.scala:87)
                       	at org.pantsbuild.zinc.Compiler.compile(Compiler.scala:203)
                       	at org.pantsbuild.zinc.Main$.run(Main.scala:97)
                       	at org.pantsbuild.zinc.Main$.main(Main.scala:16)
                       	at org.pantsbuild.zinc.Main.main(Main.scala)
                       	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
                       	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                       	at java.lang.reflect.Method.invoke(Method.java:498)
                       	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
                       [info] Compiling 1 Java source to /home/jbench/Code/faber-mono/.pants.d/compile/zinc/66ac1c9326be/services.crud.attributes.attributes/current/classes...
                       [info] CAL10NAnnotationProcessor 0.8.1 initialized
                       [warn] Supported source version 'RELEASE_5' from annotation processor 'ch.qos.cal10n.verifier.processor.CAL10NAnnotationProcessor' less than -source '1.8'
                       [error] ## Exception when compiling /home/jbench/Code/faber-mono/services/crud/attributes/work/faber/attributes/Attribute.java and others...
                       [error] assertion failed: Modified names for work.faber.attributes.Attribute is empty
                       [error] scala.Predef$.assert(Predef.scala:179)
                       [error] __shaded_by_pants__.sbt.internal.inc.NamesChange.<init>(Changes.scala:31)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalNameHashing.sameAPI(IncrementalNameHashing.scala:35)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.sameClass(IncrementalCommon.scala:158)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:140)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:139)
                       [error] scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       [error] scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       [error] scala.collection.immutable.Set$Set2.foreach(Set.scala:94)
                       [error] scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
                       [error] scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.changedIncremental(IncrementalCommon.scala:139)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:47)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:78)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:77)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:122)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$.compile(Incremental.scala:77)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:60)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:132)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.incrementalCompile(IncrementalCompilerImpl.scala:87)
                       [error] org.pantsbuild.zinc.Compiler.compile(Compiler.scala:203)
                       [error] org.pantsbuild.zinc.Main$.run(Main.scala:97)
                       [error] org.pantsbuild.zinc.Main$.main(Main.scala:16)
                       [error] org.pantsbuild.zinc.Main.main(Main.scala)
                       [error] sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
                       [error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                       [error] java.lang.reflect.Method.invoke(Method.java:498)
                       [error] com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
                       [error]          
                       
                   compile(services/crud/attributes:attributes) failed: Zinc compile failed.
FAILURE: Compilation failure: Failed jobs: compile(services/crud/attributes:attributes)

To reproduce:

  1. Create a java class which inherits the default equals and hashcode methods.
  2. Compile it.
  3. Add custom equals and hashcode methods.
  4. Compile it again.
@jebbench
Copy link
Contributor Author

jebbench commented Jan 16, 2017

I've not been able to replicate this using a simple project.
Upgrading to 1.3.0.dev7 doesn't resolve.
Removing the equals and hashcode methods triggers the same issue.
Modifying the equals or hashcode methods doesn't seem to trigger this issue.

@stuhood
Copy link
Member

stuhood commented Jan 17, 2017

@jebbench : Interesting. It might be worth reporting this issue upstream at https://github.com/sbt/zinc . According to https://github.com/pantsbuild/pants/blob/release_1.3.0.dev6/3rdparty/jvm/org/scala-sbt/BUILD 1.3.0.dev6 uses 1.0.0-X5 of zinc.

@jvican
Copy link

jvican commented Feb 21, 2017

Interesting, this is coming from sbt/sbt#2490. Will fix soon. I think Grzgorz didn't think about Java APIs while enforcing the contract between name hashes and API changes.

@stuhood
Copy link
Member

stuhood commented Oct 4, 2017

Relates to #4477

@stuhood
Copy link
Member

stuhood commented May 8, 2018

...and thus to #4729.

stuhood pushed a commit that referenced this issue May 11, 2018
### Problem

(this change depends on #4728)

As described on #4728, we currently need internal knowledge of zinc analysis in order to make it portable, and to extract products that are used by other tasks. Since the zinc analysis format is changing significantly (moving to protobuf, gaining/losing fields, etc), we need to stop parsing it. 

### Solution

Incorporates the version of the zinc wrapper published in #4728, and uses it in a `analysis.zinc` task to generate the `product_deps_by_src` and `classes_by_source` products from a `zinc_analysis` product published by zinc.

Expands the extracted `Zinc` subsystem from #4720 to encapsulate compile dependency calculation, and expose the `FingerprintStrategy` and `DependencyContext` that `compile.zinc` was using.

### Result

Zinc analysis is now a black box from the perspective of the pants python code. Also, the `compile.jvm-dep-check` task moved to the `lint` goal, and gained the unused dependency checks that used to be inlined in `compile.zinc` (and which would have prevented separation of the analysis extraction task).

Fixes #4477, fixes #4513, fixes #4185, fixes #5444, and hopefully fixes a few other odd incremental compilation bugs.
stuhood pushed a commit that referenced this issue May 11, 2018
### Problem

(this change depends on #4728)

As described on #4728, we currently need internal knowledge of zinc analysis in order to make it portable, and to extract products that are used by other tasks. Since the zinc analysis format is changing significantly (moving to protobuf, gaining/losing fields, etc), we need to stop parsing it. 

### Solution

Incorporates the version of the zinc wrapper published in #4728, and uses it in a `analysis.zinc` task to generate the `product_deps_by_src` and `classes_by_source` products from a `zinc_analysis` product published by zinc.

Expands the extracted `Zinc` subsystem from #4720 to encapsulate compile dependency calculation, and expose the `FingerprintStrategy` and `DependencyContext` that `compile.zinc` was using.

### Result

Zinc analysis is now a black box from the perspective of the pants python code. Also, the `compile.jvm-dep-check` task moved to the `lint` goal, and gained the unused dependency checks that used to be inlined in `compile.zinc` (and which would have prevented separation of the analysis extraction task).

Fixes #4477, fixes #4513, fixes #4185, fixes #5444, and hopefully fixes a few other odd incremental compilation bugs.
stuhood pushed a commit that referenced this issue May 11, 2018
### Problem

(this change depends on #4728)

As described on #4728, we currently need internal knowledge of zinc analysis in order to make it portable, and to extract products that are used by other tasks. Since the zinc analysis format is changing significantly (moving to protobuf, gaining/losing fields, etc), we need to stop parsing it. 

### Solution

Incorporates the version of the zinc wrapper published in #4728, and uses it in a `analysis.zinc` task to generate the `product_deps_by_src` and `classes_by_source` products from a `zinc_analysis` product published by zinc.

Expands the extracted `Zinc` subsystem from #4720 to encapsulate compile dependency calculation, and expose the `FingerprintStrategy` and `DependencyContext` that `compile.zinc` was using.

### Result

Zinc analysis is now a black box from the perspective of the pants python code. Also, the `compile.jvm-dep-check` task moved to the `lint` goal, and gained the unused dependency checks that used to be inlined in `compile.zinc` (and which would have prevented separation of the analysis extraction task).

Fixes #4477, fixes #4513, fixes #4185, fixes #5444, and hopefully fixes a few other odd incremental compilation bugs.
@youngderekm
Copy link

I still get this with pants 1.7.0rc0. Others here have reported this as well. If I compile again the problem goes away. I don't know how to reproduce it.

14:35:09 00:20         [zinc]
                       
14:35:09 00:20         [zinc]
                       [info] Compiling 38 Java sources to /Users/dyoung/r9/r9git/.pants.d/compile/zinc/e310046339ad/padlock-client.java.com.r9.padlock.client.ipcaptcha.ipcaptcha/current/classes...
                       [info] Compiling 1 Java source to /Users/dyoung/r9/r9git/.pants.d/compile/zinc/e310046339ad/padlock.java.com.r9.padlock.dao.dao/current/classes...
                       [error] ## Exception when compiling /Users/dyoung/r9/r9git/padlock/java/com/r9/padlock/dao/AerospikeMcValue.java and others...
                       [error] assertion failed: Modified names for com.r9.padlock.dao.MetaCookieMap is empty
                       [error] scala.Predef$.assert(Predef.scala:179)
                       [error] __shaded_by_pants__.sbt.internal.inc.NamesChange.<init>(Changes.scala:31)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalNameHashing.sameAPI(IncrementalNameHashing.scala:35)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.sameClass(IncrementalCommon.scala:158)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:140)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:139)
                       [error] scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       [error] scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       [error] scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
                       [error] scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
                       [error] scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.changedIncremental(IncrementalCommon.scala:139)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:47)java.lang.AssertionError: assertion failed: Modified names for com.r9.padlock.dao.MetaCookieMap is empty
                       	at scala.Predef$.assert(Predef.scala:179)
                       	at __shaded_by_pants__.sbt.internal.inc.NamesChange.<init>(Changes.scala:31)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalNameHashing.sameAPI(IncrementalNameHashing.scala:35)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.sameClass(IncrementalCommon.scala:158)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:140)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon$$anonfun$7.apply(IncrementalCommon.scala:139)
                       	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
                       	at scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
                       	at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
                       	at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.changedIncremental(IncrementalCommon.scala:139)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:47)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:78)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:77)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:122)
                       	at __shaded_by_pants__.sbt.internal.inc.Incremental$.compile(Incremental.scala:77)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:60)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:132)
                       	at __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.incrementalCompile(IncrementalCompilerImpl.scala:87)
                       	at org.pantsbuild.zinc.Compiler.compile(Compiler.scala:203)
                       	at org.pantsbuild.zinc.Main$.run(Main.scala:97)
                       	at org.pantsbuild.zinc.Main$.main(Main.scala:16)
                       	at org.pantsbuild.zinc.Main.main(Main.scala)
                       	at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
                       	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                       	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
                       	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
                       
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:78)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$$anonfun$1.apply(Incremental.scala:77)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:122)
                       [error] __shaded_by_pants__.sbt.internal.inc.Incremental$.compile(Incremental.scala:77)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:60)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:132)
                       [error] __shaded_by_pants__.sbt.internal.inc.IncrementalCompilerImpl.incrementalCompile(IncrementalCompilerImpl.scala:87)
                       [error] org.pantsbuild.zinc.Compiler.compile(Compiler.scala:203)
                       [error] org.pantsbuild.zinc.Main$.run(Main.scala:97)
                       [error] org.pantsbuild.zinc.Main$.main(Main.scala:16)
                       [error] org.pantsbuild.zinc.Main.main(Main.scala)
                       [error] jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
                       [error] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                       [error] java.base/java.lang.reflect.Method.invoke(Method.java:564)
                       [error] com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
                       [error]          
                       
                   compile(padlock/java/com/r9/padlock/dao:dao) failed: Zinc compile failed.[info] /Users/dyoung/r9/r9git/padlock-client/java/com/r9/padlock/client/ipcaptcha/CaptchaChecker.java: Some input files use or override a deprecated API.
                       [info] /Users/dyoung/r9/r9git/padlock-client/java/com/r9/padlock/client/ipcaptcha/CaptchaChecker.java: Recompile with -Xlint:deprecation for details.
                       [info] Compile success at Jun 6, 2018, 2:35:10 PM [0.673s]
                       [info] /Users/dyoung/r9/r9git/destiny-client/java/com/r9/destiny/admin/DestinyAdminClient.java: Some input files use or override a deprecated API.
                       [info] /Users/dyoung/r9/r9git/destiny-client/java/com/r9/destiny/admin/DestinyAdminClient.java: Recompile with -Xlint:deprecation for details.
                       [info] /Users/dyoung/r9/r9git/destiny-client/java/com/r9/destiny/client/DestinyClient.java: Some input files use unchecked or unsafe operations.
                       [info] /Users/dyoung/r9/r9git/destiny-client/java/com/r9/destiny/client/DestinyClient.java: Recompile with -Xlint:unchecked for details.
                       [info] Compile success at Jun 6, 2018, 2:35:16 PM [13.522s]

@jvican
Copy link

jvican commented Jun 6, 2018

Pants is most likely not using the latest Zinc version since this change was merged and released some time ago, with the removal of that assertion.

@stuhood
Copy link
Member

stuhood commented Jun 6, 2018

@youngderekm : 1.8.0.dev0 is the first release using new zinc (cc @jvican). 1.8.0.dev2 contains a few more fixes as well. See https://www.pantsbuild.org/notes-master.html

@stuhood
Copy link
Member

stuhood commented Jun 6, 2018

(see the linked PR)

@jvican
Copy link

jvican commented Jun 7, 2018

Zinc version 1.1.7 should have the issue here reported fixed, let me know if that doesn’t work!

@stuhood
Copy link
Member

stuhood commented Jun 7, 2018

Twitter is currently working on incorporating the 1.8.x series, so I'll probably be cutting a 1.8.0rc0 early next week.

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

Successfully merging a pull request may close this issue.

4 participants