diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index e7e2b0034..965ccb098 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -112,6 +112,12 @@ import org.slf4j.LoggerFactory; *
  • {@code FileRepository} is thread-safe. *
  • {@code DfsRepository} thread-safety is determined by its subclass. * + *

    + * Note to implementors: Make sure to override + * {@link #notifyIndexChanged(boolean)} or {@link #notifyIndexChanged()}, or + * else both will throw {@code StackOverflowException}. In the next JGit minor + * release, {@link #notifyIndexChanged(boolean)} will be abstract and {@link + * #notifyIndexChanged()} will be final. */ public abstract class Repository implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(Repository.class); @@ -1567,15 +1573,31 @@ public abstract class Repository implements AutoCloseable { */ public abstract void scanForRepoChanges() throws IOException; + /** + * Backward compatibility synonym for {@code notifyIndexChanged(true)}. + * + * @deprecated replaced by {@link #notifyIndexChanged(boolean)} + */ + @Deprecated + public void notifyIndexChanged() { + notifyIndexChanged(true); + } + /** * Notify that the index changed by firing an IndexChangedEvent. + *

    + * The default implementation calls {@link #notifyIndexChanged()} for + * backward compatibility but will no longer do so in the next JGit minor + * release. Implementors should override this method directly instead. * * @param internal * {@code true} if the index was changed by the same * JGit process * @since 5.0 */ - public abstract void notifyIndexChanged(boolean internal); + public void notifyIndexChanged(boolean internal) { + notifyIndexChanged(); + } /** * Get a shortened more user friendly ref name