aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-04-27 17:05:35 +0200
committerDavid Gageot <david@gageot.net>2012-04-27 17:05:35 +0200
commitb150482f1f4ea43bc42b324994d1d1e852de6320 (patch)
tree4638118d9a32405ad844c127f38e381d9ef37ae8 /sonar-plugin-api
parent328e826a6a151128783ee7a3939e206202c6a990 (diff)
downloadsonarqube-b150482f1f4ea43bc42b324994d1d1e852de6320.tar.gz
sonarqube-b150482f1f4ea43bc42b324994d1d1e852de6320.zip
Code cleaning : Add @Override annotations
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/Base64Cipher.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java1
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/FakeServlet.java1
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/RedirectServlet.java1
13 files changed, 51 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
index 7916319e88b..b673cf8537a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java
@@ -64,6 +64,7 @@ public final class AnnotationCheckFactory extends CheckFactory {
}
}
+ @Override
protected Object createCheck(ActiveRule activeRule) {
Object object = checksByKey.get(activeRule.getConfigKey());
if (object != null) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Base64Cipher.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Base64Cipher.java
index a04b40e953b..222724e8c1e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/Base64Cipher.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/Base64Cipher.java
@@ -22,10 +22,12 @@ package org.sonar.api.config;
import org.apache.commons.codec.binary.Base64;
final class Base64Cipher extends Cipher {
+ @Override
String encrypt(String clearText) {
return new String(Base64.encodeBase64(clearText.getBytes()));
}
+ @Override
String decrypt(String encryptedText) {
return new String(Base64.decodeBase64(encryptedText));
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
index ef8d85d630f..9a44724c909 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
@@ -42,34 +42,42 @@ public class Directory extends Resource {
this.language = language;
}
+ @Override
public String getName() {
return getKey();
}
+ @Override
public String getLongName() {
return null;
}
+ @Override
public String getDescription() {
return null;
}
+ @Override
public Language getLanguage() {
return language;
}
+ @Override
public String getScope() {
return Scopes.DIRECTORY;
}
+ @Override
public String getQualifier() {
return Qualifiers.DIRECTORY;
}
+ @Override
public Resource getParent() {
return null;
}
+ @Override
public boolean matchFilePattern(String antPattern) {
WildcardPattern matcher = WildcardPattern.create(antPattern, "/");
return matcher.match(getKey());
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
index b547f72559a..eaa8090bfd7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
@@ -96,6 +96,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#getParent()
*/
+ @Override
public Directory getParent() {
if (parent == null) {
parent = new Directory(directoryKey);
@@ -118,6 +119,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#matchFilePattern(String)
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
WildcardPattern matcher = WildcardPattern.create(antPattern, "/");
return matcher.match(getKey());
@@ -146,6 +148,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#getName()
*/
+ @Override
public String getName() {
return filename;
}
@@ -155,6 +158,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#getLongName()
*/
+ @Override
public String getLongName() {
return getKey();
}
@@ -164,6 +168,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#getDescription()
*/
+ @Override
public String getDescription() {
return null;
}
@@ -173,6 +178,7 @@ public class File extends Resource<Directory> {
*
* @see Resource#getLanguage()
*/
+ @Override
public Language getLanguage() {
return language;
}
@@ -187,6 +193,7 @@ public class File extends Resource<Directory> {
/**
* @return SCOPE_ENTITY
*/
+ @Override
public final String getScope() {
return SCOPE;
}
@@ -196,6 +203,7 @@ public class File extends Resource<Directory> {
*
* @return QUALIFIER_UNIT_TEST_CLASS
*/
+ @Override
public String getQualifier() {
return qualifier;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
index 634c5c96c20..cd142ae6ce2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
@@ -105,6 +105,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* {@inheritDoc}
*/
+ @Override
public JavaPackage getParent() {
if (parent == null) {
parent = new JavaPackage(packageKey);
@@ -116,6 +117,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* @return null
*/
+ @Override
public String getDescription() {
return null;
}
@@ -123,6 +125,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* @return Java
*/
+ @Override
public Language getLanguage() {
return Java.INSTANCE;
}
@@ -130,6 +133,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* {@inheritDoc}
*/
+ @Override
public String getName() {
return filename;
}
@@ -137,6 +141,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* {@inheritDoc}
*/
+ @Override
public String getLongName() {
return longName;
}
@@ -144,6 +149,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* @return SCOPE_ENTITY
*/
+ @Override
public String getScope() {
return Scopes.FILE;
}
@@ -151,6 +157,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* @return QUALIFIER_UNIT_TEST_CLASS or QUALIFIER_CLASS depending whether it is a unit test class
*/
+ @Override
public String getQualifier() {
return unitTest ? Qualifiers.UNIT_TEST_FILE : Qualifiers.CLASS;
}
@@ -165,6 +172,7 @@ public class JavaFile extends Resource<JavaPackage> {
/**
* {@inheritDoc}
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
if (unitTest) {
return false;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
index 5fb874e88d7..cc2623151e9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
@@ -58,6 +58,7 @@ public class JavaPackage extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
return false;
}
@@ -65,6 +66,7 @@ public class JavaPackage extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public String getDescription() {
return null;
}
@@ -72,6 +74,7 @@ public class JavaPackage extends Resource {
/**
* @return SCOPE_SPACE
*/
+ @Override
public String getScope() {
return Scopes.DIRECTORY;
}
@@ -79,6 +82,7 @@ public class JavaPackage extends Resource {
/**
* @return QUALIFIER_PACKAGE
*/
+ @Override
public String getQualifier() {
return Qualifiers.PACKAGE;
}
@@ -86,6 +90,7 @@ public class JavaPackage extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public String getName() {
return getKey();
}
@@ -93,6 +98,7 @@ public class JavaPackage extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public Resource<?> getParent() {
return null;
}
@@ -100,6 +106,7 @@ public class JavaPackage extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public String getLongName() {
return null;
}
@@ -107,6 +114,7 @@ public class JavaPackage extends Resource {
/**
* @return Java
*/
+ @Override
public Language getLanguage() {
return Java.INSTANCE;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
index 366332d90b4..7edac70d88d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
@@ -154,14 +154,17 @@ public class Project extends Resource {
return packaging;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getLongName() {
return name;
}
+ @Override
public String getDescription() {
return description;
}
@@ -243,6 +246,7 @@ public class Project extends Resource {
/**
* @return the project language
*/
+ @Override
public Language getLanguage() {
return language;
}
@@ -286,6 +290,7 @@ public class Project extends Resource {
/**
* @return the scope of the current object
*/
+ @Override
public String getScope() {
return Scopes.PROJECT;
}
@@ -293,6 +298,7 @@ public class Project extends Resource {
/**
* @return the qualifier of the current object
*/
+ @Override
public String getQualifier() {
return isRoot() ? Qualifiers.PROJECT : Qualifiers.MODULE;
}
@@ -302,6 +308,7 @@ public class Project extends Resource {
return false;
}
+ @Override
public Project getParent() {
return parent;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
index 9b156ffa640..ad2f7642e99 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
@@ -129,6 +129,7 @@ public final class DateUtils {
}
private final ThreadLocal<Reference<DateFormat>> cache = new ThreadLocal<Reference<DateFormat>>() {
+ @Override
public Reference<DateFormat> get() {
Reference<DateFormat> softRef = super.get();
if (softRef == null || softRef.get() == null) {
@@ -143,10 +144,12 @@ public final class DateUtils {
return (DateFormat) ((Reference) cache.get()).get();
}
+ @Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return getDateFormat().format(date, toAppendTo, fieldPosition);
}
+ @Override
public Date parse(String source, ParsePosition pos) {
return getDateFormat().parse(source, pos);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
index ba49b8d0ca5..1f99d62f46a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
@@ -194,6 +194,7 @@ class ProxyAuthenticator extends Authenticator {
auth = new PasswordAuthentication(user, password == null ? new char[0] : password.toCharArray());
}
+ @Override
protected PasswordAuthentication getPasswordAuthentication() {
return auth;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
index b338c48ec3e..4f97cd1ec15 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
@@ -46,6 +46,7 @@ public class LocalizedMessages extends ResourceBundle {
}
}
+ @Override
public Locale getLocale() {
return locale;
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java
index 72978a55d1d..1113ba84c88 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java
@@ -111,6 +111,7 @@ public class DateUtilsTest {
final List<Throwable> throwables = Lists.newArrayList();
final ThreadGroup tg = new ThreadGroup("shouldBeThreadSafe") {
+ @Override
public void uncaughtException(Thread t, Throwable e) {
throwables.add(e);
super.uncaughtException(t, e);
@@ -123,6 +124,7 @@ public class DateUtilsTest {
for (int i = 0; i < threads.length; ++i) {
threads[i] = new Thread(tg, "JUnit Thread " + i) {
+ @Override
public void run() {
int i = 0;
try {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/FakeServlet.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/FakeServlet.java
index 923d952fde1..2e365e71af1 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/FakeServlet.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/FakeServlet.java
@@ -31,6 +31,7 @@ public class FakeServlet extends GenericServlet {
int count = 0;
+ @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
count++;
Properties props = new Properties();
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/RedirectServlet.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/RedirectServlet.java
index 2c403f83a21..ff7a0ded3b7 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/RedirectServlet.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/RedirectServlet.java
@@ -28,6 +28,7 @@ import java.io.IOException;
public class RedirectServlet extends GenericServlet {
+ @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
((HttpServletResponse)response).sendRedirect("/");
}