summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java13
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java13
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/JavaAstCheck.java31
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java15
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/BytecodeCheck.java8
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/SquidCheck.java11
-rw-r--r--sonar-check-api/src/main/java/org/sonar/check/Message.java4
-rw-r--r--sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java19
-rw-r--r--sonar-squid/src/main/java/org/sonar/squid/api/CodeCheck.java5
9 files changed, 39 insertions, 80 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
index 474dfe6526b..4cfc734457d 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
@@ -17,23 +17,22 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.java.ast.check;
-import java.util.Arrays;
-import java.util.List;
-
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import org.sonar.check.Priority;
import org.sonar.check.Rule;
import org.sonar.java.ast.visitor.AstUtils;
+import org.sonar.java.ast.visitor.JavaAstVisitor;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
@Rule(key = "AvoidBreakOutsideSwitch", priority = Priority.MAJOR)
-public class BreakCheck extends JavaAstCheck {
+public class BreakCheck extends JavaAstVisitor {
@Override
public List<Integer> getWantedTokens() {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
index 162d208fc27..dd6898e134f 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
@@ -17,23 +17,22 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.java.ast.check;
-import java.util.Arrays;
-import java.util.List;
-
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import org.sonar.check.Priority;
import org.sonar.check.Rule;
+import org.sonar.java.ast.visitor.JavaAstVisitor;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceCode;
import org.sonar.squid.api.SourceFile;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
@Rule(key = "AvoidContinueStatement", priority = Priority.MAJOR)
-public class ContinueCheck extends JavaAstCheck {
+public class ContinueCheck extends JavaAstVisitor {
@Override
public List<Integer> getWantedTokens() {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/JavaAstCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/JavaAstCheck.java
deleted file mode 100644
index 19916649f14..00000000000
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/JavaAstCheck.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-
-package org.sonar.java.ast.check;
-
-import org.sonar.java.ast.visitor.JavaAstVisitor;
-import org.sonar.squid.api.CodeCheck;
-
-public abstract class JavaAstCheck extends JavaAstVisitor implements CodeCheck {
-
- public String getKey() {
- return getClass().getSimpleName();
- }
-}
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
index d359d49316a..6ff78495146 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
@@ -17,28 +17,23 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.java.ast.check;
-import java.util.List;
-
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.WildcardPattern;
import org.sonar.check.Priority;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
import org.sonar.java.PatternUtils;
+import org.sonar.java.ast.visitor.JavaAstVisitor;
import org.sonar.java.ast.visitor.PublicApiVisitor;
-import org.sonar.squid.api.CheckMessage;
-import org.sonar.squid.api.SourceClass;
-import org.sonar.squid.api.SourceCode;
-import org.sonar.squid.api.SourceFile;
-import org.sonar.squid.api.SourceMethod;
+import org.sonar.squid.api.*;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import java.util.List;
@Rule(key = "UndocumentedApi", priority = Priority.MAJOR)
-public class UndocumentedApiCheck extends JavaAstCheck {
+public class UndocumentedApiCheck extends JavaAstVisitor {
@RuleProperty
private String forClasses = "";
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/BytecodeCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/BytecodeCheck.java
index ad24cf3e903..19792e6d29c 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/BytecodeCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/BytecodeCheck.java
@@ -22,9 +22,9 @@ package org.sonar.java.bytecode.check;
import org.sonar.java.bytecode.visitor.BytecodeVisitor;
import org.sonar.squid.api.CodeCheck;
-public abstract class BytecodeCheck extends BytecodeVisitor implements CodeCheck {
+public abstract class BytecodeCheck extends BytecodeVisitor {
- public String getKey() {
- return getClass().getSimpleName();
- }
+// public String getKey() {
+// return getClass().getSimpleName();
+// }
}
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/SquidCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/SquidCheck.java
index 8823a309d81..ff82b806007 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/SquidCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/SquidCheck.java
@@ -21,16 +21,15 @@
package org.sonar.java.squid.check;
import org.sonar.java.squid.visitor.SquidVisitor;
-import org.sonar.squid.api.CodeCheck;
import org.sonar.squid.api.SourceClass;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.api.SourceMethod;
-public class SquidCheck implements SquidVisitor, CodeCheck {
-
- public String getKey() {
- return getClass().getSimpleName();
- }
+public class SquidCheck implements SquidVisitor {
+//
+// public String getKey() {
+// return getClass().getSimpleName();
+// }
public void visitFile(SourceFile sourceFile) {
}
diff --git a/sonar-check-api/src/main/java/org/sonar/check/Message.java b/sonar-check-api/src/main/java/org/sonar/check/Message.java
index f0896fbdaf1..4efa8e23e30 100644
--- a/sonar-check-api/src/main/java/org/sonar/check/Message.java
+++ b/sonar-check-api/src/main/java/org/sonar/check/Message.java
@@ -17,7 +17,6 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.check;
import java.util.Locale;
@@ -28,9 +27,6 @@ import java.util.Locale;
@Deprecated
public interface Message {
- /**
- * Return the checker which logged the message. The checker class must be annotated with <code>@Check</code>
- */
Object getChecker();
Integer getLine();
diff --git a/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java b/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java
index 8e5a73806c2..a1a22bbb781 100644
--- a/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java
+++ b/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java
@@ -17,27 +17,26 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.squid.api;
-import java.text.MessageFormat;
-import java.util.Locale;
-
import org.apache.commons.lang.builder.ToStringBuilder;
import org.sonar.check.Message;
+import java.text.MessageFormat;
+import java.util.Locale;
+
public class CheckMessage implements Message {
private Integer line;
private Double cost;
private SourceCode sourceCode;
- private CodeCheck codeCheck;
+ private Object checker;
private String defaultMessage;
private Object[] messageArguments;
private Boolean bypassExclusion;
- public CheckMessage(CodeCheck rule, String message, Object... messageArguments) {
- this.codeCheck = rule;
+ public CheckMessage(Object checker, String message, Object... messageArguments) {
+ this.checker = checker;
this.defaultMessage = message;
this.messageArguments = messageArguments;
}
@@ -74,8 +73,8 @@ public class CheckMessage implements Message {
return bypassExclusion == null ? false : bypassExclusion;
}
- public CodeCheck getChecker() {
- return codeCheck;
+ public Object getChecker() {
+ return checker;
}
public String getDefaultMessage() {
@@ -92,7 +91,7 @@ public class CheckMessage implements Message {
@Override
public String toString() {
- return new ToStringBuilder(this).append("source", sourceCode).append("check", codeCheck).append("msg", defaultMessage)
+ return new ToStringBuilder(this).append("source", sourceCode).append("checker", checker).append("msg", defaultMessage)
.append("line", line).toString();
}
diff --git a/sonar-squid/src/main/java/org/sonar/squid/api/CodeCheck.java b/sonar-squid/src/main/java/org/sonar/squid/api/CodeCheck.java
index 7661e65cb99..3253f09d9a3 100644
--- a/sonar-squid/src/main/java/org/sonar/squid/api/CodeCheck.java
+++ b/sonar-squid/src/main/java/org/sonar/squid/api/CodeCheck.java
@@ -17,9 +17,12 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-
package org.sonar.squid.api;
+/**
+ * @deprecated since 2.12. See https://jira.codehaus.org/browse/SONAR-2875
+ */
+@Deprecated
public interface CodeCheck extends CodeVisitor {
String getKey();