Cleanup: Add @Override

(Note it's for froyo-plus-asop)

Change-Id: Ic4211c08586e33c44d5d6267c0c9d37f8c7cdc85
This commit is contained in:
Makoto Onuki 2010-05-07 15:26:31 -07:00
parent 630758ef89
commit 165e8bfe7a
10 changed files with 46 additions and 0 deletions

View File

@ -69,6 +69,7 @@ public class FixedLengthInputStream extends InputStream {
return read(b, 0, b.length); return read(b, 0, b.length);
} }
@Override
public String toString() { public String toString() {
return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength); return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength);
} }

View File

@ -72,6 +72,7 @@ public class PeekableInputStream extends InputStream {
return read(b, 0, b.length); return read(b, 0, b.length);
} }
@Override
public String toString() { public String toString() {
return String.format("PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)", return String.format("PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)",
mIn.toString(), mPeeked, mPeekedByte); mIn.toString(), mPeeked, mPeekedByte);

View File

@ -198,6 +198,7 @@ public class Address {
* *
* @return Human readable address string. Not quoted and not encoded. * @return Human readable address string. Not quoted and not encoded.
*/ */
@Override
public String toString() { public String toString() {
if (mPersonal != null) { if (mPersonal != null) {
if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) { if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) {

View File

@ -159,6 +159,7 @@ public class PackedString {
/** /**
* Pack the values and return a single, encoded string * Pack the values and return a single, encoded string
*/ */
@Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Map.Entry<String,String> entry : mMap.entrySet()) { for (Map.Entry<String,String> entry : mMap.entrySet()) {

View File

@ -147,10 +147,12 @@ public class MimeMessage extends Message {
return mHeader; return mHeader;
} }
@Override
public Date getReceivedDate() throws MessagingException { public Date getReceivedDate() throws MessagingException {
return null; return null;
} }
@Override
public Date getSentDate() throws MessagingException { public Date getSentDate() throws MessagingException {
if (mSentDate == null) { if (mSentDate == null) {
try { try {
@ -164,11 +166,13 @@ public class MimeMessage extends Message {
return mSentDate; return mSentDate;
} }
@Override
public void setSentDate(Date sentDate) throws MessagingException { public void setSentDate(Date sentDate) throws MessagingException {
setHeader("Date", DATE_FORMAT.format(sentDate)); setHeader("Date", DATE_FORMAT.format(sentDate));
this.mSentDate = sentDate; this.mSentDate = sentDate;
} }
@Override
public String getContentType() throws MessagingException { public String getContentType() throws MessagingException {
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE); String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) { if (contentType == null) {
@ -209,6 +213,7 @@ public class MimeMessage extends Message {
* Returns a list of the given recipient type from this message. If no addresses are * Returns a list of the given recipient type from this message. If no addresses are
* found the method returns an empty array. * found the method returns an empty array.
*/ */
@Override
public Address[] getRecipients(RecipientType type) throws MessagingException { public Address[] getRecipients(RecipientType type) throws MessagingException {
if (type == RecipientType.TO) { if (type == RecipientType.TO) {
if (mTo == null) { if (mTo == null) {
@ -230,6 +235,7 @@ public class MimeMessage extends Message {
} }
} }
@Override
public void setRecipients(RecipientType type, Address[] addresses) throws MessagingException { public void setRecipients(RecipientType type, Address[] addresses) throws MessagingException {
final int TO_LENGTH = 4; // "To: " final int TO_LENGTH = 4; // "To: "
final int CC_LENGTH = 4; // "Cc: " final int CC_LENGTH = 4; // "Cc: "
@ -266,15 +272,18 @@ public class MimeMessage extends Message {
/** /**
* Returns the unfolded, decoded value of the Subject header. * Returns the unfolded, decoded value of the Subject header.
*/ */
@Override
public String getSubject() throws MessagingException { public String getSubject() throws MessagingException {
return MimeUtility.unfoldAndDecode(getFirstHeader("Subject")); return MimeUtility.unfoldAndDecode(getFirstHeader("Subject"));
} }
@Override
public void setSubject(String subject) throws MessagingException { public void setSubject(String subject) throws MessagingException {
final int HEADER_NAME_LENGTH = 9; // "Subject: " final int HEADER_NAME_LENGTH = 9; // "Subject: "
setHeader("Subject", MimeUtility.foldAndEncode2(subject, HEADER_NAME_LENGTH)); setHeader("Subject", MimeUtility.foldAndEncode2(subject, HEADER_NAME_LENGTH));
} }
@Override
public Address[] getFrom() throws MessagingException { public Address[] getFrom() throws MessagingException {
if (mFrom == null) { if (mFrom == null) {
String list = MimeUtility.unfold(getFirstHeader("From")); String list = MimeUtility.unfold(getFirstHeader("From"));
@ -286,6 +295,7 @@ public class MimeMessage extends Message {
return mFrom; return mFrom;
} }
@Override
public void setFrom(Address from) throws MessagingException { public void setFrom(Address from) throws MessagingException {
final int FROM_LENGTH = 6; // "From: " final int FROM_LENGTH = 6; // "From: "
if (from != null) { if (from != null) {
@ -298,6 +308,7 @@ public class MimeMessage extends Message {
} }
} }
@Override
public Address[] getReplyTo() throws MessagingException { public Address[] getReplyTo() throws MessagingException {
if (mReplyTo == null) { if (mReplyTo == null) {
mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to"))); mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to")));
@ -305,6 +316,7 @@ public class MimeMessage extends Message {
return mReplyTo; return mReplyTo;
} }
@Override
public void setReplyTo(Address[] replyTo) throws MessagingException { public void setReplyTo(Address[] replyTo) throws MessagingException {
final int REPLY_TO_LENGTH = 10; // "Reply-to: " final int REPLY_TO_LENGTH = 10; // "Reply-to: "
if (replyTo == null || replyTo.length == 0) { if (replyTo == null || replyTo.length == 0) {
@ -342,14 +354,17 @@ public class MimeMessage extends Message {
return messageId; return messageId;
} }
@Override
public void saveChanges() throws MessagingException { public void saveChanges() throws MessagingException {
throw new MessagingException("saveChanges not yet implemented"); throw new MessagingException("saveChanges not yet implemented");
} }
@Override
public Body getBody() throws MessagingException { public Body getBody() throws MessagingException {
return mBody; return mBody;
} }
@Override
public void setBody(Body body) throws MessagingException { public void setBody(Body body) throws MessagingException {
this.mBody = body; this.mBody = body;
if (body instanceof com.android.email.mail.Multipart) { if (body instanceof com.android.email.mail.Multipart) {
@ -369,18 +384,22 @@ public class MimeMessage extends Message {
return getMimeHeaders().getFirstHeader(name); return getMimeHeaders().getFirstHeader(name);
} }
@Override
public void addHeader(String name, String value) throws MessagingException { public void addHeader(String name, String value) throws MessagingException {
getMimeHeaders().addHeader(name, value); getMimeHeaders().addHeader(name, value);
} }
@Override
public void setHeader(String name, String value) throws MessagingException { public void setHeader(String name, String value) throws MessagingException {
getMimeHeaders().setHeader(name, value); getMimeHeaders().setHeader(name, value);
} }
@Override
public String[] getHeader(String name) throws MessagingException { public String[] getHeader(String name) throws MessagingException {
return getMimeHeaders().getHeader(name); return getMimeHeaders().getHeader(name);
} }
@Override
public void removeHeader(String name) throws MessagingException { public void removeHeader(String name) throws MessagingException {
getMimeHeaders().removeHeader(name); getMimeHeaders().removeHeader(name);
if ("Message-ID".equalsIgnoreCase(name)) { if ("Message-ID".equalsIgnoreCase(name)) {

View File

@ -72,6 +72,7 @@ public class MimeMultipart extends Multipart {
this.mPreamble = preamble; this.mPreamble = preamble;
} }
@Override
public String getContentType() throws MessagingException { public String getContentType() throws MessagingException {
return mContentType; return mContentType;
} }

View File

@ -480,6 +480,7 @@ public class ImapStore extends Store {
this.mName = name; this.mName = name;
} }
@Override
public void open(OpenMode mode, PersistentDataCallbacks callbacks) public void open(OpenMode mode, PersistentDataCallbacks callbacks)
throws MessagingException { throws MessagingException {
if (isOpen() && mMode == mode) { if (isOpen() && mMode == mode) {
@ -542,6 +543,7 @@ public class ImapStore extends Store {
} }
} }
@Override
public boolean isOpen() { public boolean isOpen() {
return mConnection != null; return mConnection != null;
} }
@ -551,6 +553,7 @@ public class ImapStore extends Store {
return mMode; return mMode;
} }
@Override
public void close(boolean expunge) { public void close(boolean expunge) {
if (!isOpen()) { if (!isOpen()) {
return; return;
@ -563,10 +566,12 @@ public class ImapStore extends Store {
} }
} }
@Override
public String getName() { public String getName() {
return mName; return mName;
} }
@Override
public boolean exists() throws MessagingException { public boolean exists() throws MessagingException {
if (mExists) { if (mExists) {
return true; return true;
@ -605,10 +610,12 @@ public class ImapStore extends Store {
} }
// IMAP supports folder creation // IMAP supports folder creation
@Override
public boolean canCreate(FolderType type) { public boolean canCreate(FolderType type) {
return true; return true;
} }
@Override
public boolean create(FolderType type) throws MessagingException { public boolean create(FolderType type) throws MessagingException {
/* /*
* This method needs to operate in the unselected mode as well as the selected mode * This method needs to operate in the unselected mode as well as the selected mode
@ -756,10 +763,12 @@ public class ImapStore extends Store {
return messages.toArray(new Message[] {}); return messages.toArray(new Message[] {});
} }
@Override
public Message[] getMessages(MessageRetrievalListener listener) throws MessagingException { public Message[] getMessages(MessageRetrievalListener listener) throws MessagingException {
return getMessages(null, listener); return getMessages(null, listener);
} }
@Override
public Message[] getMessages(String[] uids, MessageRetrievalListener listener) public Message[] getMessages(String[] uids, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
checkOpen(); checkOpen();
@ -1160,6 +1169,7 @@ public class ImapStore extends Store {
* the new UID of the given message on the IMAP server and sets the Message's UID to the * the new UID of the given message on the IMAP server and sets the Message's UID to the
* new server UID. * new server UID.
*/ */
@Override
public void appendMessages(Message[] messages) throws MessagingException { public void appendMessages(Message[] messages) throws MessagingException {
checkOpen(); checkOpen();
try { try {
@ -1245,6 +1255,7 @@ public class ImapStore extends Store {
} }
} }
@Override
public Message[] expunge() throws MessagingException { public Message[] expunge() throws MessagingException {
checkOpen(); checkOpen();
try { try {

View File

@ -1639,6 +1639,7 @@ public class LocalStore extends Store implements PersistentDataCallbacks {
return mAttachmentCount; return mAttachmentCount;
} }
@Override
public void parse(InputStream in) throws IOException, MessagingException { public void parse(InputStream in) throws IOException, MessagingException {
super.parse(in); super.parse(in);
} }
@ -1793,6 +1794,7 @@ public class LocalStore extends Store implements PersistentDataCallbacks {
mAttachmentId = attachmentId; mAttachmentId = attachmentId;
} }
@Override
public String toString() { public String toString() {
return "" + mAttachmentId; return "" + mAttachmentId;
} }

View File

@ -325,6 +325,7 @@ public class Pop3Store extends Store {
} }
// POP3 does not folder creation // POP3 does not folder creation
@Override
public boolean canCreate(FolderType type) { public boolean canCreate(FolderType type) {
return false; return false;
} }
@ -611,6 +612,7 @@ public class Pop3Store extends Store {
* @param fp * @param fp
* @throws MessagingException * @throws MessagingException
*/ */
@Override
public void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener) public void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
if (messages == null || messages.length == 0) { if (messages == null || messages.length == 0) {
@ -805,16 +807,20 @@ public class Pop3Store extends Store {
return PERMANENT_FLAGS; return PERMANENT_FLAGS;
} }
@Override
public void appendMessages(Message[] messages) throws MessagingException { public void appendMessages(Message[] messages) throws MessagingException {
} }
@Override
public void delete(boolean recurse) throws MessagingException { public void delete(boolean recurse) throws MessagingException {
} }
@Override
public Message[] expunge() throws MessagingException { public Message[] expunge() throws MessagingException {
return null; return null;
} }
@Override
public void setFlags(Message[] messages, Flag[] flags, boolean value) public void setFlags(Message[] messages, Flag[] flags, boolean value)
throws MessagingException { throws MessagingException {
if (!value || !Utility.arrayContains(flags, Flag.DELETED)) { if (!value || !Utility.arrayContains(flags, Flag.DELETED)) {
@ -953,6 +959,7 @@ public class Pop3Store extends Store {
mSize = size; mSize = size;
} }
@Override
protected void parse(InputStream in) throws IOException, MessagingException { protected void parse(InputStream in) throws IOException, MessagingException {
super.parse(in); super.parse(in);
} }
@ -980,6 +987,7 @@ public class Pop3Store extends Store {
/** the server is capable of accepting multiple commands at a time (unused) */ /** the server is capable of accepting multiple commands at a time (unused) */
public boolean pipelining; public boolean pipelining;
@Override
public String toString() { public String toString() {
return String.format("STLS %b, TOP %b, USER %b, UIDL %b, PIPELINING %b", return String.format("STLS %b, TOP %b, USER %b, UIDL %b, PIPELINING %b",
stls, stls,

View File

@ -61,6 +61,7 @@ public class MessagingControllerUnitTests extends AndroidTestCase {
mName = name; mName = name;
} }
@Override
public String getName() { public String getName() {
return mName; return mName;
} }