summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-05-18 09:16:16 -0700
committerJonathan Nieder <jrn@google.com>2018-05-18 09:22:30 -0700
commit8c580dd4c02213020d5a928df332a6641d066328 (patch)
treec603aa0239600e822ef58aeec3657cb8c6ae4d3f
parentca79b3d4af748c626d2b35d7404ef49983dfe917 (diff)
downloadjgit-8c580dd4c02213020d5a928df332a6641d066328.tar.gz
jgit-8c580dd4c02213020d5a928df332a6641d066328.zip
Implementors should override Repository#notifyIndexChanged(boolean)
Declare Repository#notifyIndexChanged() final and Repository#notifyIndexChanged(boolean) abstract to force implementors to switch to overriding the latter method. This makes Repository less error-prone to extend since implementors no longer need to remember to override one of those two methods. Change-Id: I721db0f4a4865db3b35212ee0a2045d5b31c96af Signed-off-by: Jonathan Nieder <jrn@google.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java16
1 files changed, 2 insertions, 14 deletions
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 965ccb0989..aa1f2de462 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -112,12 +112,6 @@ import org.slf4j.LoggerFactory;
* <li>{@code FileRepository} is thread-safe.
* <li>{@code DfsRepository} thread-safety is determined by its subclass.
* </ul>
- * <p>
- * <i>Note to implementors:</i> 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);
@@ -1579,25 +1573,19 @@ public abstract class Repository implements AutoCloseable {
* @deprecated replaced by {@link #notifyIndexChanged(boolean)}
*/
@Deprecated
- public void notifyIndexChanged() {
+ public final void notifyIndexChanged() {
notifyIndexChanged(true);
}
/**
* Notify that the index changed by firing an IndexChangedEvent.
- * <p>
- * 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 void notifyIndexChanged(boolean internal) {
- notifyIndexChanged();
- }
+ public abstract void notifyIndexChanged(boolean internal);
/**
* Get a shortened more user friendly ref name