git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 1/5] Make RevTag getObject(), getName() final to prevent overrides

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 12, 2009, 23:00 UTC
Message-ID
<1244847619-7364-2-git-send-email-spearce@spearce.org>
In-Reply-To
<1244847619-7364-1-git-send-email-spearce@spearce.org>

These methods exist solely to export the object headers from the tag buffer. Overriding them may create confusion by trying to replace the value with something other than what was parsed from the tag headers. Other methods like getShortMessage() and the getTaggerIdent() are likewise already marked final.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/revwalk/RevTag.java       |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
index cace82d..83fd873 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
@@ -189,7 +189,7 @@ public Tag asTag(final RevWalk walk) {
 	 * 
 	 * @return object this tag refers to.
 	 */
-	public RevObject getObject() {
+	public final RevObject getObject() {
 		return object;
 	}
 
@@ -198,7 +198,7 @@ public RevObject getObject() {
 	 * 
 	 * @return name of the tag, according to the tag header.
 	 */
-	public String getName() {
+	public final String getName() {
 		return name;
 	}
 
-- 
1.6.3.2.367.gf0de
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 2 of 6 in “Fix major performance problems in UploadPack”
  1. 0/5 Fix major performance problems in UploadPackShawn O. Pearce, Jun 12, 2009
  2. 1/5 Make RevTag getObject(), getName() final to prevent overridesShawn O. Pearce, Jun 12, 2009
  3. 2/5 Allow exceptions to be created with integer type codesShawn O. Pearce, Jun 12, 2009
  4. 3/5 Unify RevWalk parsing code to be more consistent across typesShawn O. Pearce, Jun 12, 2009
  5. 4/5 Change RevObject dispose() semantics to avoid reparsesShawn O. Pearce, Jun 12, 2009
  6. 5/5 UploadPack: Only recompute okToGiveUp() if bases changedShawn O. Pearce, Jun 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.