aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-09-16 22:08:40 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-09-16 22:08:40 +0200
commit98dcf67684b15a34b56aaa6ef7d4cfdf9083f01d (patch)
treea945db60d9b68560837855be3eaabef54d372bf7 /sonar-plugin-api
parent5ba688d8efe094feaba40dc2bcd53e20571f7fd8 (diff)
downloadsonarqube-98dcf67684b15a34b56aaa6ef7d4cfdf9083f01d.tar.gz
sonarqube-98dcf67684b15a34b56aaa6ef7d4cfdf9083f01d.zip
SONAR-4617 Refactoring away from Resource<T>
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/DuplicatedSourceException.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/CoberturaReportParserUtils.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/CoberturaReportParserUtilsTest.java2
7 files changed, 10 insertions, 10 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/DuplicatedSourceException.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DuplicatedSourceException.java
index 5339e8a9b54..7b2732fd2ca 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/DuplicatedSourceException.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DuplicatedSourceException.java
@@ -27,7 +27,7 @@ import org.sonar.api.utils.SonarException;
*/
public final class DuplicatedSourceException extends SonarException {
- public DuplicatedSourceException(Resource<?> resource) {
+ public DuplicatedSourceException(Resource resource) {
super("Duplicate source for resource: " + ObjectUtils.toString(resource));
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
index 6aa786d04e7..3e743c1e336 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
@@ -31,7 +31,7 @@ import java.util.List;
*
* @since 1.10
*/
-public class File extends Resource<Directory> {
+public class File extends Resource {
public static final String SCOPE = Scopes.FILE;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
index 4c8c87e609b..40927c844d9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
@@ -31,7 +31,7 @@ import java.util.List;
*
* @since 1.10
*/
-public class JavaFile extends Resource<JavaPackage> {
+public class JavaFile extends Resource {
private String filename;
private String longName;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
index 51b8d098980..71bed21e468 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
@@ -99,7 +99,7 @@ public class JavaPackage extends Resource {
* {@inheritDoc}
*/
@Override
- public Resource<?> getParent() {
+ public Resource getParent() {
return null;
}
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 c6e22cdd408..05e30d30135 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
@@ -26,7 +26,7 @@ import java.io.Serializable;
*
* @since 1.10
*/
-public abstract class Resource<P extends Resource> implements Serializable {
+public abstract class Resource implements Serializable {
/**
* @deprecated since 2.6. Use Scopes.PROJECT.
@@ -178,7 +178,7 @@ public abstract class Resource<P extends Resource> implements Serializable {
* Return null if the parent is the project.
* </p>
*/
- public abstract P getParent();
+ public abstract Resource getParent();
/**
* Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example to match resource exclusions.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/CoberturaReportParserUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/CoberturaReportParserUtils.java
index 2a18e96a475..71a8a703b80 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/CoberturaReportParserUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/CoberturaReportParserUtils.java
@@ -51,7 +51,7 @@ public class CoberturaReportParserUtils {
/**
* Return a SonarQube file resource from a filename present in Cobertura report
*/
- Resource<?> resolve(String filename);
+ Resource resolve(String filename);
}
/**
@@ -78,7 +78,7 @@ public class CoberturaReportParserUtils {
collectFileMeasures(pack.descendantElementCursor("class"), builderByFilename);
for (Map.Entry<String, CoverageMeasuresBuilder> entry : builderByFilename.entrySet()) {
String filename = sanitizeFilename(entry.getKey());
- Resource<?> file = fileResolver.resolve(filename);
+ Resource file = fileResolver.resolve(filename);
if (fileExists(context, file)) {
for (Measure measure : entry.getValue().createMeasures()) {
context.saveMeasure(file, measure);
@@ -88,7 +88,7 @@ public class CoberturaReportParserUtils {
}
}
- private static boolean fileExists(SensorContext context, Resource<?> file) {
+ private static boolean fileExists(SensorContext context, Resource file) {
return context.getResource(file) != null;
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/CoberturaReportParserUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/CoberturaReportParserUtilsTest.java
index ecab23869c1..9260bcf908d 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/CoberturaReportParserUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/CoberturaReportParserUtilsTest.java
@@ -58,7 +58,7 @@ public class CoberturaReportParserUtilsTest {
private static FileResolver JAVA_FILE_RESOLVER = new FileResolver() {
@Override
- public Resource<?> resolve(String filename) {
+ public Resource resolve(String filename) {
return new JavaFile(filename);
}
};