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

[EGIT PATCH 2/6] Cleanup unboxing/boxing

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Feb 5, 2008, 00:15 UTC
Message-ID
<1202170534-15788-3-git-send-email-robin.rosenberg@dewire.com>
In-Reply-To
<1202170534-15788-2-git-send-email-robin.rosenberg@dewire.com>

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.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/ui/GitHistoryPage.java    |    1 +
 .../internal/decorators/GitResourceDecorator.java  |   10 +++++-----
 .../tst/org/spearce/jgit/lib/LaneTest.java         |    1 +
 .../tst/org/spearce/jgit/lib/SuperListTest.java    |    1 +
 .../src/org/spearce/jgit/lib/PersonIdent.java      |    2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
index 812747d..2fc7afa 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
@@ -864,6 +864,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
 //				SWT.COLOR_WHITE,
 				SWT.COLOR_YELLOW
 			};
+			@SuppressWarnings("boxing")
 			public void handleEvent(Event event) {
 				TableItem item = (TableItem) event.item;
 				if (event.index == 0) {
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 c13c38a..7eb008b 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 mapped.isResourceChanged(rsrc);
+				return new Boolean(mapped.isResourceChanged(rsrc));
 			}
 			return null; // not mapped
 		} catch (CoreException e) {
@@ -244,8 +244,8 @@ public class GitResourceDecorator extends LabelProvider implements
 						if (rsrc instanceof IContainer) {
 							Integer df = (Integer) rsrc
 									.getSessionProperty(GITFOLDERDIRTYSTATEPROPERTY);
-							Boolean f = df == null ? isDirty(rsrc) : df
-									.intValue() == CHANGED;
+							Boolean f = df == null ? isDirty(rsrc)
+									: new Boolean(df.intValue() == CHANGED);
 							if (f != null) {
 								if (f.booleanValue()) {
 									decoration.addPrefix(">"); // Have not
@@ -358,7 +358,7 @@ public class GitResourceDecorator extends LabelProvider implements
 		try {
 			Integer dirty = (Integer) rsrc.getSessionProperty(GITFOLDERDIRTYSTATEPROPERTY);
 			if (dirty == null) {
-				rsrc.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, flag);
+				rsrc.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, new Integer(flag));
 				Activator.trace("SETTING:"+rsrc.getFullPath().toOSString()+" => "+flag);
 				orState(rsrc.getParent(), flag);
 				Display.getDefault().asyncExec(new Runnable() {
@@ -375,7 +375,7 @@ public class GitResourceDecorator extends LabelProvider implements
 				});
 			} else {
 				if ((dirty.intValue() | flag) != dirty.intValue()) {
-					dirty = dirty | flag;
+					dirty = new Integer(dirty.intValue() | flag);
 					rsrc.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, dirty);
 					Activator.trace("SETTING:"+rsrc.getFullPath().toOSString()+" => "+dirty);
 					orState(rsrc.getParent(), dirty.intValue());
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/LaneTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/LaneTest.java
index 0f57075..707fb86 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/LaneTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/LaneTest.java
@@ -498,6 +498,7 @@ public class LaneTest extends TestCase {
 				, road);
 	}
 
+	@SuppressWarnings("boxing")
 	private String drawAsAscii(TopologicalSorter<Data> counter) {
 		StringWriter w = new StringWriter();
 		List<Data> entries = counter.getEntries();
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/SuperListTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/SuperListTest.java
index 121bf9c..79f4da6 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/SuperListTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/SuperListTest.java
@@ -28,6 +28,7 @@ public class SuperListTest extends TestCase {
 		assertEquals(0, l.size());
 	}
 
+	@SuppressWarnings("boxing")
 	public void testNonEmpty() {
 		List<Integer> l = new SuperList<Integer>();
 		List<Integer> sl1 = Arrays.asList(new Integer[] { 3,4 });
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
index 5857cb7..6879eb7 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
@@ -62,7 +62,7 @@ public class PersonIdent {
 
 		name = username;
 		emailAddress = email;
-		when = Calendar.getInstance().getTimeInMillis();
+		when = new Long(Calendar.getInstance().getTimeInMillis());
 		tzOffset = TimeZone.getDefault().getOffset(when.longValue())
 				/ (60 * 1000);
 	}
-- 
1.5.4.rc4.25.g81cc
Previous: Robin RosenbergNext: Robin Rosenberg
Message 3 of 13 in “Cleanups and javadocs”
  1. Cleanups and javadocsRobin Rosenberg, Feb 5, 2008
  2. 1/6 Comment some empty blocks that should be emptyRobin Rosenberg, Feb 5, 2008
  3. 2/6 Cleanup unboxing/boxingRobin Rosenberg, Feb 5, 2008
  4. 3/6 Do not require javadoc in egit.core test projectRobin Rosenberg, Feb 5, 2008
  5. 4/6 Javadoc update for EgitRobin Rosenberg, Feb 5, 2008
  6. 5/6 Drop unused GitBlobStorage classRobin Rosenberg, Feb 5, 2008
  7. 6/6 Tighten requirements on javadoc.Robin Rosenberg, Feb 5, 2008
  8. Shawn O. PearceFeb 6, 2008
  9. 1/2 Use Boolean.valueOf instead of new BooleanRobin Rosenberg, Feb 6, 2008
  10. 2/2 Use Integer.valueOf instead of new IntegerRobin Rosenberg, Feb 6, 2008
  11. Roger C. SoaresFeb 8, 2008
  12. Roger C. SoaresFeb 5, 2008
  13. Robin RosenbergFeb 5, 2008

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.