git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [EGIT PATCH Series] Cleanups and javadocs
@ 2008-02-05  0:15 Robin Rosenberg
  2008-02-05  0:15 ` [EGIT PATCH 1/6] Comment some empty blocks that should be empty Robin Rosenberg
  2008-02-05 15:09 ` [EGIT PATCH Series] Cleanups and javadocs Roger C. Soares
  0 siblings, 2 replies; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce

Here is a number of small enhancements that reduce the number of warnings
displayed and raises the standard on comments. We now get javadoc comments
on all public and protected methods which hopefully will make it slighly
easier to get on the train for those interested in helping out with Egit/Jgit.

Disabling the else-warning is probably fairly uncontroversial. Disabling some
warning about boxing/unboxing of integers might be as might be requiring
javadoc comments.

-- robin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [EGIT PATCH 1/6] Comment some empty blocks that should be empty
  2008-02-05  0:15 [EGIT PATCH Series] Cleanups and javadocs Robin Rosenberg
@ 2008-02-05  0:15 ` Robin Rosenberg
  2008-02-05  0:15   ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Robin Rosenberg
  2008-02-05 15:09 ` [EGIT PATCH Series] Cleanups and javadocs Roger C. Soares
  1 sibling, 1 reply; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/core/test/Activator.java  |    1 +
 .../internal/actions/AbstractOperationAction.java  |    1 +
 .../egit/ui/internal/dialogs/CommitDialog.java     |    3 +++
 .../ui/internal/preferences/GitPreferencePage.java |    1 +
 .../spearce/jgit/lib/AbstractIndexTreeVisitor.java |    4 ++++
 .../org/spearce/jgit/lib/TopologicalSorter.java    |    1 +
 6 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java
index 9807c84..10d7d94 100644
--- a/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java
@@ -18,6 +18,7 @@ public class Activator extends Plugin {
 	 * The constructor
 	 */
 	public Activator() {
+		// Empty
 	}
 
 	/*
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/AbstractOperationAction.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/AbstractOperationAction.java
index c3f347e..0e96323 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/AbstractOperationAction.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/AbstractOperationAction.java
@@ -73,6 +73,7 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
 	 * A method to invoke when the operation is finished.
 	 */
 	protected void postOperation() {
+		// Empty
 	}
 
 	public void run(final IAction act) {
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index 3778b94..064a2dc 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -212,6 +212,7 @@ public class CommitDialog extends Dialog {
 			}
 		
 			public void widgetDefaultSelected(SelectionEvent arg0) {
+				// Empty
 			}
 		});
 		
