diff options
Diffstat (limited to 'sonar-plugin-api/src/main/java')
10 files changed, 47 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; } |