aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-05-13 17:59:15 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-05-19 20:18:11 +0200
commit1abbd252c8513f92dbb9875288c5d000bb8f8c29 (patch)
treebb2457b69006e1eb49c0cd049da2745864d3e484 /sonar-plugin-api
parent10c3297f7506e314f14bf6512f2db48a3fa1eb1b (diff)
downloadsonarqube-1abbd252c8513f92dbb9875288c5d000bb8f8c29.tar.gz
sonarqube-1abbd252c8513f92dbb9875288c5d000bb8f8c29.zip
SONAR-6555 Drop design related features on batch side
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/pom.xml5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java19
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java22
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java11
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/Dependency.java39
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/NewDependency.java47
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/DefaultDependency.java137
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/package-info.java21
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/package-info.java21
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java25
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/design/DependencyDto.java200
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java124
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java10
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java11
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/design/DependencyTest.java47
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java1
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/ScopesTest.java10
23 files changed, 137 insertions, 648 deletions
diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml
index e9f69c71055..d49195a8d01 100644
--- a/sonar-plugin-api/pom.xml
+++ b/sonar-plugin-api/pom.xml
@@ -55,11 +55,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-graph</artifactId>
- </dependency>
-
<!-- TODO we can't remove hibernate-annotations, because currently it's used
moreover it contains transitive dependency on dom4j, which is used in some plugins
-->
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java
index 018d22cc0a0..ee248eb6772 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java
@@ -29,7 +29,6 @@ import org.sonar.api.rules.Violation;
import java.util.Collection;
import java.util.List;
-import java.util.Set;
/**
* @since 1.10
@@ -88,17 +87,13 @@ public interface DecoratorContext {
DecoratorContext saveMeasure(Metric metric, Double value);
// DEPENDENCIES
-
+ /**
+ * @deprecated since 5.2 No more design features. No-op.
+ */
+ @Deprecated
Dependency saveDependency(Dependency dependency);
- Set<Dependency> getDependencies();
-
- Collection<Dependency> getIncomingDependencies();
-
- Collection<Dependency> getOutgoingDependencies();
-
// RULES
-
/**
* Save a coding rule violation. The decorator which calls this method must be depended upon BatchBarriers.END_OF_VIOLATIONS_GENERATION.
*
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java
index f5b73a25722..e95d0e15a84 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java
@@ -32,7 +32,6 @@ import javax.annotation.CheckForNull;
import java.io.Serializable;
import java.util.Collection;
-import java.util.Set;
/**
* @since 1.10
@@ -191,25 +190,11 @@ public interface SensorContext extends org.sonar.api.batch.sensor.SensorContext
// ----------- DEPENDENCIES BETWEEN RESOURCES --------------
- Dependency saveDependency(Dependency dependency);
-
- /**
- * @deprecated since 5.1 Sensors should not read but only save data
- */
- @Deprecated
- Set<Dependency> getDependencies();
-
/**
- * @deprecated since 5.1 Sensors should not read but only save data
+ * @deprecated since 5.2 No more design features. No-op
*/
@Deprecated
- Collection<Dependency> getIncomingDependencies(Resource to);
-
- /**
- * @deprecated since 5.1 Sensors should not read but only save data
- */
- @Deprecated
- Collection<Dependency> getOutgoingDependencies(Resource from);
+ Dependency saveDependency(Dependency dependency);
// ----------- FILE SOURCES --------------
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java
index 5032c68afcc..2c89ca8987c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SonarIndex.java
@@ -26,18 +26,16 @@ import org.sonar.api.measures.MeasuresFilter;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
import org.sonar.api.rules.Violation;
-import org.sonar.graph.DirectedGraphAccessor;
import javax.annotation.CheckForNull;
import java.util.Collection;
-import java.util.Set;
/**
* @deprecated since 4.5.2 should not be used by plugins. Everything should be accessed using {@link SensorContext}.
*/
@Deprecated
-public abstract class SonarIndex implements DirectedGraphAccessor<Resource, Dependency> {
+public abstract class SonarIndex {
/**
* Indexes a resource as a direct child of project. This method does nothing and returns true if the resource already indexed.
@@ -101,9 +99,7 @@ public abstract class SonarIndex implements DirectedGraphAccessor<Resource, Depe
public abstract Project getProject();
- public final Collection<Resource> getResources() {
- return getVertices();
- }
+ public abstract Collection<Resource> getResources();
/**
* Indexes the resource.
@@ -140,15 +136,9 @@ public abstract class SonarIndex implements DirectedGraphAccessor<Resource, Depe
*/
public abstract Measure addMeasure(Resource resource, Measure measure);
+ /**
+ * @deprecated since 5.2 No more design features. No op.
+ */
+ @Deprecated
public abstract Dependency addDependency(Dependency dependency);
-
- public abstract Set<Dependency> getDependencies();
-
- public final Collection<Dependency> getOutgoingDependencies(Resource from) {
- return getOutgoingEdges(from);
- }
-
- public final Collection<Dependency> getIncomingDependencies(Resource to) {
- return getIncomingEdges(to);
- }
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
index 187c784ff00..87a98418dff 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
@@ -25,7 +25,6 @@ import org.sonar.api.batch.CpdMapping;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.sensor.coverage.NewCoverage;
-import org.sonar.api.batch.sensor.dependency.NewDependency;
import org.sonar.api.batch.sensor.duplication.NewDuplication;
import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
@@ -106,14 +105,4 @@ public interface SensorContext {
*/
NewCoverage newCoverage();
- // TODO
-
- // ------------ DEPENDENCIES ------------
-
- /**
- * Create a new dependency.
- * Don't forget to call {@link NewDependency#save()} once all parameters are provided.
- */
- NewDependency newDependency();
-
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/Dependency.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/Dependency.java
deleted file mode 100644
index 69644789673..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/Dependency.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.batch.sensor.dependency;
-
-import com.google.common.annotations.Beta;
-
-/**
- * @since 5.1
- */
-@Beta
-public interface Dependency {
-
- String fromKey();
-
- String toKey();
-
- /**
- * Default weight value is 1.
- */
- int weight();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/NewDependency.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/NewDependency.java
deleted file mode 100644
index 9e0de3c991b..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/NewDependency.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.batch.sensor.dependency;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.batch.fs.InputFile;
-
-/**
- * Builder to create new Dependency.
- * Should not be implemented by client.
- * @since 5.1
- */
-@Beta
-public interface NewDependency {
-
- NewDependency from(InputFile from);
-
- NewDependency to(InputFile to);
-
- /**
- * Set the weight of the dependency. If not set default weight is 1.
- */
- NewDependency weight(int weight);
-
- /**
- * Save the dependency. It is not permitted so save several time a dependency between two same files.
- */
- void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/DefaultDependency.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/DefaultDependency.java
deleted file mode 100644
index 3ea8f9ef4d3..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/DefaultDependency.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.batch.sensor.dependency.internal;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.sensor.dependency.Dependency;
-import org.sonar.api.batch.sensor.dependency.NewDependency;
-import org.sonar.api.batch.sensor.internal.DefaultStorable;
-import org.sonar.api.batch.sensor.internal.SensorStorage;
-
-import javax.annotation.Nullable;
-
-public class DefaultDependency extends DefaultStorable implements Dependency, NewDependency {
-
- private String fromKey;
- private String toKey;
- private int weight = 1;
-
- public DefaultDependency() {
- super(null);
- }
-
- public DefaultDependency(@Nullable SensorStorage storage) {
- super(storage);
- }
-
- @Override
- public DefaultDependency from(InputFile from) {
- Preconditions.checkNotNull(from, "InputFile should be non null");
- this.fromKey = ((DefaultInputFile) from).key();
- return this;
- }
-
- @Override
- public DefaultDependency to(InputFile to) {
- Preconditions.checkNotNull(to, "InputFile should be non null");
- this.toKey = ((DefaultInputFile) to).key();
- return this;
- }
-
- @Override
- public DefaultDependency weight(int weight) {
- Preconditions.checkArgument(weight >= 1, "weight should be greater than 0");
- this.weight = weight;
- return this;
- }
-
- @Override
- public void doSave() {
- Preconditions.checkState(!this.fromKey.equals(this.toKey), "From and To can't be the same inputFile");
- Preconditions.checkNotNull(this.fromKey, "From inputFile can't be null");
- Preconditions.checkNotNull(this.toKey, "To inputFile can't be null");
- storage.store(this);
- }
-
- @Override
- public String fromKey() {
- return this.fromKey;
- }
-
- public DefaultDependency setFromKey(String fromKey) {
- this.fromKey = fromKey;
- return this;
- }
-
- @Override
- public String toKey() {
- return this.toKey;
- }
-
- public DefaultDependency setToKey(String toKey) {
- this.toKey = toKey;
- return this;
- }
-
- @Override
- public int weight() {
- return this.weight;
- }
-
- public DefaultDependency setWeight(int weight) {
- this.weight = weight;
- return this;
- }
-
- // For testing purpose
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj == this) {
- return true;
- }
- if (obj.getClass() != getClass()) {
- return false;
- }
- DefaultDependency rhs = (DefaultDependency) obj;
- return new EqualsBuilder()
- .append(fromKey, rhs.fromKey)
- .append(toKey, rhs.toKey)
- .append(weight, rhs.weight)
- .isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(27, 45).
- append(fromKey).
- append(toKey).
- append(weight).
- toHashCode();
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/package-info.java
deleted file mode 100644
index d45dd459268..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/internal/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.dependency.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/package-info.java
deleted file mode 100644
index e42fabac294..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/dependency/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.dependency;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java
index 13027e24426..9b018f6bc2c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java
@@ -35,9 +35,6 @@ import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.coverage.CoverageType;
import org.sonar.api.batch.sensor.coverage.NewCoverage;
import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage;
-import org.sonar.api.batch.sensor.dependency.Dependency;
-import org.sonar.api.batch.sensor.dependency.NewDependency;
-import org.sonar.api.batch.sensor.dependency.internal.DefaultDependency;
import org.sonar.api.batch.sensor.duplication.Duplication;
import org.sonar.api.batch.sensor.duplication.NewDuplication;
import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplication;
@@ -59,7 +56,12 @@ import javax.annotation.Nullable;
import java.io.File;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* Utility class to help testing {@link Sensor}.
@@ -243,15 +245,6 @@ public class SensorContextTester implements SensorContext {
return sensorStorage.duplications;
}
- @Override
- public NewDependency newDependency() {
- return new DefaultDependency(sensorStorage);
- }
-
- public Collection<Dependency> dependencies() {
- return sensorStorage.dependencies;
- }
-
public static class MockAnalysisMode implements AnalysisMode {
private boolean isIncremental = false;
private boolean isPreview = false;
@@ -287,7 +280,6 @@ public class SensorContextTester implements SensorContext {
private Map<String, Map<CoverageType, DefaultCoverage>> coverageByComponent = new HashMap<>();
private List<Duplication> duplications = new ArrayList<>();
- private List<Dependency> dependencies = new ArrayList<>();
@Override
public void store(Measure measure) {
@@ -321,11 +313,6 @@ public class SensorContextTester implements SensorContext {
}
@Override
- public void store(Dependency dependency) {
- dependencies.add(dependency);
- }
-
- @Override
public void store(DefaultHighlighting highlighting) {
highlightingByComponent.put(getKey(highlighting.inputFile()), highlighting);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
index 10beba2c5d3..c653c61abbc 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
@@ -21,7 +21,6 @@ package org.sonar.api.batch.sensor.internal;
import org.sonar.api.BatchSide;
import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage;
-import org.sonar.api.batch.sensor.dependency.Dependency;
import org.sonar.api.batch.sensor.duplication.Duplication;
import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting;
import org.sonar.api.batch.sensor.issue.Issue;
@@ -40,8 +39,6 @@ public interface SensorStorage {
void store(Duplication duplication);
- void store(Dependency dependency);
-
void store(DefaultHighlighting highlighting);
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java b/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java
index bc965583881..5bfe69d6d0d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java
@@ -23,9 +23,12 @@ import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.sonar.api.resources.Resource;
-import org.sonar.graph.Edge;
-public class Dependency implements Edge<Resource> {
+/**
+ * @deprecated since 5.2 No more design features
+ */
+@Deprecated
+public class Dependency {
private Resource from;
private Resource to;
@@ -45,7 +48,6 @@ public class Dependency implements Edge<Resource> {
this.to = to;
}
- @Override
public Resource getFrom() {
return from;
}
@@ -57,7 +59,6 @@ public class Dependency implements Edge<Resource> {
this.from = from;
}
- @Override
public Resource getTo() {
return to;
}
@@ -78,7 +79,6 @@ public class Dependency implements Edge<Resource> {
return this;
}
- @Override
public int getWeight() {
return weight;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/design/DependencyDto.java b/sonar-plugin-api/src/main/java/org/sonar/api/design/DependencyDto.java
deleted file mode 100644
index 5e575bc09e2..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/design/DependencyDto.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.design;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "dependencies")
-public class DependencyDto {
-
- @Id
- @Column(name = "id")
- @GeneratedValue
- private Long id;
-
- @Column(name = "from_snapshot_id", updatable = true, nullable = false)
- private Integer fromSnapshotId;
-
- @Column(name = "from_component_uuid", updatable = true, nullable = false)
- private String fromComponentUuid;
-
- @Column(name = "from_scope", updatable = true, nullable = true)
- private String fromScope;
-
- @Column(name = "to_snapshot_id", updatable = true, nullable = false)
- private Integer toSnapshotId;
-
- @Column(name = "to_component_uuid", updatable = true, nullable = false)
- private String toComponentUuid;
-
- @Column(name = "to_scope", updatable = true, nullable = true)
- private String toScope;
-
- @Column(name = "dep_weight", updatable = true, nullable = true)
- private Integer weight;
-
- @Column(name = "dep_usage", updatable = true, nullable = true, length = 30)
- private String usage;
-
- @Column(name = "project_snapshot_id", updatable = true, nullable = false)
- private Integer projectSnapshotId;
-
- @Column(name = "parent_dependency_id", updatable = true, nullable = true)
- private Long parentDependencyId;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Integer getFromSnapshotId() {
- return fromSnapshotId;
- }
-
- public DependencyDto setFromSnapshotId(Integer fromSnapshotId) {
- this.fromSnapshotId = fromSnapshotId;
- return this;
- }
-
- public String getFromComponentUuid() {
- return fromComponentUuid;
- }
-
- public DependencyDto setFromComponentUuid(String fromComponentUuid) {
- this.fromComponentUuid = fromComponentUuid;
- return this;
- }
-
- public Integer getToSnapshotId() {
- return toSnapshotId;
- }
-
- public DependencyDto setToSnapshotId(Integer toSnapshotId) {
- this.toSnapshotId = toSnapshotId;
- return this;
- }
-
- public String getToComponentUuid() {
- return toComponentUuid;
- }
-
- public DependencyDto setToComponentUuid(String toComponentUuid) {
- this.toComponentUuid = toComponentUuid;
- return this;
- }
-
- public Integer getWeight() {
- return weight;
- }
-
- public DependencyDto setWeight(Integer weight) {
- if (weight < 0) {
- throw new IllegalArgumentException("Dependency weight can not be negative");
- }
- this.weight = weight;
- return this;
- }
-
- public String getFromScope() {
- return fromScope;
- }
-
- public DependencyDto setFromScope(String fromScope) {
- this.fromScope = fromScope;
- return this;
- }
-
- public String getToScope() {
- return toScope;
- }
-
- public DependencyDto setToScope(String toScope) {
- this.toScope = toScope;
- return this;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public DependencyDto setUsage(String usage) {
- this.usage = usage;
- return this;
- }
-
- public Integer getProjectSnapshotId() {
- return projectSnapshotId;
- }
-
- public DependencyDto setProjectSnapshotId(Integer projectSnapshotId) {
- this.projectSnapshotId = projectSnapshotId;
- return this;
- }
-
- public Long getParentDependencyId() {
- return parentDependencyId;
- }
-
- public DependencyDto setParentDependencyId(Long parentDependencyId) {
- this.parentDependencyId = parentDependencyId;
- return this;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof DependencyDto)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- DependencyDto other = (DependencyDto) obj;
- return new EqualsBuilder()
- .append(fromSnapshotId, other.fromSnapshotId)
- .append(toSnapshotId, other.toSnapshotId)
- .isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(17, 37)
- .append(fromSnapshotId)
- .append(toSnapshotId)
- .toHashCode();
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
index eeb92f0a798..227a27d7d73 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
@@ -1604,7 +1604,7 @@ public final class CoreMetrics {
* @deprecated since 4.0. See SONAR-4643
*/
@Deprecated
- public static final Metric<Integer> DEPTH_IN_TREE = new Metric.Builder(DEPTH_IN_TREE_KEY, "Depth in Tree", Metric.ValueType.INT)
+ public static final transient Metric<Integer> DEPTH_IN_TREE = new Metric.Builder(DEPTH_IN_TREE_KEY, "Depth in Tree", Metric.ValueType.INT)
.setDescription("Depth in Inheritance Tree")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(false)
@@ -1621,7 +1621,7 @@ public final class CoreMetrics {
* @deprecated since 4.0. See SONAR-4643
*/
@Deprecated
- public static final Metric<Integer> NUMBER_OF_CHILDREN = new Metric.Builder(NUMBER_OF_CHILDREN_KEY, "Number of Children", Metric.ValueType.INT)
+ public static final transient Metric<Integer> NUMBER_OF_CHILDREN = new Metric.Builder(NUMBER_OF_CHILDREN_KEY, "Number of Children", Metric.ValueType.INT)
.setDescription("Number of Children")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(false)
@@ -1639,7 +1639,7 @@ public final class CoreMetrics {
* @deprecated since 4.2. See SONAR-5042
*/
@Deprecated
- public static final Metric<Integer> RFC = new Metric.Builder(RFC_KEY, "RFC", Metric.ValueType.INT)
+ public static final transient Metric<Integer> RFC = new Metric.Builder(RFC_KEY, "RFC", Metric.ValueType.INT)
.setDescription("Response for Class")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
@@ -1658,7 +1658,7 @@ public final class CoreMetrics {
* @deprecated since 4.2. See SONAR-5042
*/
@Deprecated
- public static final Metric<String> RFC_DISTRIBUTION = new Metric.Builder(RFC_DISTRIBUTION_KEY, "Class distribution /RFC", Metric.ValueType.DISTRIB)
+ public static final transient Metric<String> RFC_DISTRIBUTION = new Metric.Builder(RFC_DISTRIBUTION_KEY, "Class distribution /RFC", Metric.ValueType.DISTRIB)
.setDescription("Class distribution /RFC")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(true)
@@ -1677,7 +1677,7 @@ public final class CoreMetrics {
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
*/
@Deprecated
- public static final Metric<Double> LCOM4 = new Metric.Builder(LCOM4_KEY, "LCOM4", Metric.ValueType.FLOAT)
+ public static final transient Metric<Double> LCOM4 = new Metric.Builder(LCOM4_KEY, "LCOM4", Metric.ValueType.FLOAT)
.setDescription("Lack of Cohesion of Functions")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1696,7 +1696,7 @@ public final class CoreMetrics {
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
*/
@Deprecated
- public static final Metric<String> LCOM4_BLOCKS = new Metric.Builder(LCOM4_BLOCKS_KEY, "LCOM4 blocks", Metric.ValueType.DATA)
+ public static final transient Metric<String> LCOM4_BLOCKS = new Metric.Builder(LCOM4_BLOCKS_KEY, "LCOM4 blocks", Metric.ValueType.DATA)
.setDescription("LCOM4 blocks")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(false)
@@ -1715,7 +1715,7 @@ public final class CoreMetrics {
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
*/
@Deprecated
- public static final Metric<String> LCOM4_DISTRIBUTION = new Metric.Builder(LCOM4_DISTRIBUTION_KEY, "Class distribution /LCOM4", Metric.ValueType.DISTRIB)
+ public static final transient Metric<String> LCOM4_DISTRIBUTION = new Metric.Builder(LCOM4_DISTRIBUTION_KEY, "Class distribution /LCOM4", Metric.ValueType.DISTRIB)
.setDescription("Class distribution /LCOM4")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(true)
@@ -1734,7 +1734,7 @@ public final class CoreMetrics {
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
*/
@Deprecated
- public static final Metric<Double> SUSPECT_LCOM4_DENSITY = new Metric.Builder(SUSPECT_LCOM4_DENSITY_KEY, "Suspect LCOM4 density", Metric.ValueType.PERCENT)
+ public static final transient Metric<Double> SUSPECT_LCOM4_DENSITY = new Metric.Builder(SUSPECT_LCOM4_DENSITY_KEY, "Suspect LCOM4 density", Metric.ValueType.PERCENT)
.setDescription("Density of classes having LCOM4>1")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1751,7 +1751,7 @@ public final class CoreMetrics {
* @deprecated since 5.0 this is an internal metric that should not be accessed by plugins
*/
@Deprecated
- public static final Metric<String> DEPENDENCY_MATRIX = new Metric.Builder(DEPENDENCY_MATRIX_KEY, "Dependency Matrix", Metric.ValueType.DATA)
+ public static final transient Metric<String> DEPENDENCY_MATRIX = new Metric.Builder(DEPENDENCY_MATRIX_KEY, "Dependency Matrix", Metric.ValueType.DATA)
.setDescription("Dependency Matrix")
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(false)
@@ -1759,8 +1759,16 @@ public final class CoreMetrics {
.setDeleteHistoricalData(true)
.create();
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String DIRECTORY_CYCLES_KEY = "package_cycles";
- public static final Metric<Integer> DIRECTORY_CYCLES = new Metric.Builder(DIRECTORY_CYCLES_KEY, "Directory cycles", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> DIRECTORY_CYCLES = new Metric.Builder(DIRECTORY_CYCLES_KEY, "Directory cycles", Metric.ValueType.INT)
.setDescription("Directory cycles")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1780,8 +1788,16 @@ public final class CoreMetrics {
@Deprecated
public static final transient Metric<Integer> PACKAGE_CYCLES = DIRECTORY_CYCLES;
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String DIRECTORY_TANGLE_INDEX_KEY = "package_tangle_index";
- public static final Metric<Double> DIRECTORY_TANGLE_INDEX = new Metric.Builder(DIRECTORY_TANGLE_INDEX_KEY, "Directory tangle index", Metric.ValueType.PERCENT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Double> DIRECTORY_TANGLE_INDEX = new Metric.Builder(DIRECTORY_TANGLE_INDEX_KEY, "Directory tangle index", Metric.ValueType.PERCENT)
.setDescription("Directory tangle index")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1800,8 +1816,16 @@ public final class CoreMetrics {
@Deprecated
public static final transient Metric<Double> PACKAGE_TANGLE_INDEX = DIRECTORY_TANGLE_INDEX;
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String DIRECTORY_TANGLES_KEY = "package_tangles";
- public static final Metric<Integer> DIRECTORY_TANGLES = new Metric.Builder(DIRECTORY_TANGLES_KEY, "File dependencies to cut", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> DIRECTORY_TANGLES = new Metric.Builder(DIRECTORY_TANGLES_KEY, "File dependencies to cut", Metric.ValueType.INT)
.setDescription("File dependencies to cut")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
@@ -1820,8 +1844,16 @@ public final class CoreMetrics {
@Deprecated
public static final transient Metric<Integer> PACKAGE_TANGLES = DIRECTORY_TANGLES;
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String DIRECTORY_FEEDBACK_EDGES_KEY = "package_feedback_edges";
- public static final Metric<Integer> DIRECTORY_FEEDBACK_EDGES = new Metric.Builder(DIRECTORY_FEEDBACK_EDGES_KEY, "Package dependencies to cut", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> DIRECTORY_FEEDBACK_EDGES = new Metric.Builder(DIRECTORY_FEEDBACK_EDGES_KEY, "Package dependencies to cut", Metric.ValueType.INT)
.setDescription("Package dependencies to cut")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
@@ -1841,8 +1873,16 @@ public final class CoreMetrics {
@Deprecated
public static final transient Metric<Integer> PACKAGE_FEEDBACK_EDGES = DIRECTORY_FEEDBACK_EDGES;
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String DIRECTORY_EDGES_WEIGHT_KEY = "package_edges_weight";
- public static final Metric<Integer> DIRECTORY_EDGES_WEIGHT = new Metric.Builder(DIRECTORY_EDGES_WEIGHT_KEY, "Directory edges weight", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> DIRECTORY_EDGES_WEIGHT = new Metric.Builder(DIRECTORY_EDGES_WEIGHT_KEY, "Directory edges weight", Metric.ValueType.INT)
.setDescription("Directory edges weight")
.setDirection(Metric.DIRECTION_BETTER)
.setQualitative(false)
@@ -1863,8 +1903,16 @@ public final class CoreMetrics {
@Deprecated
public static final transient Metric<Integer> PACKAGE_EDGES_WEIGHT = DIRECTORY_EDGES_WEIGHT;
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String FILE_CYCLES_KEY = "file_cycles";
- public static final Metric<Integer> FILE_CYCLES = new Metric.Builder(FILE_CYCLES_KEY, "File cycles", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> FILE_CYCLES = new Metric.Builder(FILE_CYCLES_KEY, "File cycles", Metric.ValueType.INT)
.setDescription("File cycles")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1874,8 +1922,16 @@ public final class CoreMetrics {
.setBestValue(0.0)
.create();
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String FILE_TANGLE_INDEX_KEY = "file_tangle_index";
- public static final Metric<Double> FILE_TANGLE_INDEX = new Metric.Builder(FILE_TANGLE_INDEX_KEY, "File tangle index", Metric.ValueType.PERCENT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Double> FILE_TANGLE_INDEX = new Metric.Builder(FILE_TANGLE_INDEX_KEY, "File tangle index", Metric.ValueType.PERCENT)
.setDescription("File tangle index")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
@@ -1885,8 +1941,16 @@ public final class CoreMetrics {
.setBestValue(0.0)
.create();
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String FILE_TANGLES_KEY = "file_tangles";
- public static final Metric<Integer> FILE_TANGLES = new Metric.Builder(FILE_TANGLES_KEY, "File tangles", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> FILE_TANGLES = new Metric.Builder(FILE_TANGLES_KEY, "File tangles", Metric.ValueType.INT)
.setDescription("Files tangles")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
@@ -1895,8 +1959,16 @@ public final class CoreMetrics {
.setDeleteHistoricalData(true)
.create();
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String FILE_FEEDBACK_EDGES_KEY = "file_feedback_edges";
- public static final Metric<Integer> FILE_FEEDBACK_EDGES = new Metric.Builder(FILE_FEEDBACK_EDGES_KEY, "Suspect file dependencies", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> FILE_FEEDBACK_EDGES = new Metric.Builder(FILE_FEEDBACK_EDGES_KEY, "Suspect file dependencies", Metric.ValueType.INT)
.setDescription("Suspect file dependencies")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
@@ -1906,8 +1978,16 @@ public final class CoreMetrics {
.setBestValue(0.0)
.create();
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
public static final String FILE_EDGES_WEIGHT_KEY = "file_edges_weight";
- public static final Metric<Integer> FILE_EDGES_WEIGHT = new Metric.Builder(FILE_EDGES_WEIGHT_KEY, "File edges weight", Metric.ValueType.INT)
+ /**
+ * @deprecated since 5.2 No more design features
+ */
+ @Deprecated
+ public static final transient Metric<Integer> FILE_EDGES_WEIGHT = new Metric.Builder(FILE_EDGES_WEIGHT_KEY, "File edges weight", Metric.ValueType.INT)
.setDescription("File edges weight")
.setDirection(Metric.DIRECTION_BETTER)
.setQualitative(false)
@@ -1938,7 +2018,7 @@ public final class CoreMetrics {
* @deprecated since 5.0 SCM data will no more be stored as measures
*/
@Deprecated
- public static final Metric<String> SCM_AUTHORS_BY_LINE = new Metric.Builder(SCM_AUTHORS_BY_LINE_KEY, "Authors by line", Metric.ValueType.DATA)
+ public static final transient Metric<String> SCM_AUTHORS_BY_LINE = new Metric.Builder(SCM_AUTHORS_BY_LINE_KEY, "Authors by line", Metric.ValueType.DATA)
.setDomain(DOMAIN_SCM)
.create();
@@ -1958,7 +2038,7 @@ public final class CoreMetrics {
* @deprecated since 5.0 SCM data will no more be stored as measures
*/
@Deprecated
- public static final Metric<String> SCM_REVISIONS_BY_LINE = new Metric.Builder(SCM_REVISIONS_BY_LINE_KEY, "Revisions by line", Metric.ValueType.DATA)
+ public static final transient Metric<String> SCM_REVISIONS_BY_LINE = new Metric.Builder(SCM_REVISIONS_BY_LINE_KEY, "Revisions by line", Metric.ValueType.DATA)
.setDomain(DOMAIN_SCM)
.create();
@@ -1978,7 +2058,7 @@ public final class CoreMetrics {
* @deprecated since 5.0 SCM data will no more be stored as measures
*/
@Deprecated
- public static final Metric<String> SCM_LAST_COMMIT_DATETIMES_BY_LINE = new Metric.Builder(SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY, "Last commit dates by line",
+ public static final transient Metric<String> SCM_LAST_COMMIT_DATETIMES_BY_LINE = new Metric.Builder(SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY, "Last commit dates by line",
Metric.ValueType.DATA)
.setDomain(DOMAIN_SCM)
.create();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
index 607d2ea9640..d75fd75fce2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
@@ -21,6 +21,10 @@ package org.sonar.api.resources;
import org.apache.commons.lang.builder.ToStringBuilder;
+/**
+ * @deprecated since 5.2 No more design features
+ */
+@Deprecated
public final class Library extends Resource {
private String name;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
index 80e12802b63..1aa25c066de 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
@@ -46,7 +46,9 @@ public final class Qualifiers {
/**
* Library, for example a JAR dependency of Java projects.
* Scope of libraries is Scopes.PROJECT
+ * @deprecated since 5.2 No more design features
*/
+ @Deprecated
public static final String LIBRARY = "LIB";
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
index 4241f174b5a..b3ab973e7ac 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
@@ -135,8 +135,9 @@ public final class ResourceUtils {
}
/**
- * @return whether a resource is a library
+ * @deprecated since 5.2 No more design features
*/
+ @Deprecated
public static boolean isLibrary(Resource resource) {
return Qualifiers.LIBRARY.equals(resource.getQualifier());
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java
index 2cc8c26107c..5d5f0bf7027 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java
@@ -20,6 +20,8 @@
package org.sonar.api.technicaldebt.batch.internal;
+import java.util.Date;
+import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -28,10 +30,6 @@ import org.sonar.api.technicaldebt.batch.Requirement;
import org.sonar.api.utils.WorkUnit;
import org.sonar.api.utils.internal.WorkDuration;
-import javax.annotation.CheckForNull;
-
-import java.util.Date;
-
/**
* @deprecated since 4.3
*/
@@ -207,7 +205,7 @@ public class DefaultRequirement implements Requirement {
return this;
}
- public static WorkDuration.UNIT toUnit(String requirementUnit){
+ public static WorkDuration.UNIT toUnit(String requirementUnit) {
if (WorkUnit.DAYS.equals(requirementUnit)) {
return WorkDuration.UNIT.DAYS;
} else if (WorkUnit.HOURS.equals(requirementUnit)) {
@@ -218,7 +216,7 @@ public class DefaultRequirement implements Requirement {
throw new IllegalStateException("Invalid unit : " + requirementUnit);
}
- private static String fromUnit(WorkDuration.UNIT unit){
+ private static String fromUnit(WorkDuration.UNIT unit) {
if (WorkDuration.UNIT.DAYS.equals(unit)) {
return WorkUnit.DAYS;
} else if (WorkDuration.UNIT.HOURS.equals(unit)) {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
index 8fcc6f3a6ce..eef71735990 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
@@ -168,17 +168,6 @@ public class SensorContextTesterTest {
}
@Test
- public void testDependencies() {
- assertThat(tester.dependencies()).isEmpty();
- tester.newDependency()
- .from(new DefaultInputFile("foo", "src/Foo.java"))
- .to(new DefaultInputFile("foo", "src/Foo2.java"))
- .weight(3)
- .save();
- assertThat(tester.dependencies()).hasSize(1);
- }
-
- @Test
public void testLineHits() {
assertThat(tester.lineHits("foo:src/Foo.java", CoverageType.UNIT, 1)).isNull();
assertThat(tester.lineHits("foo:src/Foo.java", CoverageType.UNIT, 4)).isNull();
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/design/DependencyTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/design/DependencyTest.java
deleted file mode 100644
index 3e6618cb37b..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/design/DependencyTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.design;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DependencyTest {
-
- @Test
- public void equalsAndHashCode() {
- DependencyDto dep1 = new DependencyDto().setFromSnapshotId(10).setToSnapshotId(30);
- DependencyDto dep1Clone = new DependencyDto().setFromSnapshotId(10).setToSnapshotId(30);
- DependencyDto dep2 = new DependencyDto().setFromSnapshotId(10).setToSnapshotId(31);
-
- assertThat(dep1.equals(dep2)).isFalse();
- assertThat(dep1.equals(dep1)).isTrue();
- assertThat(dep1.equals(dep1Clone)).isTrue();
-
- assertThat(dep1.hashCode()).isEqualTo(dep1.hashCode());
- assertThat(dep1.hashCode()).isEqualTo(dep1Clone.hashCode());
- assertThat(dep1.toString()).isEqualTo(dep1.toString());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void weightCanNotBeNegative() {
- new DependencyDto().setWeight(-2);
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java
index 14b0b7bf6ba..47b7e26ca9a 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java
@@ -72,7 +72,6 @@ public class ResourceUtilsTest {
assertThat(ResourceUtils.isPersistable(File.create("Foo.java"))).isTrue();
assertThat(ResourceUtils.isPersistable(Directory.create("bar/Foo.java"))).isTrue();
assertThat(ResourceUtils.isPersistable(new Project("foo"))).isTrue();
- assertThat(ResourceUtils.isPersistable(new Library("foo", "1.2"))).isTrue();
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ScopesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ScopesTest.java
index 8364aed52c1..a3561acc9c8 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ScopesTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ScopesTest.java
@@ -37,16 +37,6 @@ public class ScopesTest {
}
@Test
- public void testLibrary() {
- Resource resource = new Library("key", "1.0");
- assertThat(Scopes.isProject(resource), is(true));
- assertThat(Scopes.isDirectory(resource), is(false));
- assertThat(Scopes.isFile(resource), is(false));
- assertThat(Scopes.isBlockUnit(resource), is(false));
- assertThat(Scopes.isProgramUnit(resource), is(false));
- }
-
- @Test
public void testDirectory() {
Resource resource = Directory.create("org/foo");
assertThat(Scopes.isProject(resource), is(false));