onsdagen den 6 februari 2008 skrev Shawn O. Pearce: > Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> wrote: > > These operation are relatively expensive in general so it is good to make them > > visible, but when they are needed a lot we just want to do without explicit conversion > > so we ignore the warning there. > > @@ -207,7 +207,7 @@ public class GitResourceDecorator extends LabelProvider implements > > return Boolean.FALSE; > > } > > > > - return mapped.isResourceChanged(rsrc); > > + return new Boolean(mapped.isResourceChanged(rsrc)); > > } > > return null; // not mapped > > } catch (CoreException e) { > > Oooooooow. That hurts. Sorry :/ I reuse Date and String, and Integer object elsewhere all the time, but the obvious solution is too simple :) Thanks Shawn. -- robin >From 4fbd3de89c53956abfbc1a4bb08113c6a9f83ab3 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> Date: Wed, 6 Feb 2008 18:40:25 +0100 Subject: [EGIT PATCH 1/2] Use Boolean.valueOf instead of new Boolean This use two singleton Booleans instead of allocating new objects. Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../internal/decorators/GitResourceDecorator.java | 4 ++-- .../src/org/spearce/jgit/lib/GitIndex.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java index 7eb008b..9592817 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java @@ -207,7 +207,7 @@ public class GitResourceDecorator extends LabelProvider implements return Boolean.FALSE; } - return new Boolean(mapped.isResourceChanged(rsrc)); + return Boolean.valueOf(mapped.isResourceChanged(rsrc)); } return null; // not mapped } catch (CoreException e) { @@ -245,7 +245,7 @@ public class GitResourceDecorator extends LabelProvider implements Integer df = (Integer) rsrc .getSessionProperty(GITFOLDERDIRTYSTATEPROPERTY); Boolean f = df == null ? isDirty(rsrc) - : new Boolean(df.intValue() == CHANGED); + : Boolean.valueOf(df.intValue() == CHANGED); if (f != null) { if (f.booleanValue()) { decoration.addPrefix(">"); // Have not diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java index 69ed270..3cd9de9 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java @@ -290,7 +290,7 @@ public class GitIndex { if (setExecute != null) { try { return ((Boolean) setExecute.invoke(f, - new Object[] { new Boolean(value) })).booleanValue(); + new Object[] { Boolean.valueOf(value) })).booleanValue(); } catch (IllegalArgumentException e) { throw new Error(e); } catch (IllegalAccessException e) { -- 1.5.4.rc4.25.g81cc - 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