@@ -242,9 +243,11 @@ public class CommitDialog extends Dialog {
 
 			public void inputChanged(Viewer viewer, Object oldInput,
 					Object newInput) {
+				// Empty
 			}
 
 			public void dispose() {
+				// Empty
 			}
 
 			public Object[] getElements(Object inputElement) {
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitPreferencePage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitPreferencePage.java
index 780375b..8e6d3f3 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitPreferencePage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitPreferencePage.java
@@ -36,5 +36,6 @@ public class GitPreferencePage extends PreferencePage implements
 	}
 
 	public void init(final IWorkbench workbench) {
+		// Empty
 	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AbstractIndexTreeVisitor.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AbstractIndexTreeVisitor.java
index 40b42dd..6f5ede4 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AbstractIndexTreeVisitor.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AbstractIndexTreeVisitor.java
@@ -31,17 +31,21 @@ import org.spearce.jgit.lib.GitIndex.Entry;
 public class AbstractIndexTreeVisitor implements IndexTreeVisitor {
 	public void finishVisitTree(Tree tree, Tree auxTree, int i, String curDir)
 			throws IOException {
+		// Empty
 	}
 
 	public void finishVisitTree(Tree tree, int i, String curDir)
 			throws IOException {
+		// Empty
 	}
 
 	public void visitEntry(TreeEntry treeEntry, Entry indexEntry, File file)
 			throws IOException {
+		// Empty
 	}
 
 	public void visitEntry(TreeEntry treeEntry, TreeEntry auxEntry,
 			Entry indexEntry, File file) throws IOException {
+		// Empty
 	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
index 7b59490..c33334e 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
@@ -292,6 +292,7 @@ public class TopologicalSorter<T> {
 		private int number = -1;
 
 		Lane() {
+			// Empty
 		}
 
 		@Override
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 2/6] Cleanup unboxing/boxing
  2008-02-05  0:15 ` [EGIT PATCH 1/6] Comment some empty blocks that should be empty Robin Rosenberg
@ 2008-02-05  0:15   ` Robin Rosenberg
  2008-02-05  0:15     ` [EGIT PATCH 3/6] Do not require javadoc in egit.core test project Robin Rosenberg
  2008-02-06  7:06     ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Shawn O. Pearce
  0 siblings, 2 replies; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 3/6] Do not require javadoc in egit.core test project
  2008-02-05  0:15   ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Robin Rosenberg
@ 2008-02-05  0:15     ` Robin Rosenberg
  2008-02-05  0:15       ` [EGIT PATCH 4/6] Javadoc update for Egit Robin Rosenberg
  2008-02-06  7:06     ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Shawn O. Pearce
  1 sibling, 1 reply; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../.settings/org.eclipse.jdt.core.prefs           |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs
index fb1bc6e..fb77da2 100644
--- a/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Wed May 16 23:05:36 EDT 2007
+#Sun Feb 03 03:52:00 CET 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -34,7 +34,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 4/6] Javadoc update for Egit
  2008-02-05  0:15     ` [EGIT PATCH 3/6] Do not require javadoc in egit.core test project Robin Rosenberg
@ 2008-02-05  0:15       ` Robin Rosenberg
  2008-02-05  0:15         ` [EGIT PATCH 5/6] Drop unused GitBlobStorage class Robin Rosenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

Also includes reduced visibility for a few methods.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/core/Activator.java       |   31 +++++++
 .../src/org/spearce/egit/core/CoreText.java        |   29 +++++++
 .../spearce/egit/core/GitIndexFileRevision.java    |    8 ++
 .../src/org/spearce/egit/core/GitProvider.java     |    7 ++
 .../src/org/spearce/egit/core/GitStorage.java      |   10 ++
 .../src/org/spearce/egit/core/GitTag.java          |    7 ++
 .../egit/core/GitWorkspaceFileRevision.java        |   13 +++
 .../org/spearce/egit/core/internal/UpdateJob.java  |   10 ++
 .../internal/mapping/GitCommitFileRevision.java    |   19 ++++
 .../egit/core/internal/mapping/GitFileHistory.java |   22 +++++
 .../internal/mapping/GitFileHistoryProvider.java   |   22 +++++-
 .../core/internal/mapping/GitFileRevision.java     |   34 ++++++++
 .../org/spearce/egit/core/op/BranchOperation.java  |    9 ++
 .../org/spearce/egit/core/op/ResetOperation.java   |   22 +++++
 .../spearce/egit/core/project/CheckpointJob.java   |    9 ++
 .../spearce/egit/core/project/GitProjectData.java  |   60 +++++++++++++-
 .../egit/core/project/RepositoryMapping.java       |   87 ++++++++++++++++----
 17 files changed, 379 insertions(+), 20 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/Activator.java b/org.spearce.egit.core/src/org/spearce/egit/core/Activator.java
index e3dc3a5..214de61 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/Activator.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/Activator.java
@@ -24,22 +24,45 @@ import org.eclipse.core.runtime.Status;
 import org.osgi.framework.BundleContext;
 import org.spearce.egit.core.project.GitProjectData;
 
+/**
+ * The plugin class for the org.spearce.egit.core plugin. This
+ * is a singleton class.
+ */
 public class Activator extends Plugin {
 	private static Activator plugin;
 
+	/**
+	 * @return the singleton {@link Activator}
+	 */
 	public static Activator getDefault() {
 		return plugin;
 	}
 
+	/**
+	 * @return the name of this plugin
+	 */
 	public static String getPluginId() {
 		return getDefault().getBundle().getSymbolicName();
 	}
 
+	/**
+	 * Utility method to help throwing errors in the Egit plugin. This method
+	 * does not actually throw the exception, but just creates an instance.
+	 *
+	 * @param message User comprehensible message
+	 * @param thr cause
+	 * @return an Initialized {@link CoreException}
+	 */
 	public static CoreException error(final String message, final Throwable thr) {
 		return new CoreException(new Status(IStatus.ERROR, getPluginId(), 0,
 				message, thr));
 	}
 
+	/**
+	 * Utility method to log errors in the Egit plugin.
+	 * @param message User comprehensible message
+	 * @param thr The exception through which we noticed the error
+	 */
 	public static void logError(final String message, final Throwable thr) {
 		getDefault().getLog().log(
 				new Status(IStatus.ERROR, getPluginId(), 0, message, thr));
@@ -51,6 +74,11 @@ public class Activator extends Plugin {
 		return value != null && value.equals("true");
 	}
 
+	/**
+	 * Utility method for debug logging.
+	 *
+	 * @param what
+	 */
 	public static void trace(final String what) {
 		if (getDefault().traceVerbose) {
 			System.out.println("[" + getPluginId() + "] " + what);
@@ -59,6 +87,9 @@ public class Activator extends Plugin {
 
 	private boolean traceVerbose;
 
+	/**
+	 * Construct the {@link Activator} singleton instance
+	 */
 	public Activator() {
 		plugin = this;
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
index 7281c90..e1e1cb3 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
@@ -18,57 +18,86 @@ package org.spearce.egit.core;
 
 import org.eclipse.osgi.util.NLS;
 
+/**
+ * Possibly Translated strings for the Egit plugin.
+ */
 public class CoreText extends NLS {
+	/** */
 	public static String AssumeUnchangedOperation_failed;
 
+	/** */
 	public static String AssumeUnchangedOperation_adding;
 
+	/** */
 	public static String UpdateOperation_updating;
 
+	/** */
 	public static String UpdateOperation_failed;
 
+	/** */
 	public static String ConnectProviderOperation_connecting;
 
+	/** */
 	public static String ConnectProviderOperation_creating;
 
+	/** */
 	public static String ConnectProviderOperation_recordingMapping;
 
+	/** */
 	public static String ConnectProviderOperation_updatingCache;
 
+	/** */
 	public static String DisconnectProviderOperation_disconnecting;
 
+	/** */
 	public static String AddOperation_adding;
 
+	/** */
 	public static String AddOperation_failed;
 
+	/** */
 	public static String UntrackOperation_adding;
 
+	/** */
 	public static String UntrackOperation_failed;
 
+	/** */
 	public static String GitProjectData_lazyResolveFailed;
 
+	/** */
 	public static String GitProjectData_mappedResourceGone;
 
+	/** */
 	public static String GitProjectData_cannotReadHEAD;
 
+	/** */
 	public static String GitProjectData_missing;
 
+	/** */
 	public static String GitProjectData_saveFailed;
 
+	/** */
 	public static String GitProjectData_notifyChangedFailed;
 
+	/** */
 	public static String RepositoryFinder_finding;
 
+	/** */
 	public static String MoveDeleteHook_cannotModifyFolder;
 
+	/** */
 	public static String MoveDeleteHook_operationError;
 
+	/** */
 	public static String Error_CanonicalFile;
 
+	/** */
 	public static String CheckpointJob_writing;
 
+	/** */
 	public static String CheckpointJob_name;
 
+	/** */
 	public static String CheckpointJob_failed;
 
 	static {
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitIndexFileRevision.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitIndexFileRevision.java
index 9ef272c..daae33b 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitIndexFileRevision.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitIndexFileRevision.java
@@ -24,9 +24,17 @@ import org.eclipse.team.core.history.IFileRevision;
 import org.spearce.egit.core.internal.mapping.GitFileRevision;
 import org.spearce.jgit.lib.ObjectId;
 
+/**
+ * An {@link IFileRevision} for the version in the Git index.
+ */
 public class GitIndexFileRevision extends GitFileRevision implements
 		IFileRevision {
 
+	/**
+	 * Construct a GitIndexFileRevision matching a certain resource.
+	 * @param resource The corresponding workspace resource
+	 * @param count index into the full list of results
+	 */
 	public GitIndexFileRevision(IResource resource, int count) {
 		super(resource, count);
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitProvider.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitProvider.java
index f31eec5..e42f6fa 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitProvider.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitProvider.java
@@ -23,6 +23,9 @@ import org.eclipse.team.core.history.IFileHistoryProvider;
 import org.spearce.egit.core.internal.mapping.GitFileHistoryProvider;
 import org.spearce.egit.core.project.GitProjectData;
 
+/**
+ * The Team provider class for a Git repository.
+ */
 public class GitProvider extends RepositoryProvider {
 	private GitProjectData data;
 
@@ -53,6 +56,10 @@ public class GitProvider extends RepositoryProvider {
 		return hook;
 	}
 
+	/**
+	 * @return information about the mapping of an Eclipse project
+	 * to a Git repository.
+	 */
 	public synchronized GitProjectData getData() {
 		if (data == null) {
 			data = GitProjectData.get(getProject());
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
index f791e31..86943ed 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
@@ -36,6 +36,9 @@ import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.TreeEntry;
 import org.spearce.jgit.lib.GitIndex.Entry;
 
+/**
+ * Implements access to a Git managed version of a resource.
+ */
 public class GitStorage implements IStorage {
 
 	private final IResource resource;
@@ -44,6 +47,13 @@ public class GitStorage implements IStorage {
 
 	private ObjectId treeId;
 
+	/**
+	 * Construct an GitStorage instance corresponding to
+	 * a certain workspace resource.
+	 *
+	 * @param treeId
+	 * @param resource
+	 */
 	public GitStorage(ObjectId treeId, IResource resource) {
 		this.treeId = treeId;
 		this.resource = resource;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitTag.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitTag.java
index b8d7c11..86b908c 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitTag.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitTag.java
@@ -18,10 +18,17 @@ package org.spearce.egit.core;
 
 import org.eclipse.team.core.history.ITag;
 
+/**
+ * A representation of a Git tag in Eclipse.
+ */
 public class GitTag implements ITag {
 
 	private String name;
 
+	/**
+	 * Construct a GitTag object with a give name.
+	 * @param name the Git tag name
+	 */
 	public GitTag(String name) {
 		this.name = name;
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitWorkspaceFileRevision.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitWorkspaceFileRevision.java
index aad79b4..7142671 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitWorkspaceFileRevision.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitWorkspaceFileRevision.java
@@ -23,9 +23,22 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.team.core.history.IFileRevision;
 import org.spearce.egit.core.internal.mapping.GitFileRevision;
 
+/**
+ * An {@link IFileRevision} for the version in workspace.
+ */
 public class GitWorkspaceFileRevision extends GitFileRevision implements
 		IFileRevision {
 
+	/**
+	 * Construct a GitWorkspaceFileRevision matching a certain resource. This is
+	 * the same as the resource, which the possible distinction that this is the
+	 * version on disk when unsaved.
+	 *
+	 * @param resource
+	 *            The corresponding workspace resource
+	 * @param count
+	 *            index into the full list of results
+	 */
 	public GitWorkspaceFileRevision(IResource resource, int count) {
 		super(resource, count);
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/UpdateJob.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/UpdateJob.java
index 72b4190..a1476bf 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/UpdateJob.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/UpdateJob.java
@@ -40,10 +40,20 @@ import org.spearce.jgit.errors.NotSupportedException;
 import org.spearce.jgit.lib.GitIndex;
 import org.spearce.jgit.lib.GitIndex.Entry;
 
+/**
+ * This job updates the index with the content of all specified
+ * and tracked resources. If a project is selected all tracked
+ * resources withing that container are updated.
+ */
 public class UpdateJob extends Job {
 
 	private final Collection rsrcList;
 
+	/**
+	 * Construct an UpdateJob for the specified resources.
+	 *
+	 * @param rsrcList
+	 */
 	public UpdateJob(Collection rsrcList) {
 		super("Update index");
 		this.rsrcList = rsrcList;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitCommitFileRevision.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitCommitFileRevision.java
index 6d6f7ea..0ed5a92 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitCommitFileRevision.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitCommitFileRevision.java
@@ -38,10 +38,21 @@ import org.spearce.jgit.lib.Repository;
 import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.TreeEntry;
 
+/**
+ * An {@link IFileRevision} for a version of a specified resource in the
+ * specified commit (revision).
+ */
 public class GitCommitFileRevision extends GitFileRevision {
 
 	private final ObjectId commitId;
 
+	/**
+	 * Construct a {@link GitCommitFileRevision} for a resource in a specified commit.
+	 *
+	 * @param commitId
+	 * @param resource
+	 * @param count index to full list of commits.
+	 */
 	public GitCommitFileRevision(ObjectId commitId, IResource resource, int count) {
 		super(resource, count);
 		this.commitId = commitId;
@@ -109,6 +120,11 @@ public class GitCommitFileRevision extends GitFileRevision {
 		return (ITag[]) ret.toArray(new ITag[ret.size()]);
 	}
 
+	/**
+	 * Maps the commit id of this object and
+	 *
+	 * @return the {@link Commit} object this {@link IFileRevision} refers to
+	 */
 	public Commit getCommit() {
 		try {
 			return RepositoryMapping.getMapping(getResource()).getRepository().mapCommit(commitId);
@@ -121,6 +137,9 @@ public class GitCommitFileRevision extends GitFileRevision {
 		return commitId;
 	}
 
+	/**
+	 * @return the {@link TreeEntry} this {@link IFileRevision} refers to.
+	 */
 	public TreeEntry getTreeEntry() {
 		RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(getResource());
 		Tree tree;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
index 2d06405..d1e5733 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
@@ -48,6 +48,11 @@ import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.TreeEntry;
 import org.spearce.jgit.lib.GitIndex.Entry;
 
+/**
+ * A list of revisions for a specific resource according to some
+ * filtering criterion. Though git really does not do file tracking,
+ * this corresponds to listing all files with the same path.
+ */
 public class GitFileHistory extends FileHistory implements IAdaptable {
 
 	private final IResource resource;
@@ -60,6 +65,20 @@ public class GitFileHistory extends FileHistory implements IAdaptable {
 
 	private final boolean returnAll;
 
+	/**
+	 * Construct a {@link GitFileHistory} object for a given resource (path)
+	 * with some filtering applied. The filter could reduces the number of
+	 * commitgs returned or just mark some versions as interesting.
+	 *
+	 * @param resource
+	 * @param flags
+	 *            See {@link IFileHistoryProvider}
+	 * @param monitor
+	 *            progress reporting facility
+	 * @param returnAll
+	 *            true if all versions should be collected even if the filter
+	 *            does not match.
+	 */
 	public GitFileHistory(IResource resource, int flags, IProgressMonitor monitor, boolean returnAll) {
 		this.resource = resource;
 		this.flags = flags;
@@ -160,6 +179,9 @@ public class GitFileHistory extends FileHistory implements IAdaptable {
 		return revisions.toArray(new IFileRevision[revisions.size()]);
 	}
 
+	/**
+	 * @return the list of revisions. The list may be lazy-evaluated.
+	 */
 	public List<IFileRevision> getFileRevisionsList() {
 		return revisions;
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistoryProvider.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistoryProvider.java
index 298009f..eb7961b 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistoryProvider.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistoryProvider.java
@@ -25,13 +25,16 @@ import org.eclipse.team.core.history.IFileRevision;
 import org.eclipse.team.core.history.provider.FileHistoryProvider;
 import org.spearce.egit.core.GitWorkspaceFileRevision;
 
+/**
+ * A {@link FileHistoryProvider} for Git. This class has methods for
+ * retrieving specific versions of a tracked resource.
+ */
 public class GitFileHistoryProvider extends FileHistoryProvider implements
 		IFileHistoryProvider {
 
 	public IFileHistory getFileHistoryFor(IResource resource, int flags,
 			IProgressMonitor monitor) {
-		// TODO: implement flags
-		return new GitFileHistory(resource, flags, monitor, false); // TODO: implement flags
+		return new GitFileHistory(resource, flags, monitor, false);
 	}
 
 	public IFileRevision getWorkspaceFileRevision(IResource resource) {
@@ -44,6 +47,21 @@ public class GitFileHistoryProvider extends FileHistoryProvider implements
 		return null;
 	}
 
+	/**
+	 * Get the history for a given resource as viewed using the specified
+	 * filtering flags.
+	 *
+	 * @param resource
+	 * @param flags
+	 *            See {@link IFileHistoryProvider}
+	 * @param monitor
+	 *            progress monitor
+	 * @param returnAll
+	 *            true if all revisions are returned and interesting revisiosn.
+	 *
+	 * @return a {@link GitFileHistory} object.
+	 *
+	 */
 	public GitFileHistory getHistoryFor(IResource resource, int flags, IProgressMonitor monitor, boolean returnAll) {
 		return new GitFileHistory(resource, flags, monitor, returnAll); // TODO: implement flags
 	}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
index e11a24c..c309b9d 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
@@ -26,6 +26,11 @@ import org.eclipse.team.core.history.provider.FileRevision;
 import org.spearce.jgit.lib.ObjectId;
 import org.spearce.jgit.lib.TopologicalSorter;
 
+/**
+ * A Git related {@link IFileRevision}. It references a version
+ * and a resource, i.e. the version we think corresponds to the
+ * resource in specific version.
+ */
 public abstract class GitFileRevision extends FileRevision {
 
 	private final IResource resource;
@@ -34,6 +39,12 @@ public abstract class GitFileRevision extends FileRevision {
 
 	private TopologicalSorter<ObjectId>.Lane lane;
 
+	/**
+	 * Construct a {@link GitFileRevision}
+	 *
+	 * @param resource
+	 * @param count index into the full list of commits
+	 */
 	public GitFileRevision(IResource resource, int count) {
 		this.count = count;
 		this.resource = resource;
@@ -56,20 +67,43 @@ public abstract class GitFileRevision extends FileRevision {
 		return resource.getLocationURI();
 	}
 
+	/**
+	 * @return the {@link IResource} the {@link IFileRevision} refers to.
+	 */
 	public IResource getResource() {
 		return resource;
 	}
 
+	/**
+	 * @deprecated
+	 * @return index into full list of versions
+	 */
 	public int getCount() {
 		return count;
 	}
 
+	/**
+	 * @return the swim lane assigned by the graph layout
+	 */
 	public TopologicalSorter<ObjectId>.Lane getLane() {
 		return lane;
 	}
 
+	/**
+	 * Set the swim where this revision is found. Invoked by the
+	 * graph layout.
+	 *
+	 * @param lane
+	 */
 	public void setLane(TopologicalSorter<ObjectId>.Lane lane) {
 		this.lane = lane;
 	}
 
+	/**
+	 * @return the ObjectId this IFileRevision refers to.
+	 */
+	public ObjectId getCommitId() {
+		return null;
+	}
+
 }
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/BranchOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/BranchOperation.java
index f3a0ccb..f1d6cf7 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/BranchOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/BranchOperation.java
@@ -34,12 +34,21 @@ import org.spearce.jgit.lib.Repository;
 import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.WorkDirCheckout;
 
+/**
+ * This class implements checkouts of a specific revision. A check
+ * is made that this can be done without data loss.
+ */
 public class BranchOperation implements IWorkspaceRunnable {
 
 	private final Repository repository;
 
 	private final String refName;
 
+	/**
+	 * Construct a {@link BranchOperation} object.
+	 * @param repository
+	 * @param refName Name of git ref to checkout
+	 */
 	public BranchOperation(Repository repository, String refName) {
 		this.repository = repository;
 		this.refName = refName;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/ResetOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/ResetOperation.java
index 3c5b9bb..9fd5db1 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/ResetOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/ResetOperation.java
@@ -36,10 +36,25 @@ import org.spearce.jgit.lib.Tag;
 import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.WorkDirCheckout;
 
+/**
+ * An class for changing a ref and possibly index and workdir too.
+ */
 public class ResetOperation implements IWorkspaceRunnable {
+	/**
+	 * Kind of reset
+	 */
 	public enum ResetType {
+		/**
+		 * Just change the ref. The index and workdir are not changed.
+		 */
 		SOFT,
+		/**
+		 * Change the ref and the index. The workdir is not changed.
+		 */
 		MIXED,
+		/**
+		 * Change the ref, the index and the workdir
+		 */
 		HARD
 	}
 	
@@ -52,6 +67,13 @@ public class ResetOperation implements IWorkspaceRunnable {
 	private Tree newTree;
 	private GitIndex index;
 
+	/**
+	 * Construct a {@link ResetOperation}
+	 *
+	 * @param repository
+	 * @param refName
+	 * @param type
+	 */
 	public ResetOperation(Repository repository, String refName, ResetType type) {
 		this.repository = repository;
 		this.refName = refName;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/CheckpointJob.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/CheckpointJob.java
index acc8f1f..bc8e8ed 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/CheckpointJob.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/CheckpointJob.java
@@ -31,10 +31,19 @@ import org.spearce.egit.core.CoreText;
 import org.spearce.jgit.lib.GitIndex;
 import org.spearce.jgit.lib.GitIndex.Entry;
 
+/**
+ * This class updates the index with the content of all resources tracked by git
+ * in the index.
+ */
 public class CheckpointJob extends Job {
 
 	private final RepositoryMapping rm;
 
+	/**
+	 * Construct a {@link CheckpointJob} for the specified resource maping
+	 *
+	 * @param m
+	 */
 	public CheckpointJob(final RepositoryMapping m) {
 		super(NLS.bind(CoreText.CheckpointJob_name, m.getContainer()
 				.getFullPath()));
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
index 97bb282..9e4cd87 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
@@ -48,6 +48,10 @@ import org.spearce.egit.core.CoreText;
 import org.spearce.egit.core.GitProvider;
 import org.spearce.jgit.lib.Repository;
 
+/**
+ * This class keeps information about how a project is mapped to
+ * a Git repository.
+ */
 public class GitProjectData {
 	private static final Map projectDataCache = new HashMap();
 
@@ -78,6 +82,11 @@ public class GitProjectData {
 		}
 	}
 
+	/**
+	 * Start listening for resource changes.
+	 *
+	 * @param includeChange true to listen to content changes
+	 */
 	public static void attachToWorkspace(final boolean includeChange) {
 		trace("attachToWorkspace - addResourceChangeListener");
 		ResourcesPlugin.getWorkspace().addResourceChangeListener(
@@ -87,6 +96,9 @@ public class GitProjectData {
 						| IResourceChangeEvent.PRE_DELETE);
 	}
 
+	/**
+	 * Stop listening to resource changes
+	 */
 	public static void detachFromWorkspace() {
 		trace("detachFromWorkspace - removeResourceChangeListener");
 		ResourcesPlugin.getWorkspace().removeResourceChangeListener(rcl);
@@ -134,6 +146,10 @@ public class GitProjectData {
 		return repositoryChangeListeners;
 	}
 
+	/**
+	 * @param p
+	 * @return {@link GitProjectData} for the specified project
+	 */
 	public synchronized static GitProjectData get(final IProject p) {
 		try {
 			GitProjectData d = lookup(p);
@@ -149,6 +165,11 @@ public class GitProjectData {
 		}
 	}
 
+	/**
+	 * Drop the Eclipse project from our assocation of projects/repositories
+	 *
+	 * @param p Eclipse project
+	 */
 	public static void delete(final IProject p) {
 		trace("delete(" + p.getName() + ")");
 		GitProjectData d = lookup(p);
@@ -218,6 +239,12 @@ public class GitProjectData {
 
 	private final Set protectedResources;
 
+	/**
+	 * Construct a {@link GitProjectData} for the mapping
+	 * of a project.
+	 *
+	 * @param p Eclipse project
+	 */
 	public GitProjectData(final IProject p) {
 		project = p;
 		mappings = new ArrayList();
@@ -225,16 +252,29 @@ public class GitProjectData {
 		protectedResources = new HashSet();
 	}
 
+	/**
+	 * @return the Eclipse project mapped through this resource.
+	 */
 	public IProject getProject() {
 		return project;
 	}
 
+	/**
+	 * TODO: is this right?
+	 *
+	 * @param newMappings
+	 */
 	public void setRepositoryMappings(final Collection newMappings) {
 		mappings.clear();
 		mappings.addAll(newMappings);
 		remapAll();
 	}
 
+	/**
+	 * Hide our private parts from the navigators other browsers.
+	 *
+	 * @throws CoreException
+	 */
 	public void markTeamPrivateResources() throws CoreException {
 		final Iterator i = c2mapping.entrySet().iterator();
 		while (i.hasNext()) {
@@ -258,15 +298,26 @@ public class GitProjectData {
 		}
 	}
 
+	/**
+	 * @param f
+	 * @return true if a resource is protected in this repository
+	 */
 	public boolean isProtected(final IResource f) {
 		return protectedResources.contains(f);
 	}
 
+	/**
+	 * TODO: check usage, we should probably declare the parameter
+	 * as IProject.
+	 *
+	 * @param r Eclipse project
+	 * @return the mapping for the specified project
+	 */
 	public RepositoryMapping getRepositoryMapping(final IResource r) {
 		return (RepositoryMapping) c2mapping.get(r);
 	}
 
-	public void delete() {
+	private void delete() {
 		final File dir = propertyFile().getParentFile();
 		final File[] todel = dir.listFiles();
 		if (todel != null) {
@@ -281,6 +332,11 @@ public class GitProjectData {
 		uncache(getProject());
 	}
 
+	/**
+	 * Store information about the repository connection in the workspace
+	 *
+	 * @throws CoreException
+	 */
 	public void store() throws CoreException {
 		final File dat = propertyFile();
 		final File tmp;
@@ -385,7 +441,7 @@ public class GitProjectData {
 			// We are in deep trouble. This should NOT have happend. Detach
 			// our listeners and forget it ever did.
 			//
-			attachToWorkspace(false);
+			detachFromWorkspace();
 			Activator.logError(CoreText.GitProjectData_notifyChangedFailed, ce);
 		}
 
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
index b062a29..754a172 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
@@ -37,8 +37,11 @@ import org.spearce.jgit.lib.Tree;
 import org.spearce.jgit.lib.TreeEntry;
 import org.spearce.jgit.lib.GitIndex.Entry;
 
+/**
+ * This class keeps track
+ */
 public class RepositoryMapping {
-	public static boolean isInitialKey(final String key) {
+	static boolean isInitialKey(final String key) {
 		return key.endsWith(".gitdir");
 	}
 
@@ -52,6 +55,12 @@ public class RepositoryMapping {
 
 	private IContainer container;
 
+	/**
+	 * Construct a {@link RepositoryMapping} for a previously connected project.
+	 *
+	 * @param p TODO
+	 * @param initialKey TODO
+	 */
 	public RepositoryMapping(final Properties p, final String initialKey) {
 		final int dot = initialKey.lastIndexOf('.');
 		String s;
@@ -62,6 +71,14 @@ public class RepositoryMapping {
 		subset = "".equals(s) ? null : s;
 	}
 
+	/**
+	 * Construct a {@link RepositoryMapping} for previously
+	 * unknown project.
+	 *
+	 * @param mappedContainer
+	 * @param gitDir
+	 * @param subsetRoot
+	 */
 	public RepositoryMapping(final IContainer mappedContainer,
 			final File gitDir, final String subsetRoot) {
 		final IPath cLoc = mappedContainer.getLocation()
@@ -103,55 +120,75 @@ public class RepositoryMapping {
 		}
 	}
 
-	public IPath getContainerPath() {
+	IPath getContainerPath() {
 		return Path.fromPortableString(containerPath);
 	}
 
-	public IPath getGitDirPath() {
+	IPath getGitDirPath() {
 		return Path.fromPortableString(gitdirPath);
 	}
 
+	/**
+	 * Eclipse projects typically reside one or more levels
+	 * below the repository. This method return the relative
+	 * path to the project. Null is returned instead of "".
+	 *
+	 * @return relative path from repository to project, or null
+	 */
 	public String getSubset() {
 		return subset;
 	}
 
+	/**
+	 * @return the workdir file, i.e. where the files are checked out
+	 */
 	public File getWorkDir() {
-//		assert containerPath.endsWith("/" + subset);
-//		return Path.fromPortableString(
-//				containerPath.substring(containerPath.length() - 1
-//						- subset.length())).toFile();
 		return getRepository().getDirectory().getParentFile();
 	}
 
-	public synchronized void clear() {
+	synchronized void clear() {
 		db = null;
 		container = null;
 	}
 
+	/**
+	 * @return a reference to the repository object handled by this mapping
+	 */
 	public synchronized Repository getRepository() {
 		return db;
 	}
 
-	public synchronized void setRepository(final Repository r) {
+	synchronized void setRepository(final Repository r) {
 		db = r;
 	}
 
+	/**
+	 * @return the mapped container (currently project)
+	 */
 	public synchronized IContainer getContainer() {
 		return container;
 	}
 
-	public synchronized void setContainer(final IContainer c) {
+	synchronized void setContainer(final IContainer c) {
 		container = c;
 	}
 
-	public synchronized void fullUpdate() {
-		recomputeMerge();
-	}
-
+	/**
+	 * @deprecated, leftover from the old "index"
+	 * TODO: rename or replace
+	 */
 	public synchronized void recomputeMerge() {
 		GitProjectData.fireRepositoryChanged(this);
 	}
 
+	/**
+	 * Retrieve the Git tree object matching the currently
+	 * checked out version.
+	 *
+	 * @return the Git Tree matching the container mapped
+	 * @throws IOException on general problems accessing the repository
+	 * @throws MissingObjectException something is missing
+	 */
 	public synchronized Tree mapHEADTree() throws IOException,
 			MissingObjectException {
 		Tree head = getRepository().mapTree(Constants.HEAD);
@@ -168,7 +205,7 @@ public class RepositoryMapping {
 		return head;
 	}
 
-	public synchronized void store(final Properties p) {
+	synchronized void store(final Properties p) {
 		p.setProperty(containerPath + ".gitdir", gitdirPath);
 		if (subset != null && !"".equals(subset)) {
 			p.setProperty(containerPath + ".subset", subset);
@@ -179,6 +216,19 @@ public class RepositoryMapping {
 		return "RepositoryMapping[" + containerPath + " -> " + gitdirPath + "]";
 	}
 
+	/**
+	 * Check whether a resource has been changed relative to the checked out
+	 * version. Content is assumed changed by this routine if the resource's
+	 * modification time differs from what is recorded in the index, but the
+	 * real content hasn't changed. The reason is performance.
+	 *
+	 * @param rsrc
+	 * @return true if a resource differs in the workdir or index relative to
+	 *         HEAD
+	 *
+	 * @throws IOException
+	 * @throws UnsupportedEncodingException
+	 */
 	public boolean isResourceChanged(IResource rsrc) throws IOException, UnsupportedEncodingException {
 		Repository repository = getRepository();
 		GitIndex index = repository.getIndex();
@@ -193,10 +243,13 @@ public class RepositoryMapping {
 		if (blob == null)
 			return true; // added in index
 		boolean hashesDiffer = !entry.getObjectId().equals(blob.getId());
-//		System.out.println("HashesDiffer: " + rsrc);
 		return hashesDiffer || entry.isModified(getWorkDir());
 	}
 
+	/**
+	 * @param rsrc
+	 * @return the path relative to the Git repository, including base name.
+	 */
 	public String getRepoRelativePath(IResource rsrc) {
 		String prefix = getSubset();
 		String projectRelativePath = rsrc.getProjectRelativePath().toString();
@@ -208,6 +261,8 @@ public class RepositoryMapping {
 				repoRelativePath = prefix + "/" + projectRelativePath;
 		} else
 			repoRelativePath = projectRelativePath;
+
+		assert repoRelativePath != null;
 		return repoRelativePath;
 	}
 
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 5/6] Drop unused GitBlobStorage class
  2008-02-05  0:15       ` [EGIT PATCH 4/6] Javadoc update for Egit Robin Rosenberg
@ 2008-02-05  0:15         ` Robin Rosenberg
  2008-02-05  0:15           ` [EGIT PATCH 6/6] Tighten requirements on javadoc Robin Rosenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/core/GitBlobStorage.java  |   99 --------------------
 1 files changed, 0 insertions(+), 99 deletions(-)
 delete mode 100644 org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java
deleted file mode 100644
index f7a062c..0000000
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Copyright (C) 2006  Robin Rosenberg
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License, version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
- */
-package org.spearce.egit.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.spearce.egit.core.project.RepositoryMapping;
-import org.spearce.jgit.lib.ObjectId;
-import org.spearce.jgit.lib.ObjectLoader;
-import org.spearce.jgit.lib.Tree;
-import org.spearce.jgit.lib.TreeEntry;
-
-public class GitBlobStorage implements IStorage {
-
-	private final IResource resource;
-
-	private TreeEntry entry;
-
-	public GitBlobStorage(ObjectId treeId, IResource resource, String relativeResourceName) {
-		this.resource = resource;
-		if (treeId == null)
-			return;
-
-		RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(resource);
-		Tree tree;
-		try {
-			tree = repositoryMapping.getRepository().mapTree(treeId);
-			String name = repositoryMapping.getRepoRelativePath(resource);
-			entry = tree.findBlobMember(name);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	public InputStream getContents() throws CoreException {
-		try {
-			if (entry == null) {
-				return ((IFile) resource).getContents();
-			} else {
-				ObjectId id = entry.getId();
-				ObjectLoader reader = entry.getRepository().openBlob(id);
-				byte[] bytes = reader.getBytes();
-				return new ByteArrayInputStream(bytes);
-			}
-		} catch (FileNotFoundException e) {
-			throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL,
-					resource.getFullPath(), "Could not read file", e);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			throw new ResourceException(33, resource.getFullPath(), e
-					.getMessage(), e);
-		}
-	}
-
-	public IPath getFullPath() {
-		return resource.getFullPath();
-	}
-
-	public String getName() {
-		return resource.getName();
-	}
-
-	public boolean isReadOnly() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public Object getAdapter(Class adapter) {
-		System.out.println("GitStorage("+adapter.getName()+")");
-		return null;
-	}
-
-}
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 6/6] Tighten requirements on javadoc.
  2008-02-05  0:15         ` [EGIT PATCH 5/6] Drop unused GitBlobStorage class Robin Rosenberg
@ 2008-02-05  0:15           ` Robin Rosenberg
  0 siblings, 0 replies; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05  0:15 UTC (permalink / raw)
  To: git; +Cc: Roger C. Soares, Dave Watson, Shawn O. Pearce, Robin Rosenberg

All public and protected methods and members must be documented.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../.settings/org.eclipse.jdt.core.prefs           |    4 ++--
 .../.settings/org.eclipse.jdt.core.prefs           |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/org.spearce.egit.core/.settings/org.eclipse.jdt.core.prefs b/org.spearce.egit.core/.settings/org.eclipse.jdt.core.prefs
index 322fe98..f94f9a8 100644
--- a/org.spearce.egit.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.spearce.egit.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Wed May 16 23:05:48 EDT 2007
+#Sun Feb 03 18:48:30 CET 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -34,7 +34,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
diff --git a/org.spearce.jgit.test/.settings/org.eclipse.jdt.core.prefs b/org.spearce.jgit.test/.settings/org.eclipse.jdt.core.prefs
index 15190a0..8bfa5f1 100644
--- a/org.spearce.jgit.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.spearce.jgit.test/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Dec 20 01:31:35 CET 2007
+#Tue Feb 05 00:01:29 CET 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -37,7 +37,7 @@ org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [EGIT PATCH Series] Cleanups and javadocs
  2008-02-05  0:15 [EGIT PATCH Series] Cleanups and javadocs Robin Rosenberg
  2008-02-05  0:15 ` [EGIT PATCH 1/6] Comment some empty blocks that should be empty Robin Rosenberg
@ 2008-02-05 15:09 ` Roger C. Soares
  2008-02-05 21:47   ` Robin Rosenberg
  1 sibling, 1 reply; 13+ messages in thread
From: Roger C. Soares @ 2008-02-05 15:09 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, Dave Watson, Shawn O. Pearce


Robin Rosenberg escreveu:
> Here is a number of small enhancements that reduce the number of warnings
> displayed and raises the standard on comments. We now get javadoc comments
> on all public and protected methods which hopefully will make it slighly
> easier to get on the train for those interested in helping out with Egit/Jgit.
>
> Disabling the else-warning is probably fairly uncontroversial. Disabling some
> warning about boxing/unboxing of integers might be as might be requiring
> javadoc comments.
>
>   
Hi Robin,

[2, 3, 5 and 6] - looks fine to me.

[1] - What about something like "nothing to be done here" and/or 
"implementing interface method"?

[4] - Some typos:
+     * Construct an GitStorage instance corresponding to
+     * Construct a GitTag object with a give name.
+     * with some filtering applied. The filter could reduces the number of
+     * commitgs returned or just mark some versions as interesting.
+     *            true if all revisions are returned and interesting 
revisiosn.
+ * An class for changing a ref and possibly index and workdir too.
+     * Construct a {@link CheckpointJob} for the specified resource maping
+     * Drop the Eclipse project from our assocation of 
projects/repositories

And
+    /**
+     * Maps the commit id of this object and
+     *
+     * @return the {@link Commit} object this {@link IFileRevision} 
refers to
+     */
and what?

[]s,
Roger.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [EGIT PATCH Series] Cleanups and javadocs
  2008-02-05 15:09 ` [EGIT PATCH Series] Cleanups and javadocs Roger C. Soares
@ 2008-02-05 21:47   ` Robin Rosenberg
  0 siblings, 0 replies; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-05 21:47 UTC (permalink / raw)
  To: Roger C. Soares; +Cc: git, Dave Watson, Shawn O. Pearce

tisdagen den 5 februari 2008 skrev Roger C. Soares:
> 
> Robin Rosenberg escreveu:
> > Here is a number of small enhancements that reduce the number of warnings
> > displayed and raises the standard on comments. We now get javadoc comments
> > on all public and protected methods which hopefully will make it slighly
> > easier to get on the train for those interested in helping out with Egit/Jgit.
> >
> > Disabling the else-warning is probably fairly uncontroversial. Disabling some
> > warning about boxing/unboxing of integers might be as might be requiring
> > javadoc comments.
> >
> >   
> Hi Robin,
> 
> [2, 3, 5 and 6] - looks fine to me.
Thanks for looking.

> [1] - What about something like "nothing to be done here" and/or 
> "implementing interface method"?
"Empty" is a marker that the block is *intentionally* empty, which
is the point here.

> [4] - Some typos:
Thanks

-- robin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [EGIT PATCH 2/6] Cleanup unboxing/boxing
  2008-02-05  0:15   ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Robin Rosenberg
  2008-02-05  0:15     ` [EGIT PATCH 3/6] Do not require javadoc in egit.core test project Robin Rosenberg
@ 2008-02-06  7:06     ` Shawn O. Pearce
  2008-02-06 20:14       ` [EGIT PATCH 1/2] Use Boolean.valueOf instead of new Boolean Robin Rosenberg
  2008-02-06 20:15       ` [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer Robin Rosenberg
  1 sibling, 2 replies; 13+ messages in thread
From: Shawn O. Pearce @ 2008-02-06  7:06 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, Roger C. Soares, Dave Watson

Robin Rosenberg <robin.rosenberg@dewire.com> 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.

Use Boolean.valueOf(boolean) instead of new Boolean.  It recycles
the cached Boolean.TRUE and Boolean.FALSE and thus avoids creating
garbage that the GC needs to reclaim later.

> @@ -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() {

Use Integer.valueOf(int).  Post Java 5 implementations of the J2SE
are required to cache values between -128 and 127 (inclusive).

Actually, when the Java compiler autoboxes values it does so through
these static valueOf methods, which were mostly introduced as part
of the Java 5 API updates.  For small common values its cached and
will thus avoid garbage generation, for less common values it goes
back to allocating the object.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [EGIT PATCH 1/2] Use Boolean.valueOf instead of new Boolean
  2008-02-06  7:06     ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Shawn O. Pearce
@ 2008-02-06 20:14       ` Robin Rosenberg
  2008-02-06 20:15       ` [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer Robin Rosenberg
  1 sibling, 0 replies; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-06 20:14 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Roger C. Soares, Dave Watson

onsdagen den 6 februari 2008 skrev Shawn O. Pearce:
> Robin Rosenberg <robin.rosenberg@dewire.com> 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@dewire.com>
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@dewire.com>
---
 .../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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer
  2008-02-06  7:06     ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Shawn O. Pearce
  2008-02-06 20:14       ` [EGIT PATCH 1/2] Use Boolean.valueOf instead of new Boolean Robin Rosenberg
@ 2008-02-06 20:15       ` Robin Rosenberg
  2008-02-08  2:52         ` Roger C. Soares
  1 sibling, 1 reply; 13+ messages in thread
From: Robin Rosenberg @ 2008-02-06 20:15 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Roger C. Soares, Dave Watson

onsdagen den 6 februari 2008 skrev Shawn O. Pearce:
> Use Integer.valueOf(int).  Post Java 5 implementations of the J2SE
> are required to cache values between -128 and 127 (inclusive).
> 
> Actually, when the Java compiler autoboxes values it does so through
> these static valueOf methods, which were mostly introduced as part
> of the Java 5 API updates.  For small common values its cached and
> will thus avoid garbage generation, for less common values it goes
> back to allocating the object.

Thank you for this information.

-- robin

>From 2f2248fc01c169d85e88d42d10693e4ec59a0c1d Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Wed, 6 Feb 2008 21:06:08 +0100
Subject: [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer

Java 1.5+ has a cache for small numbers.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/ui/FindResults.java       |   10 +++++-----
 .../internal/decorators/GitResourceDecorator.java  |    4 ++--
 .../tst/org/spearce/jgit/lib/MappedListTest.java   |    8 ++++----
 .../tst/org/spearce/jgit/lib/SuperListTest.java    |   12 ++++++------
 .../src/org/spearce/jgit/lib/SuperList.java        |    2 +-
 .../org/spearce/jgit/lib/TopologicalSorter.java    |    8 ++++----
 6 files changed, 22 insertions(+), 22 deletions(-)

Thanks to Shawn

-- robin

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/FindResults.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/FindResults.java
index 9484503..2b49597 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/FindResults.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/FindResults.java
@@ -45,7 +45,7 @@ public class FindResults {
 	 *         <code>false</code> otherwise
 	 */
 	public synchronized boolean isFoundAt(int index) {
-		return matchesMap.containsKey(new Integer(index));
+		return matchesMap.containsKey(Integer.valueOf(index));
 	}
 
 	/**
@@ -59,7 +59,7 @@ public class FindResults {
 	 */
 	public synchronized int getIndexAfter(int index) {
 		Integer[] matches = getkeysArray();
-		int sres = Arrays.binarySearch(matches, new Integer(index));
+		int sres = Arrays.binarySearch(matches, Integer.valueOf(index));
 		if (sres >= 0 && sres != matches.length - 1) {
 			return matches[sres + 1].intValue();
 		} else if (sres < 0) {
@@ -83,7 +83,7 @@ public class FindResults {
 	 */
 	public synchronized int getIndexBefore(int index) {
 		Integer[] matches = getkeysArray();
-		int sres = Arrays.binarySearch(matches, new Integer(index));
+		int sres = Arrays.binarySearch(matches, Integer.valueOf(index));
 		if (sres >= 0 && sres != 0) {
 			return matches[sres - 1].intValue();
 		} else if (sres < -1) {
@@ -136,7 +136,7 @@ public class FindResults {
 	 *         list. Returns -1 if <code>index</code> doesn't contain a match
 	 */
 	public synchronized int getMatchNumberFor(int index) {
-		Integer ix = matchesMap.get(new Integer(index));
+		Integer ix = matchesMap.get(Integer.valueOf(index));
 		if (ix != null) {
 			return ix.intValue();
 		}
@@ -168,7 +168,7 @@ public class FindResults {
 	 *            the history table item index that matches a find pattern.
 	 */
 	public synchronized void add(int matchIx) {
-		matchesMap.put(new Integer(matchIx), new Integer(++matchesCount));
+		matchesMap.put(Integer.valueOf(matchIx), Integer.valueOf(++matchesCount));
 		keysArray = null;
 	}
 
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 9592817..df2f569 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
@@ -358,7 +358,7 @@ public class GitResourceDecorator extends LabelProvider implements
 		try {
 			Integer dirty = (Integer) rsrc.getSessionProperty(GITFOLDERDIRTYSTATEPROPERTY);
 			if (dirty == null) {
-				rsrc.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, new Integer(flag));
+				rsrc.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, Integer.valueOf(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 = new Integer(dirty.intValue() | flag);
+					dirty = Integer.valueOf(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/MappedListTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/MappedListTest.java
index ccc13a0..6513d99 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/MappedListTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/MappedListTest.java
@@ -29,13 +29,13 @@ public class MappedListTest extends TestCase {
 						new Float(3.14f) })) {
 			@Override
 			protected Integer map(Float from) {
-				return new Integer((int) from.floatValue() * 2);
+				return Integer.valueOf((int) from.floatValue() * 2);
 			}
 		};
 
 		assertEquals(3, x.toArray().length);
-		assertEquals(new Integer(2), x.toArray()[0]);
-		assertEquals(new Integer(4), x.toArray()[1]);
-		assertEquals(new Integer(6), x.toArray()[2]);
+		assertEquals(Integer.valueOf(2), x.toArray()[0]);
+		assertEquals(Integer.valueOf(4), x.toArray()[1]);
+		assertEquals(Integer.valueOf(6), x.toArray()[2]);
 	}
 }
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 79f4da6..be38b95 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
@@ -38,14 +38,14 @@ public class SuperListTest extends TestCase {
 		l.addAll(sl1);
 		l.addAll(sl2);
 		l.addAll(sl3);
-		l.add(new Integer(7));
+		l.add(Integer.valueOf(7));
 
 		assertEquals(5, l.size());
-		assertEquals(new Integer(3), l.toArray()[0]);
-		assertEquals(new Integer(4), l.toArray()[1]);
-		assertEquals(new Integer(5), l.toArray()[2]);
-		assertEquals(new Integer(6), l.toArray()[3]);
-		assertEquals(new Integer(7), l.toArray()[4]);
+		assertEquals(Integer.valueOf(3), l.toArray()[0]);
+		assertEquals(Integer.valueOf(4), l.toArray()[1]);
+		assertEquals(Integer.valueOf(5), l.toArray()[2]);
+		assertEquals(Integer.valueOf(6), l.toArray()[3]);
+		assertEquals(Integer.valueOf(7), l.toArray()[4]);
 
 		assertEquals(5, l.toArray().length);
 	}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/SuperList.java b/org.spearce.jgit/src/org/spearce/jgit/lib/SuperList.java
index 4a50794..04c9958 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/SuperList.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/SuperList.java
@@ -48,7 +48,7 @@ public class SuperList<T> extends AbstractList<T> {
 	 */
 	public boolean addAll(List<T> subList) {
 		int lastEnd = subLists.size() > 0 ? subListEnd.get(subListEnd.size()-1).intValue() : 0;
-		subListEnd.add(new Integer(lastEnd + subList.size()));
+		subListEnd.add(Integer.valueOf(lastEnd + subList.size()));
 		subLists.add(subList);
 		return true;
 	}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
index c33334e..d5c2430 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TopologicalSorter.java
@@ -205,9 +205,9 @@ public class TopologicalSorter<T> {
 		allNodes.add(edge.to);
 		Integer n = inCount.get(edge.to);
 		if (n == null)
-			inCount.put(edge.to, new Integer(1));
+			inCount.put(edge.to, Integer.valueOf(1));
 		else
-			inCount.put(edge.to, new Integer(n.intValue() + 1));
+			inCount.put(edge.to, Integer.valueOf(n.intValue() + 1));
 	}
 
 	/**
@@ -255,7 +255,7 @@ public class TopologicalSorter<T> {
 					zeroIn.add(e.to);
 					inCount.remove(e.to);
 				} else {
-					inCount.put(e.to, new Integer(c.intValue() - 1));
+					inCount.put(e.to, Integer.valueOf(c.intValue() - 1));
 				}
 			}
 //			allEdges.remove(from);
@@ -356,7 +356,7 @@ public class TopologicalSorter<T> {
 		}
 		Iterator<T> i = zeroIn.iterator();
 		ret = i.next();
-		internalOrder.put(ret, new Integer(internalOrder.size()));
+		internalOrder.put(ret, Integer.valueOf(internalOrder.size()));
 		i.remove();
 		removeallfrom(ret);
 		return ret;
-- 
1.5.4.rc4.25.g81cc

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer
  2008-02-06 20:15       ` [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer Robin Rosenberg
@ 2008-02-08  2:52         ` Roger C. Soares
  0 siblings, 0 replies; 13+ messages in thread
From: Roger C. Soares @ 2008-02-08  2:52 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: Shawn O. Pearce, git, Dave Watson


Robin Rosenberg escreveu:
> onsdagen den 6 februari 2008 skrev Shawn O. Pearce:
>   
>> Use Integer.valueOf(int).  Post Java 5 implementations of the J2SE
>> are required to cache values between -128 and 127 (inclusive).
>>
>> Actually, when the Java compiler autoboxes values it does so through
>> these static valueOf methods, which were mostly introduced as part
>> of the Java 5 API updates.  For small common values its cached and
>> will thus avoid garbage generation, for less common values it goes
>> back to allocating the object.
>>     
>
> Thank you for this information.
>
> -- robin
Yep, this is very good to know. Thanks from me too :)
This patches series looks fine to me.

[]s,
Roger.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-02-08  2:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05  0:15 [EGIT PATCH Series] Cleanups and javadocs Robin Rosenberg
2008-02-05  0:15 ` [EGIT PATCH 1/6] Comment some empty blocks that should be empty Robin Rosenberg
2008-02-05  0:15   ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Robin Rosenberg
2008-02-05  0:15     ` [EGIT PATCH 3/6] Do not require javadoc in egit.core test project Robin Rosenberg
2008-02-05  0:15       ` [EGIT PATCH 4/6] Javadoc update for Egit Robin Rosenberg
2008-02-05  0:15         ` [EGIT PATCH 5/6] Drop unused GitBlobStorage class Robin Rosenberg
2008-02-05  0:15           ` [EGIT PATCH 6/6] Tighten requirements on javadoc Robin Rosenberg
2008-02-06  7:06     ` [EGIT PATCH 2/6] Cleanup unboxing/boxing Shawn O. Pearce
2008-02-06 20:14       ` [EGIT PATCH 1/2] Use Boolean.valueOf instead of new Boolean Robin Rosenberg
2008-02-06 20:15       ` [EGIT PATCH 2/2] Use Integer.valueOf instead of new Integer Robin Rosenberg
2008-02-08  2:52         ` Roger C. Soares
2008-02-05 15:09 ` [EGIT PATCH Series] Cleanups and javadocs Roger C. Soares
2008-02-05 21:47   ` Robin Rosenberg

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).