Merge changes Ic0ee9c08,Ia3e82682,I8d8ab547,I8f2cd0a0,I45823b0c,Ie22ac47e

* changes:
  cleanup: Silence an unused-parameter warning
  cleanup: Get rid of some unused-warnings
  cleanup: Remove unused parameter in ConsoleCredentialsProvider
  cleanup: Drop unused parameter on DhtPackParser
  cleanup: Remove unneeded parameter to private method in RefUpdateTest
  cleanup: Remove unnecessary @SuppressWarnings
This commit is contained in:
Shawn Pearce 2012-03-12 10:16:42 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 0a69f05647
10 changed files with 24 additions and 30 deletions

View File

@ -99,16 +99,16 @@ public boolean get(URIish uri, CredentialItem... items)
CredentialItem item = items[i];
if (item instanceof CredentialItem.StringType)
ok = get(uri, (CredentialItem.StringType) item);
ok = get((CredentialItem.StringType) item);
else if (item instanceof CredentialItem.CharArrayType)
ok = get(uri, (CredentialItem.CharArrayType) item);
ok = get((CredentialItem.CharArrayType) item);
else if (item instanceof CredentialItem.YesNoType)
ok = get(uri, (CredentialItem.YesNoType) item);
ok = get((CredentialItem.YesNoType) item);
else if (item instanceof CredentialItem.InformationalMessage)
ok = get(uri, (CredentialItem.InformationalMessage) item);
ok = get((CredentialItem.InformationalMessage) item);
else
throw new UnsupportedCredentialItem(uri, item.getPromptText());
@ -116,7 +116,7 @@ else if (item instanceof CredentialItem.InformationalMessage)
return ok;
}
private boolean get(URIish uri, CredentialItem.StringType item) {
private boolean get(CredentialItem.StringType item) {
if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText());
if (v != null) {
@ -136,7 +136,7 @@ private boolean get(URIish uri, CredentialItem.StringType item) {
}
}
private boolean get(URIish uri, CredentialItem.CharArrayType item) {
private boolean get(CredentialItem.CharArrayType item) {
if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText());
if (v != null) {
@ -156,13 +156,13 @@ private boolean get(URIish uri, CredentialItem.CharArrayType item) {
}
}
private boolean get(URIish uri, CredentialItem.InformationalMessage item) {
private boolean get(CredentialItem.InformationalMessage item) {
cons.printf("%s\n", item.getPromptText());
cons.flush();
return true;
}
private boolean get(URIish uri, CredentialItem.YesNoType item) {
private boolean get(CredentialItem.YesNoType item) {
String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(),
ConsoleText.get().answerYes, ConsoleText.get().answerNo);
if (r != null) {

View File

@ -138,7 +138,6 @@ public void setAsIsFileService(AsIsFileService f) {
* the factory to construct and configure an {@link UploadPack}
* session when a fetch or clone is requested by a client.
*/
@SuppressWarnings("unchecked")
public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) {
gitFilter.setUploadPackFactory(f);
}
@ -158,7 +157,6 @@ public void addUploadPackFilter(Filter filter) {
* the factory to construct and configure a {@link ReceivePack}
* session when a push is requested by a client.
*/
@SuppressWarnings("unchecked")
public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) {
gitFilter.setReceivePackFactory(f);
}

View File

@ -184,6 +184,7 @@ public void debug(Throwable thrown) {
// Ignore (not relevant to test failures)
}
@SuppressWarnings("unused")
public void ignore(Throwable arg0) {
// Ignore (not relevant to test failures)
}

View File

@ -65,7 +65,7 @@ class Fetch extends AbstractFetchCommand {
private Boolean fsck;
@Option(name = "--no-fsck")
void nofsck(final boolean ignored) {
void nofsck(@SuppressWarnings("unused") final boolean ignored) {
fsck = Boolean.FALSE;
}
@ -79,7 +79,7 @@ void nofsck(final boolean ignored) {
private Boolean thin;
@Option(name = "--no-thin")
void nothin(final boolean ignored) {
void nothin(@SuppressWarnings("unused") final boolean ignored) {
thin = Boolean.FALSE;
}

View File

@ -89,7 +89,7 @@ class Push extends TextBuiltin {
private boolean thin = Transport.DEFAULT_PUSH_THIN;
@Option(name = "--no-thin")
void nothin(final boolean ignored) {
void nothin(@SuppressWarnings("unused") final boolean ignored) {
thin = false;
}

View File

@ -1016,11 +1016,11 @@ protected void onInflatedObjectData(PackedObjectInfo obj, int typeCode,
break;
case OBJ_TREE:
onTree(info, data);
onTree(data);
break;
case OBJ_TAG:
onTag(info, data);
onTag(data);
break;
}
}
@ -1045,7 +1045,7 @@ private void onCommit(DhtInfo obj, byte[] raw) throws DhtException {
}
}
private void onTree(DhtInfo obj, byte[] data) {
private void onTree(byte[] data) {
if (isSaveAsCachedPack()) {
treeParser.reset(data);
while (!treeParser.eof()) {
@ -1056,7 +1056,7 @@ private void onTree(DhtInfo obj, byte[] data) {
}
}
private void onTag(DhtInfo obj, byte[] data) {
private void onTag(byte[] data) {
if (isSaveAsCachedPack()) {
idBuffer.fromString(data, 7); // "object $sha1"
lookupByName(idBuffer).setReferenced();

View File

@ -616,7 +616,7 @@ public void testRenameBranchHasPreviousLog() throws IOException {
ObjectId oldHead = db.resolve(Constants.HEAD);
assertFalse("precondition for this test, branch b != HEAD", rb
.equals(oldHead));
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -640,7 +640,7 @@ public void testRenameCurrentBranch() throws IOException {
writeSymref(Constants.HEAD, "refs/heads/b");
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue("internal test condition, b == HEAD", rb.equals(oldHead));
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -669,7 +669,7 @@ public void testRenameBranchAlsoInPack() throws IOException {
Result update = updateRef.update();
assertEquals("internal check new ref is loose", Result.FORCED, update);
assertEquals(Ref.Storage.LOOSE, db.getRef("refs/heads/b").getStorage());
writeReflog(db, rb, rb, "Just a message", "refs/heads/b");
writeReflog(db, rb, "Just a message", "refs/heads/b");
assertTrue("log on old branch", new File(db.getDirectory(),
"logs/refs/heads/b").exists());
RefRename renameRef = db.renameRef("refs/heads/b",
@ -699,8 +699,7 @@ public void tryRenameWhenLocked(String toLock, String fromName,
writeSymref(Constants.HEAD, headPointsTo);
ObjectId oldfromId = db.resolve(fromName);
ObjectId oldHeadId = db.resolve(Constants.HEAD);
writeReflog(db, oldfromId, oldfromId, "Just a message",
fromName);
writeReflog(db, oldfromId, "Just a message", fromName);
List<org.eclipse.jgit.storage.file.ReflogEntry> oldFromLog = db
.getReflogReader(fromName).getReverseEntries();
List<org.eclipse.jgit.storage.file.ReflogEntry> oldHeadLog = oldHeadId != null ? db
@ -806,7 +805,7 @@ public void testRenameRefNameColission1avoided() throws IOException {
assertEquals(Result.FAST_FORWARD, updateRef.update());
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue(rb.equals(oldHead)); // assumption for this test
writeReflog(db, rb, rb, "Just a message", "refs/heads/a");
writeReflog(db, rb, "Just a message", "refs/heads/a");
assertTrue("internal check, we have a log", new File(db.getDirectory(),
"logs/refs/heads/a").exists());
@ -840,8 +839,7 @@ public void testRenameRefNameColission2avoided() throws IOException {
assertEquals(Result.FORCED, updateRef.update());
ObjectId oldHead = db.resolve(Constants.HEAD);
assertTrue(rb.equals(oldHead)); // assumption for this test
writeReflog(db, rb, rb, "Just a message",
"refs/heads/prefix/a");
writeReflog(db, rb, "Just a message", "refs/heads/prefix/a");
assertTrue("internal check, we have a log", new File(db.getDirectory(),
"logs/refs/heads/prefix/a").exists());
@ -864,8 +862,8 @@ public void testRenameRefNameColission2avoided() throws IOException {
"HEAD").getReverseEntries().get(0).getComment());
}
private void writeReflog(Repository db, ObjectId oldId, ObjectId newId,
String msg, String refName) throws IOException {
private void writeReflog(Repository db, ObjectId newId, String msg,
String refName) throws IOException {
RefDirectory refs = (RefDirectory) db.getRefDatabase();
RefDirectoryUpdate update = refs.newUpdate(refName, true);
update.setNewObjectId(newId);

View File

@ -524,7 +524,6 @@ boolean readAhead(ReadableChannel rc, DfsPackKey key, int size, long pos,
return true;
}
@SuppressWarnings("unchecked")
private <T> T scan(HashEntry n, DfsPackKey pack, long position) {
Ref<T> r = scanRef(n, pack, position);
return r != null ? r.get() : null;

View File

@ -541,7 +541,6 @@ public void writeObjects(PackOutputStream out, List<ObjectToPack> list)
}
}
@SuppressWarnings("unchecked")
public Collection<CachedPack> getCachedPacks() throws IOException {
DfsPackFile[] packList = db.getPacks();
List<CachedPack> cached = new ArrayList<CachedPack>(packList.length);

View File

@ -120,7 +120,6 @@ public B setup() throws IllegalArgumentException, IOException {
* the repository could not be accessed to configure the rest of
* the builder's parameters.
*/
@SuppressWarnings("unchecked")
@Override
public abstract R build() throws IOException;