threads / patch / 19261

patchProvide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

Subject: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

## tl;dr

9 messages between May 9, 2009 and Aug 12, 2009. Diffs are folded; open one to read it.

replies: 8people: 3as markdown or json

Alex Blewitt· May 9, 2009, 22:57 UTC · lore
---
 .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Show changes to org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java +6 −0
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
index acb3cb5..015042a 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
@@ -448,6 +448,12 @@ public final String name() {
 	}
 
 	/**
+	 * @return string form of the SHA-1, in lower case hexadecimal.
+	 */
+	public final String getName() {
+		return name();
+	}
+	/**
 	 * Return unique abbreviation (prefix) of this object SHA-1.
 	 * <p>
 	 * This method is a utility for <code>abbreviate(repo, 8)</code>.
-- 
1.6.2.2
Shawn O. Pearce· May 10, 2009, 21:19 UTC · re: Alex Blewitt · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

Alex Blewitt <alex.blewitt@gmail.com> wrote:
Show 7 quoted lines
>  	/**
> +	 * @return string form of the SHA-1, in lower case hexadecimal.
> +	 */
> +	public final String getName() {
> +		return name();
> +	}
> +	/**
Ok, but how about unit tests?
-- 
Shawn.
Shawn O. Pearce· Aug 10, 2009, 15:52 UTC · re: Alex Blewitt · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

Alex Blewitt <alex.blewitt@gmail.com> wrote:
Show 17 quoted lines
> ---
>  .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> index acb3cb5..015042a 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> @@ -448,6 +448,12 @@ public final String name() {
>  	}
>  
>  	/**
> +	 * @return string form of the SHA-1, in lower case hexadecimal.
> +	 */
> +	public final String getName() {
> +		return name();
> +	}
Obviously you didn't compile test this in JGit:

./org/spearce/jgit/revwalk/RevTag.java:206: getName() in org.spearce.jgit.revwalk.RevTag cannot override getName() in org.spearce.jgit.lib.AnyObjectId; overridden method is final

:-(
-- 
Shawn.
Alex Blewitt· Aug 10, 2009, 18:11 UTC · re: Shawn O. Pearce · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

That was ages ago that I submitted that patch. I'm pretty sure that it compiled at the time for the version of JGit that I had back then.

Sent from my (new) iPhone
On 10 Aug 2009, at 16:52, "Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 31 quoted lines
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
>> ---
>> .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ 
>> AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ 
>> AnyObjectId.java
>> index acb3cb5..015042a 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> @@ -448,6 +448,12 @@ public final String name() {
>>    }
>>
>>    /**
>> +     * @return string form of the SHA-1, in lower case hexadecimal.
>> +     */
>> +    public final String getName() {
>> +        return name();
>> +    }
>
> Obviously you didn't compile test this in JGit:
>
> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
> org.spearce.jgit.revwalk.RevTag cannot override getName() in
> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>
> :-(
>
> -- 
> Shawn.
Alex Blewitt· Aug 10, 2009, 18:19 UTC · re: Shawn O. Pearce · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

That patch was originally mailed on the 11th May. Has it taken until now to notice the problem, or was the other method added in the last month or so? If I'm to blame, I apologise but didn't note any compile time issues at the time.

Alex
Sent from my (new) iPhone
On 10 Aug 2009, at 16:52, "Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 31 quoted lines
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
>> ---
>> .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ 
>> AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ 
>> AnyObjectId.java
>> index acb3cb5..015042a 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> @@ -448,6 +448,12 @@ public final String name() {
>>    }
>>
>>    /**
>> +     * @return string form of the SHA-1, in lower case hexadecimal.
>> +     */
>> +    public final String getName() {
>> +        return name();
>> +    }
>
> Obviously you didn't compile test this in JGit:
>
> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
> org.spearce.jgit.revwalk.RevTag cannot override getName() in
> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>
> :-(
>
> -- 
> Shawn.
Shawn O. Pearce· Aug 10, 2009, 20:59 UTC · re: Alex Blewitt · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

Alex Blewitt <alex.blewitt@gmail.com> wrote:
> That patch was originally mailed on the 11th May. Has it taken until now 
> to notice the problem, or was the other method added in the last month or 
> so? If I'm to blame, I apologise but didn't note any compile time issues 
> at the time.

Arrgh, you are right, I lost this patch in my inbox, and in the interm we applied new features to RevTag which added getName there.

> On 10 Aug 2009, at 16:52, "Shawn O. Pearce" <spearce@spearce.org> wrote:
>> Obviously you didn't compile test this in JGit:
Never mind.
>> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
>> org.spearce.jgit.revwalk.RevTag cannot override getName() in
>> org.spearce.jgit.lib.AnyObjectId; overridden method is final

I can't apply this patch because getName() on RevTag is already defined with a different meaning. :-(

-- 
Shawn.
Alex Blewitt· Aug 11, 2009, 12:53 UTC · re: Shawn O. Pearce · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

On 10 Aug 2009, at 21:59, "Shawn O." <spearce@spearce.org> wrote:
Show 18 quoted lines
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
>> That patch was originally mailed on the 11th May. Has it taken  
>> until now
>> to notice the problem, or was the other method added in the last  
>> month or
>> so? If I'm to blame, I apologise but didn't note any compile time  
>> issues
>> at the time.
>
> Arrgh, you are right, I lost this patch in my inbox, and in the
> interm we applied new features to RevTag which added getName there. .
>
>>> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
>>> org.spearce.jgit.revwalk.RevTag cannot override getName() in
>>> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>
> I can't apply this patch because getName() on RevTag is already
> defined with a different meaning.  :-(

That sounds dangerous. We now have a .name() and a .getName() with different semantics. Can we not change the RevTag method name to something else so that we dont have an inconsistency?

>
Alex 
Shawn O. Pearce· Aug 12, 2009, 14:20 UTC · re: Alex Blewitt · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

Alex Blewitt <alex.blewitt@gmail.com> wrote:
Show 12 quoted lines
> On 10 Aug 2009, at 21:59, "Shawn O." <spearce@spearce.org> wrote:
>>
>>>> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
>>>> org.spearce.jgit.revwalk.RevTag cannot override getName() in
>>>> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>>
>> I can't apply this patch because getName() on RevTag is already
>> defined with a different meaning.  :-(
>
> That sounds dangerous. We now have a .name() and a .getName() with  
> different semantics. Can we not change the RevTag method name to  
> something else so that we dont have an inconsistency?

Good point. We didn't think that RevTag.getName method through very well. Rename it to getTagName() ?

-- 
Shawn.
Robin Rosenberg· Aug 12, 2009, 19:09 UTC · re: Shawn O. Pearce · lore

Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>

onsdag 12 augusti 2009 16:20:49 skrev "Shawn O. Pearce" <spearce@spearce.org>:
Show 16 quoted lines
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
> > On 10 Aug 2009, at 21:59, "Shawn O." <spearce@spearce.org> wrote:
> >>
> >>>> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
> >>>> org.spearce.jgit.revwalk.RevTag cannot override getName() in
> >>>> org.spearce.jgit.lib.AnyObjectId; overridden method is final
> >>
> >> I can't apply this patch because getName() on RevTag is already
> >> defined with a different meaning.  :-(
> >
> > That sounds dangerous. We now have a .name() and a .getName() with  
> > different semantics. Can we not change the RevTag method name to  
> > something else so that we dont have an inconsistency?
> 
> Good point.  We didn't think that RevTag.getName method through
> very well.  Rename it to getTagName() ?
Ok with me.
-- robin

← back to recent threads