diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-01-16 14:39:32 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2017-02-19 20:05:08 -0400 |
commit | 7ac182f4e427e0d5a986b8ca67a56fc22828b1a0 (patch) | |
tree | 7a63f64443cd919e361d7de747ef31ffa5bd6279 /org.eclipse.jgit.junit.http | |
parent | 5e8e2179b218ede7d14b69dc5149b0691b5859cf (diff) | |
download | jgit-7ac182f4e427e0d5a986b8ca67a56fc22828b1a0.tar.gz jgit-7ac182f4e427e0d5a986b8ca67a56fc22828b1a0.zip |
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>
Diffstat (limited to 'org.eclipse.jgit.junit.http')
7 files changed, 25 insertions, 2 deletions
diff --git a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs index 10c29d5576..47cca36924 100644 --- a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java index aaccc66f55..6580ade8ea 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java @@ -153,6 +153,7 @@ public class AccessEvent { return responseHeaders.get(name); } + @Override public String toString() { StringBuilder b = new StringBuilder(); b.append(method); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java index 09754317ed..1575cb650c 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java @@ -184,7 +184,6 @@ public class AppServer { return new UserPrincipal(username, Credential.getCredential(Crypt.crypt(username, password))); } - } private void auth(ServletContextHandler ctx, Authenticator authType) { diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java index ab5d3e1d90..5db76eb7b9 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java @@ -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(); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java index 59765890bd..4f11ea8fca 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java @@ -58,27 +58,33 @@ public class MockServletConfig implements ServletConfig { 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; } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java index c7545a94b4..5fed122637 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java @@ -95,10 +95,12 @@ public class RecordingLogger implements Logger { 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 class RecordingLogger implements Logger { } } + @Override public void warn(String msg, Throwable th) { synchronized (warnings) { warnings.add(new Warning(msg, th)); @@ -127,6 +130,7 @@ public class RecordingLogger implements Logger { // 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 class RecordingLogger implements Logger { // 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 class RecordingLogger implements Logger { } } + @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) } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java index e550e6c567..605c69a844 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java @@ -92,6 +92,7 @@ public class SimpleHttpServer { 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 { |