Bug 567512 - Concurrent modification on clean build with xtext builder

Race conditions can occur when
JavaModelManager.PerProjectInfo.indexingSecondaryCache is accessed, e.g.
when deleting Java sources with secondary types, while the indexing of
those secondary types is stil ongoing. In particular, its possible that
a secondary type is being added to a cache "at the same time" as a
secondary type is being removed from the cache, or while the cache is
being iterated over due to a merge operation. Both can result in
concurrent modification exceptions.

This change adds extra synchronization to prevent concurrent container
access and modifications; the cache is changed to a synchronized map and
iterating over it is synchronized on the map.

Change-Id: I5a9889ce914cf4c11e4245ec4891f2f41c2fe07e
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
1 file changed
tree: 14d98a4e682683c1f2f3ae1f2917d2b836054054
  1. JCL/
  2. modules/
  3. org.eclipse.jdt.annotation/
  4. org.eclipse.jdt.annotation_v1/
  5. org.eclipse.jdt.apt.core/
  6. org.eclipse.jdt.apt.pluggable.core/
  7. org.eclipse.jdt.apt.pluggable.tests/
  8. org.eclipse.jdt.apt.tests/
  9. org.eclipse.jdt.apt.ui/
  10. org.eclipse.jdt.compiler.apt/
  11. org.eclipse.jdt.compiler.apt.tests/
  12. org.eclipse.jdt.compiler.tool/
  13. org.eclipse.jdt.compiler.tool.tests/
  14. org.eclipse.jdt.core/
  15. org.eclipse.jdt.core.ecj.validation/
  16. org.eclipse.jdt.core.formatterapp/
  17. org.eclipse.jdt.core.internal.tools/
  18. org.eclipse.jdt.core.tests.builder/
  19. org.eclipse.jdt.core.tests.compiler/
  20. org.eclipse.jdt.core.tests.model/
  21. org.eclipse.jdt.core.tests.performance/
  22. org.eclipse.jdt.tests.latestBREE/
  23. tests-pom/
  24. .gitignore
  25. CONTRIBUTING
  26. LICENSE
  27. NOTICE
  28. pom.xml
  29. README.md
README.md

JDT Core

This is the core part of Eclipse's Java development tools. It contains the non-UI support for compiling and working with Java code, including the following:

  • an incremental or batch Java compiler that can run standalone or as part of the Eclipse IDE
  • Java source and class file indexer and search infrastructure
  • a Java source code formatter
  • APIs for code assist, access to the AST and structured manipulation of Java source.

For more information and important links, refer to the [JDT wiki page] 1 or the [JDT project overview page] 2.

License

Eclipse Public License (EPL) v2.0