From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 02/12] Mark non-overridable methods of RevObject final
Date: Tue, 17 Mar 2009 18:40:41 -0700 [thread overview]
Message-ID: <1237340451-31562-3-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1237340451-31562-2-git-send-email-spearce@spearce.org>
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@spearce.org>
---
.../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
next prev parent reply other threads:[~2009-03-18 1:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 1:40 [JGIT PATCH 00/12] Improve test coverage in revwalk Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 01/12] Fix copyright year in revwalk test file headers Shawn O. Pearce
2009-03-18 1:40 ` Shawn O. Pearce [this message]
2009-03-18 1:40 ` [JGIT PATCH 03/12] Change RevWalkTestCase to use RevCommit, not ObjectId Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 04/12] Test that RevFilter.MERGE_BASE cannot use a TreeFilter Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 05/12] Add unit tests for DateRevQueue Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 06/12] Add unit tests for FIFORevQueue Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 07/12] Add unit tests for LIFORevQueue Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 08/12] Add unit tests for AbstractRevQueue.EMPTY_QUEUE Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 09/12] Add tests for basic RevObject methods related to type, flags Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 10/12] Add tests for ObjectWalk Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 11/12] Add some basic logic tests for TreeFilter on RevWalk Shawn O. Pearce
2009-03-18 1:40 ` [JGIT PATCH 12/12] Implement git-core t/t6012-rev-list-simplify test case Shawn O. Pearce
2009-03-18 6:34 ` [JGIT PATCH 00/12] Improve test coverage in revwalk Robin Rosenberg
2009-03-18 9:21 ` Robin Rosenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237340451-31562-3-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).