diff options
author | David Gageot <david@gageot.net> | 2012-04-27 17:05:35 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-04-27 17:05:35 +0200 |
commit | b150482f1f4ea43bc42b324994d1d1e852de6320 (patch) | |
tree | 4638118d9a32405ad844c127f38e381d9ef37ae8 | |
parent | 328e826a6a151128783ee7a3939e206202c6a990 (diff) | |
download | sonarqube-b150482f1f4ea43bc42b324994d1d1e852de6320.tar.gz sonarqube-b150482f1f4ea43bc42b324994d1d1e852de6320.zip |
Code cleaning : Add @Override annotations
57 files changed, 192 insertions, 0 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java index bbcfdc192a7..700f622bb56 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileExporter.java @@ -55,6 +55,7 @@ public class CheckstyleProfileExporter extends ProfileExporter { this(new BaseConfiguration()); } + @Override public void exportProfile(RulesProfile profile, Writer writer) { try { ListMultimap<String, ActiveRule> activeRulesByConfigKey = arrangeByConfigKey(profile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY)); diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SonarWayProfile.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SonarWayProfile.java index d53ae1fb3ec..dc938a32322 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SonarWayProfile.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SonarWayProfile.java @@ -32,6 +32,7 @@ public final class SonarWayProfile extends ProfileDefinition { this.xmlProfileParser = xmlProfileParser; } + @Override public RulesProfile createProfile(ValidationMessages messages) { return xmlProfileParser.parseResource(getClass().getClassLoader(), "org/sonar/plugins/checkstyle/profile-sonar-way.xml", messages); } diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SunConventionsProfile.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SunConventionsProfile.java index 290c368f680..2a926fcfe66 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SunConventionsProfile.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/SunConventionsProfile.java @@ -33,6 +33,7 @@ public final class SunConventionsProfile extends ProfileDefinition { } + @Override public RulesProfile createProfile(ValidationMessages messages) { return xmlProfileParser.parseResource(getClass().getClassLoader(), "org/sonar/plugins/checkstyle/profile-sun-conventions.xml", messages); } diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java index fcbb63f294c..590d6a23ca4 100644 --- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java +++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoAntInitializer.java @@ -87,6 +87,7 @@ public class JacocoAntInitializer extends Initializer implements CoverageExtensi this.taskName = taskName; } + @Override public boolean supportsTask(final Task task) { return taskName.equals(task.getTaskName()); } diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassProviderImpl.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassProviderImpl.java index d57363f00f6..58f2f26b140 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassProviderImpl.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassProviderImpl.java @@ -43,6 +43,7 @@ public class AsmClassProviderImpl extends AsmClassProvider { this.classLoader = classLoader; } + @Override public AsmClass getClass(String internalName, DETAIL_LEVEL level) { if (internalName == null) { throw new IllegalStateException("You can try to load a class whose internalName = 'null'"); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassVisitor.java index c9910f652c0..614e5508c47 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmClassVisitor.java @@ -36,6 +36,7 @@ public class AsmClassVisitor extends EmptyVisitor { this.asmClass = asmClass; } + @Override public void visit(int version, int accessFlags, String internalName, String signature, String superClass, String[] interfaces) { if (asmClass.getDetailLevel() == DETAIL_LEVEL.NOTHING) { asmClass.setAccessFlags(accessFlags); @@ -59,6 +60,7 @@ public class AsmClassVisitor extends EmptyVisitor { } } + @Override public FieldVisitor visitField(int access, String fieldName, String description, String signature, Object value) { AsmField field = asmClass.getFieldOrCreateIt(fieldName); field.setAccessFlags(access); @@ -68,6 +70,7 @@ public class AsmClassVisitor extends EmptyVisitor { return null; } + @Override public MethodVisitor visitMethod(int access, String methodName, String description, String signature, String[] exceptions) { AsmMethod method = asmClass.getMethodOrCreateIt(methodName + description); if (isInheritedMethodSignature(method.getParent(), method.getKey())) { @@ -87,6 +90,7 @@ public class AsmClassVisitor extends EmptyVisitor { return null; } + @Override public void visitEnd() { asmClass.setDetailLevel(level); } diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethodVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethodVisitor.java index c1ba0a0f963..48cbb17beee 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethodVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethodVisitor.java @@ -39,6 +39,7 @@ public class AsmMethodVisitor extends EmptyVisitor { emptyMethod = true; } + @Override public void visitFieldInsn(int opcode, String owner, String fieldName, String fieldDescription) { AsmClass targetClass = asmClassProvider.getClass(owner, DETAIL_LEVEL.NOTHING); AsmField targetField = targetClass.getFieldOrCreateIt(fieldName); @@ -46,6 +47,7 @@ public class AsmMethodVisitor extends EmptyVisitor { emptyMethod = false; } + @Override public void visitMethodInsn(int opcode, String owner, String methodName, String methodDescription) { if (isNotCallToJavaArrayMethod(owner)) { AsmClass targetClass = asmClassProvider.getClass(owner, DETAIL_LEVEL.STRUCTURE); @@ -59,6 +61,7 @@ public class AsmMethodVisitor extends EmptyVisitor { return internalName.charAt(0) != '['; } + @Override public void visitTryCatchBlock(Label start, Label end, Label handler, String exception) { if (exception != null) { AsmClass exceptionClass = asmClassProvider.getClass(exception, DETAIL_LEVEL.NOTHING); @@ -67,42 +70,51 @@ public class AsmMethodVisitor extends EmptyVisitor { emptyMethod = false; } + @Override public void visitTypeInsn(int opcode, String internalName) { AsmClass usedClass = asmClassProvider.getClass(internalName, DETAIL_LEVEL.NOTHING); method.addEdge(new AsmEdge(method, usedClass, SourceCodeEdgeUsage.USES, lineNumber)); emptyMethod = false; } + @Override public void visitLineNumber(final int line, final Label start) { lineNumber = line; } + @Override public void visitEnd() { method.setEmpty(emptyMethod); } + @Override public void visitIincInsn(int var, int increment) { emptyMethod = false; } + @Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { emptyMethod = false; } + @Override public void visitInsn(int opcode) { if (opcode != Opcodes.RETURN) { emptyMethod = false; } } + @Override public void visitIntInsn(int opcode, int operand) { emptyMethod = false; } + @Override public void visitJumpInsn(int opcode, Label label) { emptyMethod = false; } + @Override public void visitLdcInsn(Object cst) { if (cst instanceof Type) { Type type = (Type) cst; @@ -112,18 +124,22 @@ public class AsmMethodVisitor extends EmptyVisitor { emptyMethod = false; } + @Override public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) { emptyMethod = false; } + @Override public void visitMultiANewArrayInsn(String desc, int dims) { emptyMethod = false; } + @Override public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) { emptyMethod = false; } + @Override public void visitVarInsn(int opcode, int var) { emptyMethod = false; } diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DITVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DITVisitor.java index e8fc41a97be..bfdec1cb2bc 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DITVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DITVisitor.java @@ -24,6 +24,7 @@ import org.sonar.squid.measures.Metric; public class DITVisitor extends BytecodeVisitor { + @Override public void visitClass(AsmClass asmClass) { int dit = calculateDepthOfInheritance(asmClass); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DependenciesVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DependenciesVisitor.java index a902560b63a..2c04f4567c6 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DependenciesVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/DependenciesVisitor.java @@ -39,10 +39,12 @@ public class DependenciesVisitor extends BytecodeVisitor { this.graph = graph; } + @Override public void visitClass(AsmClass asmClass) { this.fromSourceClass = getSourceClass(asmClass); } + @Override public void visitEdge(AsmEdge edge) { AsmClass toAsmClass = edge.getTargetAsmClass(); SourceClass toSourceClass = getSourceClass(toAsmClass); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/LCOM4Visitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/LCOM4Visitor.java index f1822741a15..f0c5cc07fe8 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/LCOM4Visitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/LCOM4Visitor.java @@ -40,11 +40,13 @@ public class LCOM4Visitor extends BytecodeVisitor { this.fieldsToExcludeFromLcom4Calculation = conf.getFielsToExcludeFromLcom4Calculation(); } + @Override public void visitClass(AsmClass asmClass) { this.asmClass = asmClass; unrelatedBlocks = new ArrayList<Set<AsmResource>>(); } + @Override public void visitMethod(AsmMethod asmMethod) { if (isMethodElligibleForLCOM4Computation(asmMethod)) { ensureBlockIsCreated(asmMethod); @@ -90,6 +92,7 @@ public class LCOM4Visitor extends BytecodeVisitor { } + @Override public void leaveClass(AsmClass asmClass) { removeIsolatedMethodBlocks(); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/NOCVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/NOCVisitor.java index 91569971123..fe5c8e9d762 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/NOCVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/NOCVisitor.java @@ -24,6 +24,7 @@ import org.sonar.squid.measures.Metric; public class NOCVisitor extends BytecodeVisitor { + @Override public void visitClass(AsmClass asmClass) { getSourceClass(asmClass).add(Metric.NOC, asmClass.getNumberOfChildren()); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/RFCVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/RFCVisitor.java index f99aff343e3..f8a61feb280 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/RFCVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/visitor/RFCVisitor.java @@ -34,18 +34,21 @@ public class RFCVisitor extends BytecodeVisitor { private Set<AsmMethod> distinctCallToExternalMethods; private int rfc = 0; + @Override public void visitClass(AsmClass asmClass) { rfc = 0; this.asmClass = asmClass; distinctCallToExternalMethods = new HashSet<AsmMethod>(); } + @Override public void visitMethod(AsmMethod asmMethod) { if (asmMethod.isBodyLoaded() && !asmMethod.isAccessor()) { rfc++; } } + @Override public void visitEdge(AsmEdge edge) { if (edge.getTargetAsmClass() != asmClass && edge.getUsage() == SourceCodeEdgeUsage.CALLS_METHOD && !((AsmMethod) edge.getTo()).isAccessor()) { @@ -53,6 +56,7 @@ public class RFCVisitor extends BytecodeVisitor { } } + @Override public void leaveClass(AsmClass asmClass) { rfc += distinctCallToExternalMethods.size(); getSourceClass(asmClass).add(Metric.RFC, rfc); diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/CheckMessages.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/CheckMessages.java index 74cb2ed64fa..98743dbd554 100644 --- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/CheckMessages.java +++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/CheckMessages.java @@ -56,6 +56,7 @@ public class CheckMessages { } private static final Ordering<CheckMessage> CHECK_MESSAGE_ORDERING = new Ordering<CheckMessage>() { + @Override public int compare(CheckMessage o1, CheckMessage o2) { return ObjectUtils.compare(o1.getLine(), o2.getLine()); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java index 2e2c83a6204..0ee2dbfe033 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java @@ -66,10 +66,12 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { this(project, languages, def, pom, new FileFilter[0]); } + @Override public File getBasedir() { return def.getBaseDir(); } + @Override public File getBuildDir() { if (pom != null) { return resolvePath(pom.getBuild().getDirectory()); @@ -79,6 +81,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { } } + @Override public File getBuildOutputDir() { if (pom != null) { return resolvePath(pom.getBuild().getOutputDirectory()); @@ -101,6 +104,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { /** * @deprecated since 2.6, because should be immutable */ + @Override @Deprecated public DefaultProjectFileSystem addSourceDir(File dir) { if (dir == null) { @@ -125,6 +129,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { /** * @deprecated since 2.6, because should be immutable */ + @Override @Deprecated public DefaultProjectFileSystem addTestDir(File dir) { if (dir == null) { @@ -140,6 +145,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { /** * TODO Godin: seems that used only by Cobertura and Clover */ + @Override public File getReportOutputDir() { if (pom != null) { return resolvePath(pom.getReporting().getOutputDirectory()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java b/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java index 29bd61449f5..853c308b467 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java +++ b/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java @@ -37,14 +37,17 @@ public class ServerMetadata extends Server { this.settings = settings; } + @Override public String getId() { return settings.getString(CoreProperties.SERVER_ID); } + @Override public String getVersion() { return settings.getString(CoreProperties.SERVER_VERSION); } + @Override public Date getStartedAt() { String dateString = settings.getString(CoreProperties.SERVER_STARTTIME); if (dateString != null) { @@ -58,6 +61,7 @@ public class ServerMetadata extends Server { return null; } + @Override public String getURL() { return StringUtils.removeEnd(StringUtils.defaultIfBlank(settings.getString("sonar.host.url"), "http://localhost:9000"), "/"); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index fdcc3c70610..783bffb6ad9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -95,6 +95,7 @@ public class DefaultIndex extends SonarIndex { } } + @Override public Project getProject() { return currentProject; } @@ -134,6 +135,7 @@ public class DefaultIndex extends SonarIndex { lock.unlock(); } + @Override public Measure getMeasure(Resource resource, Metric metric) { Bucket bucket = buckets.get(resource); if (bucket != null) { @@ -145,6 +147,7 @@ public class DefaultIndex extends SonarIndex { return null; } + @Override public <M> M getMeasures(Resource resource, MeasuresFilter<M> filter) { Bucket bucket = buckets.get(resource); if (bucket != null) { @@ -157,6 +160,7 @@ public class DefaultIndex extends SonarIndex { /** * the measure is updated if it's already registered. */ + @Override public Measure addMeasure(Resource resource, Measure measure) { Bucket bucket = checkIndexed(resource); if (bucket != null && !bucket.isExcluded()) { @@ -182,6 +186,7 @@ public class DefaultIndex extends SonarIndex { // // + @Override public Dependency addDependency(Dependency dependency) { Dependency existingDep = getEdge(dependency.getFrom(), dependency.getTo()); if (existingDep != null) { @@ -230,6 +235,7 @@ public class DefaultIndex extends SonarIndex { incomingDeps.put(dependency.getFrom(), dependency); } + @Override public Set<Dependency> getDependencies() { return dependencies; } @@ -287,6 +293,7 @@ public class DefaultIndex extends SonarIndex { /** * {@inheritDoc} */ + @Override public List<Violation> getViolations(ViolationQuery violationQuery) { Resource resource = violationQuery.getResource(); if (resource == null) { @@ -308,6 +315,7 @@ public class DefaultIndex extends SonarIndex { return filteredViolations; } + @Override public void addViolation(Violation violation, boolean force) { Resource resource = violation.getResource(); if (resource == null) { @@ -362,10 +370,12 @@ public class DefaultIndex extends SonarIndex { // // + @Override public void addLink(ProjectLink link) { persistence.saveLink(currentProject, link); } + @Override public void deleteLink(String key) { persistence.deleteLink(currentProject, key); } @@ -378,15 +388,18 @@ public class DefaultIndex extends SonarIndex { // // + @Override public List<Event> getEvents(Resource resource) { // currently events are not cached in memory return persistence.getEvents(resource); } + @Override public void deleteEvent(Event event) { persistence.deleteEvent(event); } + @Override public Event addEvent(Resource resource, String name, String description, String category, Date date) { Event event = new Event(name, description, category); event.setDate(date); @@ -396,6 +409,7 @@ public class DefaultIndex extends SonarIndex { return null; } + @Override public void setSource(Resource reference, String source) { Bucket bucket = checkIndexed(reference); if (bucket != null && !bucket.isExcluded()) { @@ -403,6 +417,7 @@ public class DefaultIndex extends SonarIndex { } } + @Override public String getSource(Resource resource) { return persistence.getSource(resource); } @@ -410,11 +425,13 @@ public class DefaultIndex extends SonarIndex { /** * Does nothing if the resource is already registered. */ + @Override public Resource addResource(Resource resource) { Bucket bucket = doIndex(resource); return bucket != null ? bucket.getResource() : null; } + @Override public <R extends Resource> R getResource(R reference) { Bucket bucket = buckets.get(reference); if (bucket != null) { @@ -442,6 +459,7 @@ public class DefaultIndex extends SonarIndex { return excluded; } + @Override public List<Resource> getChildren(Resource resource) { return getChildren(resource, false); } @@ -459,6 +477,7 @@ public class DefaultIndex extends SonarIndex { return children; } + @Override public Resource getParent(Resource resource) { Bucket bucket = getBucket(resource, false); if (bucket != null && bucket.getParent() != null) { @@ -467,6 +486,7 @@ public class DefaultIndex extends SonarIndex { return null; } + @Override public boolean index(Resource resource) { Bucket bucket = doIndex(resource); return bucket != null && !bucket.isExcluded(); @@ -479,6 +499,7 @@ public class DefaultIndex extends SonarIndex { return doIndex(resource, resource.getParent()); } + @Override public boolean index(Resource resource, Resource parentReference) { Bucket bucket = doIndex(resource, parentReference); return bucket != null && !bucket.isExcluded(); @@ -541,11 +562,13 @@ public class DefaultIndex extends SonarIndex { return bucket; } + @Override public boolean isExcluded(Resource reference) { Bucket bucket = getBucket(reference, true); return bucket != null && bucket.isExcluded(); } + @Override public boolean isIndexed(Resource reference, boolean acceptExcluded) { return getBucket(reference, acceptExcluded) != null; } diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java index b5b4996259a..b22d1586fb3 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java @@ -68,6 +68,7 @@ public class ChannelDispatcher<OUTPUT> extends Channel<OUTPUT> { this.failIfNoChannelToConsumeOneCharacter = builder.failIfNoChannelToConsumeOneCharacter; } + @Override public boolean consume(CodeReader code, OUTPUT output) { int nextChar = code.peek(); while (nextChar != -1) { diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/CaseInsensitiveKeywordsTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/CaseInsensitiveKeywordsTokenizer.java index f7111c3b6e6..c5129b80ded 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/CaseInsensitiveKeywordsTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/CaseInsensitiveKeywordsTokenizer.java @@ -33,6 +33,7 @@ public class CaseInsensitiveKeywordsTokenizer extends KeywordsTokenizer { setCaseInsensitive(true); } + @Override public KeywordsTokenizer clone() { KeywordsTokenizer clone = super.clone(); clone.setCaseInsensitive(true); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java index 7f7b4a281c6..ed6d6b4c832 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java @@ -56,6 +56,7 @@ public class HtmlCodeBuilder implements Appendable { colorizedCode.append(htmlTag); } + @Override public String toString() { return colorizedCode.toString(); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlRenderer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlRenderer.java index 0368b26a94d..af9c2d81f02 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlRenderer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlRenderer.java @@ -38,6 +38,7 @@ public class HtmlRenderer extends Renderer { this(HtmlOptions.DEFAULT); } + @Override public String render(Reader code, List<? extends Channel<HtmlCodeBuilder>> tokenizers) { try { List<Channel<HtmlCodeBuilder>> allTokenizers = new ArrayList<Channel<HtmlCodeBuilder>>(); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java index 0f9b9e5773e..19bfe7747e4 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java @@ -37,6 +37,7 @@ public abstract class InlineDocTokenizer extends Tokenizer { this.startToken = startToken.toCharArray(); } + @Override public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) { if (code.peek() == startToken[0] && Arrays.equals(code.peek(startToken.length), startToken)) { codeBuilder.appendWithoutTransforming(tagBefore); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java index e2ed24ecd4c..0feab07b363 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/KeywordsTokenizer.java @@ -59,6 +59,7 @@ public class KeywordsTokenizer extends NotThreadSafeTokenizer { this.matcher = Pattern.compile(DEFAULT_REGEX).matcher(""); } + @Override public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) { if (code.popTo(matcher, tmpBuilder) > 0) { if (isKeyword(tmpBuilder.toString())) { @@ -87,6 +88,7 @@ public class KeywordsTokenizer extends NotThreadSafeTokenizer { this.caseInsensitive = caseInsensitive; } + @Override public KeywordsTokenizer clone() { KeywordsTokenizer clone = new KeywordsTokenizer(tagBefore, tagAfter, keywords, matcher.pattern().pattern()); clone.caseInsensitive = caseInsensitive; diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java index 779ebb02fe1..12795af506f 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java @@ -55,6 +55,7 @@ public class MultilinesDocTokenizer extends Tokenizer { startToken))); } + @Override public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) { if (hasNextToken(code, codeBuilder)) { codeBuilder.appendWithoutTransforming(tagBefore); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/NotThreadSafeTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/NotThreadSafeTokenizer.java index db935b15ab7..7c020274a1c 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/NotThreadSafeTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/NotThreadSafeTokenizer.java @@ -26,5 +26,6 @@ package org.sonar.colorizer; */ public abstract class NotThreadSafeTokenizer extends Tokenizer implements Cloneable { + @Override public abstract NotThreadSafeTokenizer clone(); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/RegexpTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/RegexpTokenizer.java index 84de5df5f7f..92139c083e7 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/RegexpTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/RegexpTokenizer.java @@ -57,6 +57,7 @@ public class RegexpTokenizer extends NotThreadSafeTokenizer{ return false; } + @Override public RegexpTokenizer clone() { return new RegexpTokenizer(tagBefore, tagAfter, matcher.pattern().pattern()); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java index 80b9fa48efe..14589780d83 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java @@ -60,6 +60,7 @@ public class MsSql implements Dialect { registerColumnType(Types.CLOB, "nvarchar(max)"); } + @Override public String getTypeName(int code, int length, int precision, int scale) { if (code != 2005) { return super.getTypeName(code, length, precision, scale); diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java b/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java index 29e204ab027..086ad0f5988 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java @@ -45,15 +45,18 @@ public class JpaDatabaseSession extends DatabaseSession { * Note that usage of this method is discouraged, because it allows to construct and execute queries without additional exception handling, * which done in methods of this class. */ + @Override public EntityManager getEntityManager() { return entityManager; } + @Override public void start() { entityManager = connector.createEntityManager(); index = 0; } + @Override public void stop() { commit(); if (entityManager != null && entityManager.isOpen()) { @@ -62,6 +65,7 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public void commit() { if (entityManager != null && inTransaction) { if (entityManager.isOpen()) { @@ -77,6 +81,7 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public void rollback() { if (entityManager != null && inTransaction) { entityManager.getTransaction().rollback(); @@ -84,23 +89,27 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public <T> T save(T model) { startTransaction(); internalSave(model, true); return model; } + @Override public Object saveWithoutFlush(Object model) { startTransaction(); internalSave(model, false); return model; } + @Override public boolean contains(Object model) { startTransaction(); return entityManager.contains(model); } + @Override public void save(Object... models) { startTransaction(); for (Object model : models) { @@ -123,11 +132,13 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public Object merge(Object model) { startTransaction(); return entityManager.merge(model); } + @Override public void remove(Object model) { startTransaction(); entityManager.remove(model); @@ -136,11 +147,13 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public void removeWithoutFlush(Object model) { startTransaction(); entityManager.remove(model); } + @Override public <T> T reattach(Class<T> entityClass, Object primaryKey) { startTransaction(); return entityManager.getReference(entityClass, primaryKey); @@ -157,6 +170,7 @@ public class JpaDatabaseSession extends DatabaseSession { * Note that not recommended to directly execute {@link Query#getSingleResult()}, because it will bypass exception handling, * which done in {@link #getSingleResult(Query, Object)}. */ + @Override public Query createQuery(String hql) { startTransaction(); return entityManager.createQuery(hql); @@ -172,6 +186,7 @@ public class JpaDatabaseSession extends DatabaseSession { * @return the result or <code>defaultValue</code>, if not found * @throws NonUniqueResultException if more than one result */ + @Override public <T> T getSingleResult(Query query, T defaultValue) { /* * See http://jira.codehaus.org/browse/SONAR-2225 @@ -199,6 +214,7 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public <T> T getEntity(Class<T> entityClass, Object id) { startTransaction(); return getEntityManager().find(entityClass, id); @@ -208,6 +224,7 @@ public class JpaDatabaseSession extends DatabaseSession { * @return the result or <code>null</code>, if not found * @throws NonUniqueResultException if more than one result */ + @Override public <T> T getSingleResult(Class<T> entityClass, Object... criterias) { try { return getSingleResult(getQueryForCriterias(entityClass, true, criterias), (T) null); @@ -219,10 +236,12 @@ public class JpaDatabaseSession extends DatabaseSession { } } + @Override public <T> List<T> getResults(Class<T> entityClass, Object... criterias) { return getQueryForCriterias(entityClass, true, criterias).getResultList(); } + @Override public <T> List<T> getResults(Class<T> entityClass) { return getQueryForCriterias(entityClass, false, (Object[]) null).getResultList(); } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DerbyUtils.java b/sonar-core/src/test/java/org/sonar/core/persistence/DerbyUtils.java index ce530d6c121..f801bf34587 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DerbyUtils.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DerbyUtils.java @@ -28,6 +28,7 @@ public final class DerbyUtils { } public static final OutputStream DEV_NULL = new OutputStream() { + @Override public void write(int b) { } }; diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/DefaultRulesManager.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/DefaultRulesManager.java index bf60cc0a821..773ac7ebe67 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/rules/DefaultRulesManager.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/DefaultRulesManager.java @@ -69,6 +69,7 @@ public class DefaultRulesManager extends RulesManager { * @param ruleKey the rule key * @return the rule */ + @Override public Rule getPluginRule(String pluginKey, String ruleKey) { Map<String, Rule> rulesByKey = getPluginRulesIndexedByKey(pluginKey); return rulesByKey.get(ruleKey); diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java index e0fa7964913..a94049aa940 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java @@ -89,10 +89,12 @@ public class SourceCode { this.encoding = encoding; } + @Override public Reader getReader() throws Exception { return new InputStreamReader(new FileInputStream(file), encoding); } + @Override public String getFileName() { return this.file.getAbsolutePath(); } @@ -114,10 +116,12 @@ public class SourceCode { this.name = name; } + @Override public Reader getReader() { return new StringReader(source_code); } + @Override public String getFileName() { return name; } diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java index 868b8e2eeea..f36a4328ba8 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java @@ -114,6 +114,7 @@ public class TokenEntry implements Comparable<TokenEntry> { return this.index; } + @Override public int hashCode() { return hashCode; } @@ -122,6 +123,7 @@ public class TokenEntry implements Comparable<TokenEntry> { this.hashCode = hashCode; } + @Override public boolean equals(Object o) { if (!(o instanceof TokenEntry)) { return false; diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/CodeLoaderWithoutCache.java b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/CodeLoaderWithoutCache.java index 69c5ccff673..1b004e62a37 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/CodeLoaderWithoutCache.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/CodeLoaderWithoutCache.java @@ -26,6 +26,7 @@ import net.sourceforge.pmd.cpd.SourceCode.CodeLoader; public abstract class CodeLoaderWithoutCache extends CodeLoader { + @Override public final List<String> getCode() { return load(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/FileCodeLoaderWithoutCache.java b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/FileCodeLoaderWithoutCache.java index 802727e1c82..e6036839ad2 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/FileCodeLoaderWithoutCache.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/FileCodeLoaderWithoutCache.java @@ -35,10 +35,12 @@ public class FileCodeLoaderWithoutCache extends CodeLoaderWithoutCache { this.encoding = encoding; } + @Override public Reader getReader() throws Exception { return new InputStreamReader(new FileInputStream(file), encoding); } + @Override public String getFileName() { return this.file.getAbsolutePath(); } diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java index 8be95fdcc4c..0d1f45d852e 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java @@ -40,6 +40,7 @@ public class CloneGroupMatcher extends TypeSafeMatcher<CloneGroup> { this.expectedParts = expectedParts; } + @Override public boolean matchesSafely(CloneGroup cloneGroup) { // Check length if (expectedLen != cloneGroup.getCloneUnitLength()) { diff --git a/sonar-graph/src/test/java/org/sonar/graph/StringPrintWriter.java b/sonar-graph/src/test/java/org/sonar/graph/StringPrintWriter.java index a300d67ec0c..b6e50e479ae 100644 --- a/sonar-graph/src/test/java/org/sonar/graph/StringPrintWriter.java +++ b/sonar-graph/src/test/java/org/sonar/graph/StringPrintWriter.java @@ -27,6 +27,7 @@ public class StringPrintWriter { builder.append(line + " \r"); } + @Override public String toString() { return builder.toString(); } diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownOutput.java b/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownOutput.java index 21739589302..4017396f77e 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownOutput.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownOutput.java @@ -31,6 +31,7 @@ class MarkdownOutput { return ouput.append(character); } + @Override public String toString() { return ouput.toString(); } 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("/"); } diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java index a90cb5d606e..9a9735761f2 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java @@ -60,18 +60,22 @@ public final class ServerImpl extends Server { } } + @Override public String getPermanentServerId() { return settings.getString(CoreProperties.PERMANENT_SERVER_ID); } + @Override public String getId() { return id; } + @Override public String getVersion() { return version; } + @Override public Date getStartedAt() { return startedAt; } @@ -96,6 +100,7 @@ public final class ServerImpl extends Server { return StringUtils.defaultIfEmpty(result, ""); } + @Override public String getURL() { return null; } diff --git a/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java index 0c0c6b3bee9..24fc10fb962 100644 --- a/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java @@ -84,22 +84,27 @@ public class ServerLifecycleNotifierTest { class FakeServer extends Server { + @Override public String getId() { return null; } + @Override public String getVersion() { return null; } + @Override public Date getStartedAt() { return null; } + @Override public String getURL() { return null; } + @Override public String getPermanentServerId() { return null; } diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java index 380b6cf8bda..4c222392359 100644 --- a/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java +++ b/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java @@ -246,6 +246,7 @@ class FakeRepository extends RuleRepository { super("fake", "java"); } + @Override public List<Rule> createRules() { Rule rule1 = Rule.create("fake", "rule1", "One"); rule1.setDescription("Description of One"); @@ -267,6 +268,7 @@ class RuleWithoutNameRepository extends RuleRepository { super("rule-without-name-repo", "java"); } + @Override public List<Rule> createRules() { // Rules must not have empty name Rule rule1 = Rule.create("fake", "rule1", null); @@ -279,6 +281,7 @@ class RuleWithoutDescriptionRepository extends RuleRepository { super("rule-without-description-repo", "java"); } + @Override public List<Rule> createRules() { // Rules must not have empty description Rule rule1 = Rule.create("fake", "rule1", "Rule 1"); @@ -293,6 +296,7 @@ class VolumeRepository extends RuleRepository { super("volume", "java"); } + @Override public List<Rule> createRules() { List<Rule> rules = new ArrayList<Rule>(); for (int i = 0; i < SIZE; i++) { diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java index 2d5e5cef509..3643750f43c 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/JdkUtils.java @@ -33,11 +33,13 @@ import java.util.Set; public final class JdkUtils extends WSUtils { + @Override public String format(Date date, String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); } + @Override public String encodeUrl(String url) { try { return URLEncoder.encode(url, "UTF-8"); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java index aa1d4677a43..dfd615778cb 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java @@ -69,18 +69,22 @@ public class HttpClient3Connector extends Connector { } } + @Override public String execute(Query<?> query) { return executeRequest(newGetRequest(query)); } + @Override public String execute(CreateQuery<?> query) { return executeRequest(newPostRequest(query)); } + @Override public String execute(UpdateQuery<?> query) { return executeRequest(newPutRequest(query)); } + @Override public String execute(DeleteQuery query) { return executeRequest(newDeleteRequest(query)); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java index 5c7521091d9..40d216d8944 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java @@ -70,18 +70,22 @@ public class HttpClient4Connector extends Connector { this.server = server; } + @Override public String execute(Query<?> query) { return executeRequest(newGetMethod(query)); } + @Override public String execute(CreateQuery<?> query) { return executeRequest(newPostMethod(query)); } + @Override public String execute(UpdateQuery<?> query) { return executeRequest(newPutMethod(query)); } + @Override public String execute(DeleteQuery query) { return executeRequest(newDeleteMethod(query)); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java index c550ec0afb5..473e9f4bfb2 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshaller.java @@ -26,6 +26,7 @@ import org.sonar.wsclient.services.WSUtils; public class TimeMachineUnmarshaller extends AbstractUnmarshaller<TimeMachine> { + @Override protected TimeMachine parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); Object cols = utils.getField(json, "cols"); diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java index 23b1a205ec8..49ce5918fef 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java @@ -123,10 +123,12 @@ public class SonarTest { } static class EmptyQuery extends Query<Metric> { + @Override public String getUrl() { return "/api/empty"; } + @Override public Class<Metric> getModelClass() { return Metric.class; } |