* 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() {
* 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() {
+++ /dev/null
-/*
- * 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();
- }
-}
* 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 = "";
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();
+// }
}
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) {
}
* 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;
@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();
* 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;
}
return bypassExclusion == null ? false : bypassExclusion;
}
- public CodeCheck getChecker() {
- return codeCheck;
+ public Object getChecker() {
+ return checker;
}
public String getDefaultMessage() {
@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();
}
* 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();