aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java12
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java25
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java39
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java26
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java13
9 files changed, 67 insertions, 73 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java
index 37945f608bd..b20016abef4 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java
@@ -31,9 +31,10 @@ import java.util.Arrays;
import java.util.List;
/**
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore
- * @since 2.1
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore
+ * @since 1.10
*/
+@Deprecated
public abstract class AbstractFileComplexityDecorator implements Decorator {
private Language language;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java
index 1a17608f1d7..2406a8868c0 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java
@@ -30,9 +30,10 @@ import java.util.Arrays;
import java.util.List;
/**
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore
- * @since 2.1
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore
+ * @since 1.13
*/
+@Deprecated
public abstract class AbstractFunctionComplexityDecorator implements Decorator {
private Language language;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java
index e6323ffa720..6ea9adeefeb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java
@@ -20,19 +20,19 @@
package org.sonar.api.batch;
-import org.sonar.api.measures.CountDistributionBuilder;
import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Metric;
+import org.sonar.api.measures.CountDistributionBuilder;
import org.sonar.api.measures.Measure;
+import org.sonar.api.measures.Metric;
+import org.sonar.api.resources.Language;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
-import org.sonar.api.resources.Language;
-
/**
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore
- * @since 2.1
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore
+ * @since 2.0
*/
+@Deprecated
public abstract class AbstractFunctionComplexityDistributionDecorator implements Decorator {
private CountDistributionBuilder builder = new CountDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);
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 837cb557978..dc5c5b9dc58 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
@@ -50,10 +50,8 @@ public interface DecoratorContext {
/**
* Child contexts are read only
*/
-
List<DecoratorContext> getChildren();
-
// MEASURES
/**
@@ -76,21 +74,21 @@ public interface DecoratorContext {
*/
Collection<Measure> getChildrenMeasures(Metric metric);
-
/**
* Add a measure on the current resource. It can not be executed from children contexts.
- *
+ *
* @return the same context
*/
DecoratorContext saveMeasure(Measure measure);
/**
* Add a measure on the current resource. It can not be executed from children contexts.
- *
+ *
* @return the current object
*/
DecoratorContext saveMeasure(Metric metric, Double value);
+ // DEPENDENCIES
Dependency saveDependency(Dependency dependency);
@@ -100,7 +98,6 @@ public interface DecoratorContext {
Collection<Dependency> getOutgoingDependencies();
-
// RULES
/**
@@ -112,7 +109,7 @@ public interface DecoratorContext {
* Save a coding rule violation. The decorator which calls this method must be depended upon BatchBarriers.END_OF_VIOLATIONS_GENERATION.
*
* @since 2.5
- * @param force allows to force creation of violation even if it was supressed by {@link org.sonar.api.rules.ViolationFilter}
+ * @param force allows to force creation of violation even if it was suppressed by {@link org.sonar.api.rules.ViolationFilter}
*/
DecoratorContext saveViolation(Violation violation, boolean force);
@@ -121,6 +118,8 @@ public interface DecoratorContext {
*/
DecoratorContext saveViolation(Violation violation);
+ // EVENTS
+
/**
* @return the list of events associated to the current resource
*/
@@ -128,22 +127,20 @@ public interface DecoratorContext {
/**
* Creates an event for a given date
- *
- * @param name the event name
+ *
+ * @param name the event name
* @param description the event description
- * @param category the event category
- * @param date the event date
+ * @param category the event category
+ * @param date the event date
* @return the created event
*/
Event createEvent(String name, String description, String category, Date date);
/**
* Deletes an event
- *
+ *
* @param event the event to delete
*/
void deleteEvent(Event event);
-
-
}
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 e1082ecdf3e..ae0f10862c4 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
@@ -59,7 +59,6 @@ public interface SensorContext {
*/
Measure saveMeasure(Metric metric, Double value);
-
// ----------- MEASURES ON RESOURCES --------------
/**
@@ -69,7 +68,7 @@ public interface SensorContext {
/**
* Key is updated when saving the resource.
- *
+ *
* @return the key as saved in database. Null if the resource is set as excluded.
*/
String saveResource(Resource resource);
@@ -86,19 +85,22 @@ public interface SensorContext {
/**
* Add or update a measure.
- * <p/>
- * <p>The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as excluded.</p>
+ * <p>
+ * The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as
+ * excluded.
+ * </p>
*/
Measure saveMeasure(Resource resource, Metric metric, Double value);
/**
* Add or update a measure.
- * <p/>
- * <p>The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as excluded.</p>
+ * <p>
+ * The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as
+ * excluded.
+ * </p>
*/
Measure saveMeasure(Resource resource, Measure measure);
-
// ----------- RULE VIOLATIONS --------------
/**
@@ -108,7 +110,7 @@ public interface SensorContext {
* @param force allows to force creation of violation even if it was supressed by {@link org.sonar.api.rules.ViolationFilter}
*/
void saveViolation(Violation violation, boolean force);
-
+
/**
* Save a coding rule violation.
*/
@@ -119,8 +121,7 @@ public interface SensorContext {
*/
void saveViolations(Collection<Violation> violations);
-
- // ----------- DEPENDENCIES BETWEEN RESOURCES --------------
+ // ----------- DEPENDENCIES BETWEEN RESOURCES --------------
/**
* Build a new dependency : from depends upon to. The dependency is NOT saved. The method saveDependency() must still be executed.
@@ -133,19 +134,18 @@ public interface SensorContext {
Collection<Dependency> getOutgoingDependencies(Resource from);
- // ----------- FILE SOURCES --------------
+ // ----------- FILE SOURCES --------------
/**
* Does nothing if the resource is set as excluded.
*/
void saveSource(Resource resource, String source);
-
// ----------- LINKS --------------
/**
- * add a link to an external page like project homepage, sources (subversion, ...), continuous integration server...
- * Example : context.addLink(new ProjectLink("maven_site, "Maven site", "http://my.maven.com)
+ * add a link to an external page like project homepage, sources (subversion, ...), continuous integration server... Example :
+ * context.addLink(new ProjectLink("maven_site, "Maven site", "http://my.maven.com)
*/
void saveLink(ProjectLink link);
@@ -154,7 +154,6 @@ public interface SensorContext {
*/
void deleteLink(String key);
-
// ----------- EVENTS --------------
/**
@@ -164,18 +163,18 @@ public interface SensorContext {
/**
* Creates an event for a given date
- *
- * @param name the event name
+ *
+ * @param name the event name
* @param description the event description
- * @param category the event category
- * @param date the event date
+ * @param category the event category
+ * @param date the event date
* @return the created event
*/
Event createEvent(Resource resource, String name, String description, String category, Date date);
/**
* Deletes an event
- *
+ *
* @param event the event to delete
*/
void deleteEvent(Event event);
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 84daac57437..1681a06b108 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
@@ -68,7 +68,7 @@ public class Library extends Resource {
@Override
public String getScope() {
- return Resource.SCOPE_PROJECT;
+ return Resource.SCOPE_SET;
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
index 24a47bfe1a0..d6ef7c3a0e6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
@@ -29,8 +29,7 @@ import java.util.List;
*/
public interface ProjectFileSystem {
/**
- * Source encoding. It's the default plateform charset if it is not defined in the project
- * (Maven property 'project.build.sourceEncoding').
+ * Source encoding. It's the default platform charset if it is not defined in the project (Maven property 'project.build.sourceEncoding').
*/
Charset getSourceCharset();
@@ -59,20 +58,20 @@ public interface ProjectFileSystem {
File getSonarWorkingDirectory();
/**
- * Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or resolvePath("src/main/java")
+ * Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or
+ * resolvePath("src/main/java")
*/
File resolvePath(String path);
/**
* Source files, excluding unit tests and files matching project exclusion patterns.
- *
+ *
* @param langs language filter. Check all files, whatever their language, if null or empty.
*/
List<File> getSourceFiles(Language... langs);
/**
- * Java source files, excluding unit tests and files matching project exclusion patterns.
- * Shortcut for getSourceFiles(Java.INSTANCE)
+ * Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE)
*/
List<File> getJavaSourceFiles();
@@ -93,7 +92,7 @@ public interface ProjectFileSystem {
/**
* Save data into a new file of Sonar working directory.
- *
+ *
* @return the created file
*/
File writeToWorkingDirectory(String content, String fileName) throws IOException;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
index 32862e6bd7d..0b470243b67 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
@@ -21,7 +21,7 @@ package org.sonar.api.resources;
/**
* The interface to implement to create a resource in Sonar
- *
+ *
* @since 1.10
*/
public abstract class Resource<PARENT extends Resource> {
@@ -29,26 +29,25 @@ public abstract class Resource<PARENT extends Resource> {
public static final String SCOPE_SET = "PRJ";
public static final String SCOPE_SPACE = "DIR";
public static final String SCOPE_ENTITY = "FIL";
-
+
/**
- * Use SCOPE_SET instead
+ * @deprecated since 1.11, use {@link #SCOPE_SET} instead.
*/
@Deprecated
public static final String SCOPE_PROJECT = SCOPE_SET;
/**
- * Use SCOPE_SPACE instead
+ * @deprecated since 1.11, use {@link #SCOPE_SPACE} instead.
*/
@Deprecated
public static final String SCOPE_DIRECTORY = SCOPE_SPACE;
/**
- * Use SCOPE_ENTITY instead
+ * @deprecated since 1.11, use {@link #SCOPE_ENTITY} instead.
*/
@Deprecated
public static final String SCOPE_FILE = SCOPE_ENTITY;
-
public static final String QUALIFIER_VIEW = "VW";
public static final String QUALIFIER_SUBVIEW = "SVW";
public static final String QUALIFIER_LIB = "LIB";
@@ -63,13 +62,13 @@ public abstract class Resource<PARENT extends Resource> {
public static final String QUALIFIER_UNIT_TEST_CLASS = "UTS";
/**
- * Use QUALIFIER_PROJECT instead
+ * @deprecated since 1.11, use {@link #QUALIFIER_PROJECT} instead.
*/
@Deprecated
public static final String QUALIFIER_PROJECT_TRUNK = QUALIFIER_PROJECT;
/**
- * Use QUALIFIER_MODULE instead
+ * @deprecated since 1.11, use {@link #QUALIFIER_MODULE} instead.
*/
@Deprecated
public static final String QUALIFIER_PROJECT_BRANCH = QUALIFIER_MODULE;
@@ -82,7 +81,6 @@ public abstract class Resource<PARENT extends Resource> {
private boolean isExcluded = false;
-
/**
* @return the resource key
*/
@@ -126,20 +124,20 @@ public abstract class Resource<PARENT extends Resource> {
/**
* The parent is used to build the resources tree, for example for relations between classes, packages and projects.
- * <p>Return null if the parent is the project.</p>
+ * <p>
+ * Return null if the parent is the project.
+ * </p>
*/
public abstract PARENT getParent();
/**
- * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example
- * to match resource exclusions.
- *
+ * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example to match resource exclusions.
+ *
* @param antPattern Ant-like pattern (with **, * and ?). It includes file suffixes.
* @return true if the resource matches the Ant pattern
*/
public abstract boolean matchFilePattern(String antPattern);
-
public final Integer getId() {
return id;
}
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 830478bede9..e243e8b044a 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
@@ -49,7 +49,7 @@ public final class ResourceUtils {
}
/**
- * @return whther a resource is a maven module of project
+ * @return whether a resource is a maven module of project
*/
public static boolean isModuleProject(Resource resource) {
return Resource.QUALIFIER_MODULE.equals(resource.getQualifier());
@@ -62,7 +62,6 @@ public final class ResourceUtils {
return resource != null && Resource.QUALIFIER_PACKAGE.equals(resource.getQualifier());
}
-
/**
* @return whether a resource is a set
*/
@@ -92,20 +91,19 @@ public final class ResourceUtils {
}
/**
- * Alias for isDirectory(resource)
+ * Alias for {@link #isSpace(Resource)}
*/
public static boolean isDirectory(Resource resource) {
return isSpace(resource);
}
/**
- * Alias for isEntity(resource)
+ * Alias for {@link #isEntity(Resource)}
*/
public static boolean isFile(Resource resource) {
return isEntity(resource);
}
-
/* QUALIFIERS */
/**
@@ -115,7 +113,6 @@ public final class ResourceUtils {
return Resource.QUALIFIER_CLASS.equals(resource.getQualifier());
}
-
/**
* @return whether a resource is a unit test class
*/
@@ -123,7 +120,9 @@ public final class ResourceUtils {
return Resource.QUALIFIER_UNIT_TEST_CLASS.equals(resource.getQualifier());
}
-
+ /**
+ * @return whether a resource is a library
+ */
public static boolean isLibrary(Resource resource) {
return Resource.QUALIFIER_LIB.equals(resource.getQualifier());
}