Enable and fix 'Should be tagged with @Override' warning

Set missingOverrideAnnotation=warning in Eclipse compiler preferences
which enables the warning:

  The method <method> of type <type> should be tagged with @Override
  since it actually overrides a superclass method

Justification for this warning is described in:

  http://stackoverflow.com/a/94411/381622

Enabling this causes in excess of 1000 warnings across the entire
code-base. They are very easy to fix automatically with Eclipse's
"Quick Fix" tool.

Fix all of them except 2 which cause compilation failure when the
project is built with mvn; add TODO comments on those for further
investigation.

Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2017-01-16 14:39:32 +09:00
parent 5e8e2179b2
commit 7ac182f4e4
347 changed files with 1011 additions and 18 deletions

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -223,15 +223,18 @@ public HttpClientConnection(String urlStr, Proxy proxy, HttpClient cl)
this.proxy = proxy;
}
@Override
public int getResponseCode() throws IOException {
execute();
return resp.getStatusLine().getStatusCode();
}
@Override
public URL getURL() {
return url;
}
@Override
public String getResponseMessage() throws IOException {
execute();
return resp.getStatusLine().getReasonPhrase();
@ -259,6 +262,7 @@ private void execute() throws IOException, ClientProtocolException {
}
}
@Override
public Map<String, List<String>> getHeaderFields() {
Map<String, List<String>> ret = new HashMap<String, List<String>>();
for (Header hdr : resp.getAllHeaders()) {
@ -270,10 +274,12 @@ public Map<String, List<String>> getHeaderFields() {
return ret;
}
@Override
public void setRequestProperty(String name, String value) {
req.addHeader(name, value);
}
@Override
public void setRequestMethod(String method) throws ProtocolException {
this.method = method;
if (METHOD_GET.equalsIgnoreCase(method)) {
@ -290,18 +296,22 @@ public void setRequestMethod(String method) throws ProtocolException {
}
}
@Override
public void setUseCaches(boolean usecaches) {
// not needed
}
@Override
public void setConnectTimeout(int timeout) {
this.timeout = Integer.valueOf(timeout);
}
@Override
public void setReadTimeout(int readTimeout) {
this.readTimeout = Integer.valueOf(readTimeout);
}
@Override
public String getContentType() {
HttpEntity responseEntity = resp.getEntity();
if (responseEntity != null) {
@ -312,16 +322,19 @@ public String getContentType() {
return null;
}
@Override
public InputStream getInputStream() throws IOException {
return resp.getEntity().getContent();
}
// will return only the first field
@Override
public String getHeaderField(String name) {
Header header = resp.getFirstHeader(name);
return (header == null) ? null : header.getValue();
}
@Override
public int getContentLength() {
Header contentLength = resp.getFirstHeader("content-length"); //$NON-NLS-1$
if (contentLength == null) {
@ -336,14 +349,17 @@ public int getContentLength() {
}
}
@Override
public void setInstanceFollowRedirects(boolean followRedirects) {
this.followRedirects = Boolean.valueOf(followRedirects);
}
@Override
public void setDoOutput(boolean dooutput) {
// TODO: check whether we can really ignore this.
}
@Override
public void setFixedLengthStreamingMode(int contentLength) {
if (entity != null)
throw new IllegalArgumentException();
@ -351,52 +367,63 @@ public void setFixedLengthStreamingMode(int contentLength) {
entity.setContentLength(contentLength);
}
@Override
public OutputStream getOutputStream() throws IOException {
if (entity == null)
entity = new TemporaryBufferEntity(new LocalFile(null));
return entity.getBuffer();
}
@Override
public void setChunkedStreamingMode(int chunklen) {
if (entity == null)
entity = new TemporaryBufferEntity(new LocalFile(null));
entity.setChunked(true);
}
@Override
public String getRequestMethod() {
return method;
}
@Override
public boolean usingProxy() {
return isUsingProxy;
}
@Override
public void connect() throws IOException {
execute();
}
@Override
public void setHostnameVerifier(final HostnameVerifier hostnameverifier) {
this.hostnameverifier = new X509HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return hostnameverifier.verify(hostname, session);
}
@Override
public void verify(String host, String[] cns, String[] subjectAlts)
throws SSLException {
throw new UnsupportedOperationException(); // TODO message
}
@Override
public void verify(String host, X509Certificate cert)
throws SSLException {
throw new UnsupportedOperationException(); // TODO message
}
@Override
public void verify(String host, SSLSocket ssl) throws IOException {
hostnameverifier.verify(host, ssl.getSession());
}
};
}
@Override
public void configure(KeyManager[] km, TrustManager[] tm,
SecureRandom random) throws KeyManagementException {
getSSLContext().init(km, tm, random);

View File

@ -55,10 +55,12 @@
* @since 3.3
*/
public class HttpClientConnectionFactory implements HttpConnectionFactory {
@Override
public HttpConnection create(URL url) throws IOException {
return new HttpClientConnection(url.toString());
}
@Override
public HttpConnection create(URL url, Proxy proxy)
throws IOException {
return new HttpClientConnection(url.toString(), proxy);

View File

@ -78,25 +78,30 @@ public TemporaryBuffer getBuffer() {
return buffer;
}
@Override
public boolean isRepeatable() {
return true;
}
@Override
public long getContentLength() {
if (contentLength != null)
return contentLength.intValue();
return buffer.length();
}
@Override
public InputStream getContent() throws IOException, IllegalStateException {
return buffer.openInputStream();
}
@Override
public void writeTo(OutputStream outstream) throws IOException {
// TODO: dont we need a progressmonitor
buffer.writeTo(outstream, null);
}
@Override
public boolean isStreaming() {
return false;
}

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -70,14 +70,17 @@ class AsIsFileFilter implements Filter {
this.asIs = getAnyFile;
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;

View File

@ -174,18 +174,22 @@ public void addReceivePackFilter(Filter filter) {
@Override
public void init(final ServletConfig config) throws ServletException {
gitFilter.init(new FilterConfig() {
@Override
public String getFilterName() {
return gitFilter.getClass().getName();
}
@Override
public String getInitParameter(String name) {
return config.getInitParameter(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
return config.getInitParameterNames();
}
@Override
public ServletContext getServletContext() {
return config.getServletContext();
}

View File

@ -60,6 +60,7 @@
class InfoPacksServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
sendPlainText(packList(req), req, rsp);

View File

@ -64,6 +64,7 @@
class InfoRefsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
// Assume a dumb client and send back the dumb client

View File

@ -66,14 +66,17 @@
* downstream servlet can directly access its contents on disk.
*/
class IsLocalFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (isLocal(getRepository(request)))

View File

@ -59,14 +59,17 @@
/** Adds HTTP response headers to prevent caching by proxies/browsers. */
class NoCacheFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse rsp = (HttpServletResponse) response;

View File

@ -130,6 +130,7 @@ static class Factory implements Filter {
this.receivePackFactory = receivePackFactory;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
@ -153,10 +154,12 @@ public void doFilter(ServletRequest request, ServletResponse response,
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// Nothing.
}
@Override
public void destroy() {
// Nothing.
}

View File

@ -100,14 +100,17 @@ public RepositoryFilter(final RepositoryResolver<HttpServletRequest> resolver) {
this.resolver = resolver;
}
@Override
public void init(final FilterConfig config) throws ServletException {
context = config.getServletContext();
}
@Override
public void destroy() {
context = null;
}
@Override
public void doFilter(final ServletRequest request,
final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {

View File

@ -95,6 +95,7 @@ protected OutputStream overflow() throws IOException {
return out;
}
@Override
public void close() throws IOException {
super.close();

View File

@ -80,14 +80,17 @@ abstract class SmartServiceInfoRefs implements Filter {
this.filters = filters.toArray(new Filter[filters.size()]);
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
@ -154,6 +157,7 @@ protected abstract void advertise(HttpServletRequest req,
private class Chain implements FilterChain {
private int filterIdx;
@Override
public void doFilter(ServletRequest req, ServletResponse rsp)
throws IOException, ServletException {
if (filterIdx < filters.length)

View File

@ -68,6 +68,7 @@ class TextFileServlet extends HttpServlet {
this.fileName = name;
}
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
try {

View File

@ -129,6 +129,7 @@ static class Factory implements Filter {
this.uploadPackFactory = uploadPackFactory;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
@ -152,10 +153,12 @@ public void doFilter(ServletRequest request, ServletResponse response,
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// Nothing.
}
@Override
public void destroy() {
// Nothing.
}

View File

@ -128,10 +128,12 @@ public ServletBinder serveRegex(Pattern pattern) {
return register(new RegexPipeline.Binder(pattern));
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
servletContext = filterConfig.getServletContext();
}
@Override
public void destroy() {
if (pipelines != null) {
Set<Object> destroyed = newIdentitySet();
@ -166,6 +168,7 @@ public int size() {
};
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;

View File

@ -123,6 +123,7 @@ public void init(ServletConfig config) throws ServletException {
filter.init(new NoParameterFilterConfig(name, ctx));
}
@Override
public void destroy() {
filter.destroy();
}
@ -131,6 +132,7 @@ public void destroy() {
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
filter.doFilter(req, res, new FilterChain() {
@Override
public void doFilter(ServletRequest request,
ServletResponse response) throws IOException,
ServletException {

View File

@ -59,26 +59,32 @@ final class NoParameterFilterConfig implements FilterConfig {
this.context = context;
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return false;
}
@Override
public String nextElement() {
throw new NoSuchElementException();
}
};
}
@Override
public ServletContext getServletContext() {
return context;
}
@Override
public String getFilterName() {
return filterName;
}

View File

@ -79,14 +79,17 @@ public RegexGroupFilter(final int groupIdx) {
this.groupIdx = groupIdx - 1;
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(final ServletRequest request,
final ServletResponse rsp, final FilterChain chain)
throws IOException, ServletException {

View File

@ -95,6 +95,7 @@ static class Binder extends ServletBinderImpl {
pattern = p;
}
@Override
UrlPipeline create() {
return new RegexPipeline(pattern, getFilters(), getServlet());
}
@ -108,6 +109,7 @@ UrlPipeline create() {
this.pattern = pattern;
}
@Override
boolean match(final HttpServletRequest req) {
final String pathInfo = req.getPathInfo();
return pathInfo != null && pattern.matcher(pathInfo).matches();

View File

@ -61,6 +61,7 @@ abstract class ServletBinderImpl implements ServletBinder {
this.filters = new ArrayList<Filter>();
}
@Override
public ServletBinder through(Filter filter) {
if (filter == null)
throw new NullPointerException(HttpServerText.get().filterMustNotBeNull);
@ -68,6 +69,7 @@ public ServletBinder through(Filter filter) {
return this;
}
@Override
public void with(HttpServlet servlet) {
if (servlet == null)
throw new NullPointerException(HttpServerText.get().servletMustNotBeNull);

View File

@ -71,6 +71,7 @@ static class Binder extends ServletBinderImpl {
this.suffix = suffix;
}
@Override
UrlPipeline create() {
return new SuffixPipeline(suffix, getFilters(), getServlet());
}
@ -87,6 +88,7 @@ UrlPipeline create() {
this.suffixLen = suffix.length();
}
@Override
boolean match(final HttpServletRequest req) {
final String pathInfo = req.getPathInfo();
return pathInfo != null && pathInfo.endsWith(suffix);

View File

@ -121,26 +121,32 @@ private static void initServlet(final HttpServlet ref,
throws ServletException {
if (!inited.contains(ref)) {
ref.init(new ServletConfig() {
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return false;
}
@Override
public String nextElement() {
throw new NoSuchElementException();
}
};
}
@Override
public ServletContext getServletContext() {
return context;
}
@Override
public String getServletName() {
return ref.getClass().getName();
}
@ -229,6 +235,7 @@ private static class Chain implements FilterChain {
this.servlet = servlet;
}
@Override
public void doFilter(ServletRequest req, ServletResponse rsp)
throws IOException, ServletException {
if (filterIdx < filters.length)

View File

@ -72,6 +72,7 @@ public void access(HttpServletRequest req, Repository db)
};
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}

View File

@ -69,6 +69,7 @@
public class DefaultReceivePackFactory implements
ReceivePackFactory<HttpServletRequest> {
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}
@ -85,6 +86,7 @@ private static class ServiceConfig {
}
}
@Override
public ReceivePack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
final ServiceConfig cfg = db.getConfig().get(CONFIG);

View File

@ -62,6 +62,7 @@
public class DefaultUploadPackFactory implements
UploadPackFactory<HttpServletRequest> {
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}
@ -75,6 +76,7 @@ private static class ServiceConfig {
}
}
@Override
public UploadPack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
if (db.getConfig().get(CONFIG).enabled)

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -80,6 +80,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
private URIish remoteURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -90,6 +91,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -102,6 +104,7 @@ public Repository open(HttpServletRequest req, String name)
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {

View File

@ -64,6 +64,7 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
private AsIsFileService service;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -71,6 +71,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
private ReceivePackFactory<HttpServletRequest> factory;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -69,6 +69,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
private UploadPackFactory<HttpServletRequest> factory;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -109,6 +109,7 @@ public DumbClientDumbServerTest(HttpConnectionFactory cf) {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -114,6 +114,7 @@ public DumbClientSmartServerTest(HttpConnectionFactory cf) {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -124,6 +125,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

View File

@ -107,6 +107,7 @@ public class GitServletResponseTests extends HttpTestCase {
* configure the maximum pack file size, the object checker and custom hooks
* just before they talk to the server.
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -117,6 +118,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -129,6 +131,7 @@ public Repository open(HttpServletRequest req, String name)
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
@ -270,6 +273,7 @@ public void testUnpackErrorWithSubsequentExceptionInPostReceiveHook()
// this PostReceiveHook when called after an unsuccesfull unpack will
// lead to an IllegalStateException
postHook = new PostReceiveHook() {
@Override
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
// the maxPackSize setting caused that the packfile couldn't be

View File

@ -88,6 +88,7 @@ public class HookMessageTest extends HttpTestCase {
private URIish remoteURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -98,6 +99,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -110,11 +112,13 @@ public Repository open(HttpServletRequest req, String name)
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db);
recv.setPreReceiveHook(new PreReceiveHook() {
@Override
public void onPreReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
rp.sendMessage("message line 1");

View File

@ -94,6 +94,7 @@ public class HttpClientTests extends HttpTestCase {
private URIish smartAuthBasicURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -132,6 +133,7 @@ private ServletContextHandler dumb(final String path) {
private ServletContextHandler smart(final String path) {
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

View File

@ -83,6 +83,7 @@ public class MeasurePackSizeTest extends HttpTestCase {
long packSize = -1;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -93,6 +94,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -105,12 +107,14 @@ public Repository open(HttpServletRequest req, String name)
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db);
recv.setPostReceiveHook(new PostReceiveHook() {
@Override
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
packSize = rp.getPackSize();

View File

@ -84,6 +84,7 @@ public class ProtocolErrorTest extends HttpTestCase {
private RevBlob a_blob;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -94,6 +95,7 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

View File

@ -93,12 +93,14 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res)
}
}
@Override
@Before
public void setUp() throws Exception {
server = new AppServer();
ctx = server.addContext("/");
}
@Override
@After
public void tearDown() throws Exception {
server.tearDown();

View File

@ -77,6 +77,7 @@ public class SetAdditionalHeadersTest extends HttpTestCase {
private RevCommit A, B;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -147,6 +147,7 @@ public SmartClientSmartServerTest(HttpConnectionFactory cf) {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -193,6 +194,7 @@ private ServletContextHandler addBrokenContext(GitServlet gs, TestRepository<Rep
ServletContextHandler broken = server.addContext("/bad");
broken.addFilter(new FilterHolder(new Filter() {
@Override
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain)
throws IOException, ServletException {
@ -204,11 +206,13 @@ public void doFilter(ServletRequest request,
w.close();
}
@Override
public void init(FilterConfig filterConfig)
throws ServletException {
// empty
}
@Override
public void destroy() {
// empty
}
@ -831,6 +835,7 @@ private TestRepoResolver(TestRepository<Repository> repo,
this.repoName = repoName;
}
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException, ServiceNotEnabledException {
if (!name.equals(repoName))

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -153,6 +153,7 @@ public String getResponseHeader(String name) {
return responseHeaders.get(name);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append(method);

View File

@ -184,7 +184,6 @@ protected UserPrincipal loadUserInfo(String name) {
return new UserPrincipal(username,
Credential.getCredential(Crypt.crypt(username, password)));
}
}
private void auth(ServletContextHandler ctx, Authenticator authType) {

View File

@ -74,11 +74,13 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase {
/** In-memory application server; subclass must start. */
protected AppServer server;
@Override
public void setUp() throws Exception {
super.setUp();
server = new AppServer();
}
@Override
public void tearDown() throws Exception {
server.tearDown();
super.tearDown();

View File

@ -58,27 +58,33 @@ public void setInitParameter(String name, String value) {
parameters.put(name, value);
}
@Override
public String getInitParameter(String name) {
return parameters.get(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
final Iterator<String> i = parameters.keySet().iterator();
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return i.hasNext();
}
@Override
public String nextElement() {
return i.next();
}
};
}
@Override
public String getServletName() {
return "MOCK_SERVLET";
}
@Override
public ServletContext getServletContext() {
return null;
}

View File

@ -95,10 +95,12 @@ public RecordingLogger(final String name) {
this.name = name;
}
@Override
public Logger getLogger(@SuppressWarnings("hiding") String name) {
return new RecordingLogger(name);
}
@Override
public String getName() {
return name;
}
@ -109,6 +111,7 @@ public void warn(String msg, Object arg0, Object arg1) {
}
}
@Override
public void warn(String msg, Throwable th) {
synchronized (warnings) {
warnings.add(new Warning(msg, th));
@ -127,6 +130,7 @@ public void debug(@SuppressWarnings("unused") String msg,
// Ignore (not relevant to test failures)
}
@Override
public void debug(String msg, Throwable th) {
// Ignore (not relevant to test failures)
}
@ -145,14 +149,17 @@ public void info(@SuppressWarnings("unused") String msg) {
// Ignore (not relevant to test failures)
}
@Override
public boolean isDebugEnabled() {
return false;
}
@Override
public void setDebugEnabled(boolean enabled) {
// Ignore (not relevant to test failures)
}
@Override
public void warn(String msg, Object... args) {
synchronized (warnings) {
warnings.add(new Warning(
@ -160,32 +167,39 @@ public void warn(String msg, Object... args) {
}
}
@Override
public void warn(Throwable thrown) {
synchronized (warnings) {
warnings.add(new Warning(thrown));
}
}
@Override
public void info(String msg, Object... args) {
// Ignore (not relevant to test failures)
}
@Override
public void info(Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void info(String msg, Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void debug(String msg, Object... args) {
// Ignore (not relevant to test failures)
}
@Override
public void debug(Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void ignore(Throwable arg0) {
// Ignore (not relevant to test failures)
}

View File

@ -92,6 +92,7 @@ public URIish getUri() {
private ServletContextHandler smart(final String path) {
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -130,6 +130,7 @@ public CleanFilter(Repository db, InputStream in, OutputStream out)
this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath());
}
@Override
public int run() throws IOException {
try {
byte[] buf = new byte[8192];

View File

@ -171,6 +171,7 @@ public final int getByte(int index) {
* @return &lt; 0 if this id comes before other; 0 if this id is equal to
* other; &gt; 0 if this id comes after other.
*/
@Override
public final int compareTo(final AnyLongObjectId other) {
if (this == other)
return 0;
@ -262,6 +263,7 @@ public boolean startsWith(final AbbreviatedLongObjectId abbr) {
return abbr.prefixCompare(this) == 0;
}
@Override
public final int hashCode() {
return (int) (w1 >> 32);
}
@ -277,6 +279,7 @@ public final boolean equals(final AnyLongObjectId other) {
return other != null ? equals(this, other) : false;
}
@Override
public final boolean equals(final Object o) {
if (o instanceof AnyLongObjectId)
return equals((AnyLongObjectId) o);

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -127,6 +127,7 @@ protected File writeTrashFile(final String name, final String data)
return JGitTestUtil.writeTrashFile(db, name, data);
}
@Override
protected String read(final File file) throws IOException {
return JGitTestUtil.read(file);
}

View File

@ -156,6 +156,7 @@ PrintWriter createErrorWriter() {
return new PrintWriter(result.err);
}
@Override
void init(final TextBuiltin cmd) throws IOException {
cmd.outs = result.out;
cmd.errs = result.err;

View File

@ -706,6 +706,7 @@ private static Future<Object> writeAsync(final OutputStream stream, final byte[]
ExecutorService executor = Executors.newSingleThreadExecutor();
return executor.submit(new Callable<Object>() {
@Override
public Object call() throws IOException {
try {
stream.write(data);

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -110,6 +110,7 @@ public static CommandRef[] common() {
private static CommandRef[] toSortedArray(final Collection<CommandRef> c) {
final CommandRef[] r = c.toArray(new CommandRef[c.size()]);
Arrays.sort(r, new Comparator<CommandRef>() {
@Override
public int compare(final CommandRef o1, final CommandRef o2) {
return o1.getName().compareTo(o2.getName());
}

View File

@ -88,6 +88,7 @@ public void windowClosing(final WindowEvent e) {
final JButton repaint = new JButton();
repaint.setText(CLIText.get().repaint);
repaint.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graphPane.repaint();
}

View File

@ -76,6 +76,7 @@ protected void run() throws Exception {
.setTimeout(timeout).setHeads(heads).setTags(tags);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
@Override
public int compare(Ref r1, Ref r2) {
return r1.getName().compareTo(r2.getName());
}

View File

@ -84,12 +84,14 @@
class DiffAlgorithms extends TextBuiltin {
final Algorithm myers = new Algorithm() {
@Override
DiffAlgorithm create() {
return MyersDiff.INSTANCE;
}
};
final Algorithm histogram = new Algorithm() {
@Override
DiffAlgorithm create() {
HistogramDiff d = new HistogramDiff();
d.setFallbackAlgorithm(null);
@ -98,6 +100,7 @@ DiffAlgorithm create() {
};
final Algorithm histogram_myers = new Algorithm() {
@Override
DiffAlgorithm create() {
HistogramDiff d = new HistogramDiff();
d.setFallbackAlgorithm(MyersDiff.INSTANCE);
@ -234,6 +237,7 @@ private void run(Repository repo) throws Exception {
}
Collections.sort(all, new Comparator<Test>() {
@Override
public int compare(Test a, Test b) {
int result = Long.signum(a.runningTimeNanos - b.runningTimeNanos);
if (result == 0) {

View File

@ -219,6 +219,7 @@ protected boolean requiresRepository() {
return false;
}
@Override
protected void run() throws Exception {
AppServer server = new AppServer(port);
URI baseURI = server.getURI();

View File

@ -85,6 +85,7 @@ protected void run() throws Exception {
static enum Format {
/** */
USAGE {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
String usage = c.getUsage();
if (usage != null && usage.length() > 0)
@ -94,6 +95,7 @@ void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
/** */
CLASSES {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
err.print(c.getImplementationClassName());
}
@ -101,6 +103,7 @@ void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
/** */
URLS {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
final ClassLoader ldr = c.getImplementationClassLoader();

View File

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

View File

@ -1074,30 +1074,37 @@ public void testExecutableRetention() throws Exception {
FS executableFs = new FS() {
@Override
public boolean supportsExecute() {
return true;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return true;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
try {
return read(f).startsWith("binary:");

View File

@ -79,6 +79,7 @@ public void setup() {
ArchiveCommand.registerFormat(format.SUFFIXES.get(0), format);
}
@Override
@After
public void tearDown() {
ArchiveCommand.unregisterFormat(format.SUFFIXES.get(0));

View File

@ -64,6 +64,7 @@
public class CleanCommandTest extends RepositoryTestCase {
private Git git;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -85,6 +85,7 @@ public class CloneCommandTest extends RepositoryTestCase {
private TestRepository<Repository> tr;
@Override
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);

View File

@ -92,30 +92,37 @@ public void testExecutableRetention() throws Exception {
FS executableFs = new FS() {
@Override
public boolean supportsExecute() {
return true;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return true;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
return true;
}
@ -137,30 +144,37 @@ public boolean isCaseSensitive() {
FS nonExecutableFs = new FS() {
@Override
public boolean supportsExecute() {
return false;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return false;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
return false;
}

View File

@ -623,6 +623,7 @@ private void setupGitAndDoHardReset(AutoCRLF autoCRLF, EOL eol,
for (int i = 0; i < dc.getEntryCount(); i++) {
editor.add(new DirCacheEditor.PathEdit(
dc.getEntry(i).getPathString()) {
@Override
public void apply(DirCacheEntry ent) {
ent.smudgeRacilyClean();
}

View File

@ -58,6 +58,7 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
private Git git;
@Override
public void setUp() throws Exception {
super.setUp();
git = new Git(db);

View File

@ -346,6 +346,7 @@ private enum TestPullMode {
/** global rebase config should be respected */
public void testPullWithRebasePreserve1Config() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "preserve");
@ -360,6 +361,7 @@ public PullResult call() throws Exception {
/** the branch-local config should win over the global config */
public void testPullWithRebasePreserveConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "false");
@ -375,6 +377,7 @@ public PullResult call() throws Exception {
/** the branch-local config should be respected */
public void testPullWithRebasePreserveConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("branch", "master", "rebase", "preserve");
@ -389,6 +392,7 @@ public PullResult call() throws Exception {
/** global rebase config should be respected */
public void testPullWithRebaseConfig1() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "true");
@ -403,6 +407,7 @@ public PullResult call() throws Exception {
/** the branch-local config should win over the global config */
public void testPullWithRebaseConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "preserve");
@ -418,6 +423,7 @@ public PullResult call() throws Exception {
/** the branch-local config should be respected */
public void testPullWithRebaseConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("branch", "master", "rebase", "true");
@ -432,6 +438,7 @@ public PullResult call() throws Exception {
/** without config it should merge */
public void testPullWithoutConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
return target.pull().call();
}
@ -443,6 +450,7 @@ public PullResult call() throws Exception {
/** the branch local config should win over the global config */
public void testPullWithMergeConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "true");
@ -458,6 +466,7 @@ public PullResult call() throws Exception {
/** the branch local config should win over the global config */
public void testPullWithMergeConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "false");

View File

@ -2269,11 +2269,13 @@ public void testRebaseShouldNotFailIfUserAddCommentLinesInPrepareSteps()
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.add(0, new RebaseTodoLine(
"# Comment that should not be processed"));
}
@Override
public String modifyCommitMessage(String commit) {
fail("modifyCommitMessage() was not expected to be called");
return commit;
@ -2284,6 +2286,7 @@ public String modifyCommitMessage(String commit) {
RebaseResult res2 = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
// delete RevCommit c4
@ -2293,6 +2296,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("modifyCommitMessage() was not expected to be called");
return commit;
@ -2514,6 +2518,7 @@ public void testRebaseInteractiveReword() throws Exception {
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.REWORD);
@ -2522,6 +2527,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -2560,6 +2566,7 @@ public void testRebaseInteractiveEdit() throws Exception {
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -2568,6 +2575,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return ""; // not used
}
@ -2624,6 +2632,7 @@ public void testRebaseInteractiveSingleSquashAndModifyMessage() throws Exception
git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.SQUASH);
@ -2632,6 +2641,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db
.getDirectory(), "rebase-merge/message-squash");
@ -2704,6 +2714,7 @@ public void testRebaseInteractiveMultipleSquash() throws Exception {
git.rebase().setUpstream("HEAD~4")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.SQUASH);
@ -2713,6 +2724,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db.getDirectory(),
"rebase-merge/message-squash");
@ -2786,6 +2798,7 @@ public void testRebaseInteractiveMixedSquashAndFixup() throws Exception {
git.rebase().setUpstream("HEAD~4")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2795,6 +2808,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db
.getDirectory(), "rebase-merge/message-squash");
@ -2861,6 +2875,7 @@ public void testRebaseInteractiveSingleFixup() throws Exception {
git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2869,6 +2884,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("No callback to modify commit message expected for single fixup");
return commit;
@ -2910,6 +2926,7 @@ public void testRebaseInteractiveFixupWithBlankLines() throws Exception {
git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2918,6 +2935,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("No callback to modify commit message expected for single fixup");
return commit;
@ -2950,6 +2968,7 @@ public void testRebaseInteractiveFixupFirstCommitShouldFail()
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.FIXUP);
@ -2958,6 +2977,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -2982,6 +3002,7 @@ public void testRebaseInteractiveSquashFirstCommitShouldFail()
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.SQUASH);
@ -2990,6 +3011,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3013,6 +3035,7 @@ public void testRebaseEndsIfLastStepIsEdit() throws Exception {
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -3021,6 +3044,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3055,6 +3079,7 @@ public void testRebaseShouldStopForEditInCaseOfConflict()
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3064,6 +3089,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3097,6 +3123,7 @@ public void testRebaseShouldStopForRewordInCaseOfConflict()
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3106,6 +3133,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -3114,6 +3142,7 @@ public String modifyCommitMessage(String commit) {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3123,6 +3152,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -3160,6 +3190,7 @@ public void testRebaseShouldSquashInCaseOfConflict() throws Exception {
RebaseResult result = git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3170,6 +3201,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "squashed message";
}
@ -3178,6 +3210,7 @@ public String modifyCommitMessage(String commit) {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3188,6 +3221,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "squashed message";
}
@ -3226,6 +3260,7 @@ public void testRebaseShouldFixupInCaseOfConflict() throws Exception {
RebaseResult result = git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3236,6 +3271,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3244,6 +3280,7 @@ public String modifyCommitMessage(String commit) {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3254,6 +3291,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "commit";
}
@ -3297,6 +3335,7 @@ public void testInteractiveRebaseWithModificationShouldNotDeleteDataOnAbort()
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -3306,6 +3345,7 @@ public void prepareSteps(List<RebaseTodoLine> steps) {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}

View File

@ -69,6 +69,7 @@ public class RenameBranchCommandTest extends RepositoryTestCase {
private Git git;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -77,6 +77,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
private File committedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -82,6 +82,7 @@ public class StashCreateCommandTest extends RepositoryTestCase {
private File untrackedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -73,6 +73,7 @@ public class StashDropCommandTest extends RepositoryTestCase {
private File committedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -395,6 +395,7 @@ public void shouldReportFileModeChange() throws Exception {
assertTrue(walk.next());
editor.add(new PathEdit("a.txt") {
@Override
public void apply(DirCacheEntry ent) {
ent.setFileMode(FileMode.EXECUTABLE_FILE);
ent.setObjectId(walk.getObjectId(0));

View File

@ -211,6 +211,7 @@ final class ReceivedEventMarkerException extends RuntimeException {
DirCache dc = db.lockDirCache();
IndexChangedListener listener = new IndexChangedListener() {
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}
@ -238,6 +239,7 @@ public void onIndexChanged(IndexChangedEvent event) {
dc = db.lockDirCache();
listener = new IndexChangedListener() {
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}

View File

@ -56,6 +56,7 @@ public void testFileRepository_ChangeEventsOnlyOnSave() throws Exception {
final ConfigChangedEvent[] events = new ConfigChangedEvent[1];
db.getListenerList().addConfigChangedListener(
new ConfigChangedListener() {
@Override
public void onConfigChanged(ConfigChangedEvent event) {
events[0] = event;
}

View File

@ -79,6 +79,7 @@ public class RepoCommandTest extends RepositoryTestCase {
private ObjectId oldCommitId;
@Override
public void setUp() throws Exception {
super.setUp();

View File

@ -81,6 +81,7 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
private TestRepository<Repository> test;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -89,6 +90,7 @@ public void setUp() throws Exception {
test = new TestRepository<Repository>(db);
}
@Override
@After
public void tearDown() throws Exception {
if (reader != null) {

View File

@ -77,6 +77,7 @@
import org.junit.Test;
public class ConcurrentRepackTest extends RepositoryTestCase {
@Override
@Before
public void setUp() throws Exception {
WindowCacheConfig windowCacheConfig = new WindowCacheConfig();
@ -85,6 +86,7 @@ public void setUp() throws Exception {
super.setUp();
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();

View File

@ -68,6 +68,7 @@ public void concurrentRepack() throws Exception {
class DoRepack extends EmptyProgressMonitor implements
Callable<Integer> {
@Override
public void beginTask(String title, int totalWork) {
if (title.equals(JGitText.get().writingObjects)) {
try {
@ -81,6 +82,7 @@ public void beginTask(String title, int totalWork) {
}
/** @return 0 for success, 1 in case of error when writing pack */
@Override
public Integer call() throws Exception {
try {
gc.setProgressMonitor(this);

View File

@ -105,6 +105,7 @@ public void concurrentOnlyOneWritesPackedRefs() throws Exception {
Callable<Integer> packRefs = new Callable<Integer>() {
/** @return 0 for success, 1 in case of error when writing pack */
@Override
public Integer call() throws Exception {
syncPoint.await();
try {
@ -158,6 +159,7 @@ public void whileRefUpdatedRefUpdateSucceeds()
try {
Future<Result> result = pool.submit(new Callable<Result>() {
@Override
public Result call() throws Exception {
RefUpdate update = new RefDirectoryUpdate(
(RefDirectory) repo.getRefDatabase(),
@ -182,6 +184,7 @@ public boolean isForceUpdate() {
});
pool.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
refUpdateLockedRef.await();
gc.packRefs();

View File

@ -62,6 +62,7 @@ public abstract class GcTestCase extends LocalDiskRepositoryTestCase {
protected GC gc;
protected RepoStatistics stats;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -71,6 +72,7 @@ public void setUp() throws Exception {
gc = new GC(repo);
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();

View File

@ -218,6 +218,7 @@ public void testShallowFileCorrupt()
private Collection<Callable<ObjectId>> blobInsertersForTheSameFanOutDir(
final ObjectDirectory dir) {
Callable<ObjectId> callable = new Callable<ObjectId>() {
@Override
public ObjectId call() throws Exception {
return dir.newInserter().insert(Constants.OBJ_BLOB, new byte[0]);
}

View File

@ -107,6 +107,7 @@ private TestRng getRng() {
return rng;
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -120,6 +121,7 @@ public void setUp() throws Exception {
wc = (WindowCursor) repo.newObjectReader();
}
@Override
@After
public void tearDown() throws Exception {
if (wc != null)

View File

@ -62,6 +62,7 @@ public abstract class PackIndexTestCase extends RepositoryTestCase {
PackIndex denseIdx;
@Override
public void setUp() throws Exception {
super.setUp();
smallIdx = PackIndex.open(getFileForPack34be9032());

View File

@ -65,6 +65,7 @@ public class PackReverseIndexTest extends RepositoryTestCase {
/**
* Set up tested class instance, test constructor by the way.
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();

View File

@ -131,6 +131,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private RevCommit c5;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -143,6 +144,7 @@ public void setUp() throws Exception {
write(alt, db.getObjectDatabase().getDirectory().getAbsolutePath() + "\n");
}
@Override
@After
public void tearDown() throws Exception {
if (writer != null) {
@ -882,6 +884,7 @@ private void verifyObjectsOrder(final ObjectId objectsOrder[]) {
entries.add(me.cloneEntry());
}
Collections.sort(entries, new Comparator<PackIndex.MutableEntry>() {
@Override
public int compare(MutableEntry o1, MutableEntry o2) {
return Long.signum(o1.getOffset() - o2.getOffset());
}

View File

@ -100,6 +100,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
private RevTag v1_0;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -547,6 +548,7 @@ public void testGetRefs_LooseSorting_Bug_348834() throws IOException {
ListenerHandle listener = Repository.getGlobalListenerList()
.addRefsChangedListener(new RefsChangedListener() {
@Override
public void onRefsChanged(RefsChangedEvent event) {
count[0]++;
}
@ -1271,6 +1273,7 @@ public void testRefsChangedStackOverflow() throws Exception {
newRepo.getListenerList().addRefsChangedListener(
new RefsChangedListener() {
@Override
public void onRefsChanged(RefsChangedEvent event) {
try {
refDb.getRefs("ref");
@ -1440,23 +1443,28 @@ private void deleteLooseRef(String name) {
private static final class StrictWorkMonitor implements ProgressMonitor {
private int lastWork, totalWork;
@Override
public void start(int totalTasks) {
// empty
}
@Override
public void beginTask(String title, int total) {
this.totalWork = total;
lastWork = 0;
}
@Override
public void update(int completed) {
lastWork += completed;
}
@Override
public void endTask() {
assertEquals("Units of work recorded", totalWork, lastWork);
}
@Override
public boolean isCancelled() {
return false;
}

Some files were not shown because too many files have changed in this diff Show More