[JGIT PATCH 02/12] Mark non-overridable methods of RevObject final

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There isn't a huge benefit to allowing these methods to be overridden,
and subclasses might actually screw them up given that flags is only
visible within our package.  Mark them all final instead.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/revwalk/RevObject.java    |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
index 8c7cc23..e8fb29f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
@@ -70,17 +70,17 @@ abstract void parse(RevWalk walk) throws MissingObjectException,
 	 * 
 	 * @return unique hash of this object.
 	 */
-	public ObjectId getId() {
+	public final ObjectId getId() {
 		return this;
 	}
 
 	@Override
-	public boolean equals(final ObjectId o) {
+	public final boolean equals(final ObjectId o) {
 		return this == o;
 	}
 
 	@Override
-	public boolean equals(final Object o) {
+	public final boolean equals(final Object o) {
 		return this == o;
 	}
 
@@ -91,7 +91,7 @@ public boolean equals(final Object o) {
 	 *            the flag to test.
 	 * @return true if the flag has been added to this object; false if not.
 	 */
-	public boolean has(final RevFlag flag) {
+	public final boolean has(final RevFlag flag) {
 		return (flags & flag.mask) != 0;
 	}
 
@@ -103,7 +103,7 @@ public boolean has(final RevFlag flag) {
 	 * @return true if any flag in the set has been added to this object; false
 	 *         if not.
 	 */
-	public boolean hasAny(final RevFlagSet set) {
+	public final boolean hasAny(final RevFlagSet set) {
 		return (flags & set.mask) != 0;
 	}
 
@@ -115,7 +115,7 @@ public boolean hasAny(final RevFlagSet set) {
 	 * @return true if all flags of the set have been added to this object;
 	 *         false if some or none have been added.
 	 */
-	public boolean hasAll(final RevFlagSet set) {
+	public final boolean hasAll(final RevFlagSet set) {
 		return (flags & set.mask) == set.mask;
 	}
 
@@ -127,7 +127,7 @@ public boolean hasAll(final RevFlagSet set) {
 	 * @param flag
 	 *            the flag to mark on this object, for later testing.
 	 */
-	public void add(final RevFlag flag) {
+	public final void add(final RevFlag flag) {
 		flags |= flag.mask;
 	}
 
@@ -137,7 +137,7 @@ public void add(final RevFlag flag) {
 	 * @param set
 	 *            the set of flags to mark on this object, for later testing.
 	 */
-	public void add(final RevFlagSet set) {
+	public final void add(final RevFlagSet set) {
 		flags |= set.mask;
 	}
 
@@ -149,7 +149,7 @@ public void add(final RevFlagSet set) {
 	 * @param flag
 	 *            the flag to remove from this object.
 	 */
-	public void remove(final RevFlag flag) {
+	public final void remove(final RevFlag flag) {
 		flags &= ~flag.mask;
 	}
 
@@ -159,7 +159,7 @@ public void remove(final RevFlag flag) {
 	 * @param set
 	 *            the flag to remove from this object.
 	 */
-	public void remove(final RevFlagSet set) {
+	public final void remove(final RevFlagSet set) {
 		flags &= ~set.mask;
 	}
 
-- 
1.6.2.1.286.g8173

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux