]> source.dussan.org Git - sonarqube.git/commitdiff
fix compatibility with Java 1.5
authorsimonbrandhof <simon.brandhof@gmail.com>
Mon, 11 Oct 2010 21:59:56 +0000 (21:59 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Mon, 11 Oct 2010 21:59:56 +0000 (21:59 +0000)
sonar-check-api/src/main/java/org/sonar/check/Cardinality.java [new file with mode: 0644]
sonar-check-api/src/main/java/org/sonar/check/Rule.java
sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
sonar-plugin-api/src/main/java/org/sonar/api/rules/XMLRuleParser.java
sonar-plugin-api/src/test/java/org/sonar/api/rules/XMLRuleParserTest.java

diff --git a/sonar-check-api/src/main/java/org/sonar/check/Cardinality.java b/sonar-check-api/src/main/java/org/sonar/check/Cardinality.java
new file mode 100644 (file)
index 0000000..deaa4f3
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.check;
+
+/**
+ * @since 2.3
+ */
+public enum Cardinality {
+  SINGLE, MULTIPLE
+}
index 05989e614d9f87c29daf2310cec7761df54debb6..20c4cb0e34cf470f9445234732e828032d0ed51f 100644 (file)
@@ -31,11 +31,6 @@ import java.lang.annotation.Target;
 @Target(ElementType.TYPE)
 public @interface Rule {
 
-  static enum Cardinality {
-    SINGLE, MULTIPLE
-  }
-
-
   /**
    * The default key is the class name.
    */
index d7aaa4a58a72882bd976e4049736d92451e465d6..a2999a8452bbb00b8b93ff8eafc13841e9399952 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;\r
 import org.apache.commons.lang.builder.ToStringBuilder;\r
 import org.sonar.api.database.DatabaseProperties;\r
+import org.sonar.check.Cardinality;\r
 \r
 import javax.persistence.*;\r
 import java.util.ArrayList;\r
@@ -71,7 +72,7 @@ public final class Rule {
 \r
   @Enumerated(EnumType.STRING)\r
   @Column(name = "cardinality", updatable = true, nullable = false)\r
-  private org.sonar.check.Rule.Cardinality cardinality = org.sonar.check.Rule.Cardinality.SINGLE;\r
+  private Cardinality cardinality = Cardinality.SINGLE;\r
 \r
   @ManyToOne(fetch = FetchType.EAGER)\r
   @JoinColumn(name = "parent_id", updatable = true, nullable = true)\r
@@ -331,11 +332,11 @@ public final class Rule {
     return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);\r
   }\r
 \r
-  public org.sonar.check.Rule.Cardinality getCardinality() {\r
+  public Cardinality getCardinality() {\r
     return cardinality;\r
   }\r
 \r
-  public Rule setCardinality(org.sonar.check.Rule.Cardinality c) {\r
+  public Rule setCardinality(Cardinality c) {\r
     this.cardinality = c;\r
     return this;\r
   }\r
index 9ff321b0457f1d0e6e68ecce5797d4c484347eb5..cb0fd725f17e3382d483984117a6e43e75d3ca12 100644 (file)
@@ -29,6 +29,7 @@ import org.codehaus.staxmate.in.SMHierarchicCursor;
 import org.codehaus.staxmate.in.SMInputCursor;
 import org.sonar.api.ServerComponent;
 import org.sonar.api.utils.SonarException;
+import org.sonar.check.Cardinality;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -139,7 +140,7 @@ public final class XMLRuleParser implements ServerComponent {
         rule.setRulesCategory(new RulesCategory(category));
 
       } else if (StringUtils.equalsIgnoreCase("cardinality", nodeName)) {
-        rule.setCardinality(org.sonar.check.Rule.Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
+        rule.setCardinality(Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
 
       } else if (StringUtils.equalsIgnoreCase("param", nodeName)) {
         processParameter(rule, cursor);
index 726596e5a7b358db6481538814ce66d3cd6dc684..c444fdda875147acc6350bae9d5ded5302b6a49f 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.api.rules;
 import org.hamcrest.core.Is;
 import org.junit.Test;
 import org.sonar.api.utils.SonarException;
-import org.sonar.check.Rule.Cardinality;
+import org.sonar.check.Cardinality;
 
 import java.io.StringReader;
 import java.util.List;