aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <henryju@yahoo.fr>2016-07-04 11:58:10 +0200
committerJulien HENRY <henryju@yahoo.fr>2016-07-05 14:00:16 +0200
commit103f9ca40fe6c4864aa489119c1590e0449f1b9f (patch)
treea990c8be0e88b324307c2e3163559a42b1cfa0ac /sonar-plugin-api
parentb7fcb4dd974df546cc13faa6be6529ca6bc26688 (diff)
downloadsonarqube-103f9ca40fe6c4864aa489119c1590e0449f1b9f.tar.gz
sonarqube-103f9ca40fe6c4864aa489119c1590e0449f1b9f.zip
SONAR-7727 Remove deprecated stuff from Resources API
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java16
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java81
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java79
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java121
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java88
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java108
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java76
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java50
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java56
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java30
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java17
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java7
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java13
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java114
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java78
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java40
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java46
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java6
20 files changed, 11 insertions, 1032 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index 3ea25fc8b0e..06b0e1a889e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -455,15 +455,6 @@ public class Measure<G extends Serializable> implements Serializable {
}
/**
- * Called by views when cloning measures
- * @deprecated since 4.4 not used
- */
- @Deprecated
- public Measure<G> setId(Long id) {
- return this;
- }
-
- /**
* @return the first variation value
* @since 2.5
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
index d54049aae0e..334b663ea88 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
@@ -20,7 +20,6 @@
package org.sonar.api.platform;
import java.io.File;
-import java.util.List;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
@@ -35,11 +34,4 @@ public interface ServerFileSystem {
File getTempDir();
- /**
- * @param suffixes the file suffixes. If null, then return all the files, whatever their suffix
- * @deprecated since 4.1
- */
- @Deprecated
- List<File> getExtensions(String dirName, String... suffixes);
-
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
index eb89b3bc3f7..fdad251a589 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
@@ -45,22 +45,6 @@ public class Directory extends Resource {
}
/**
- * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
- */
- @Deprecated
- public Directory(String relativePathFromSourceDir) {
- this(relativePathFromSourceDir, null);
- }
-
- /**
- * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
- */
- @Deprecated
- public Directory(String relativePathFromSourceDir, Language language) {
- this.relativePathFromSourceDir = parseKey(relativePathFromSourceDir);
- }
-
- /**
* Internal.
*/
public String relativePathFromSourceDir() {
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 8ce94861a68..2fa8adc4767 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
@@ -19,14 +19,10 @@
*/
package org.sonar.api.resources;
-import java.util.List;
-import javax.annotation.CheckForNull;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.api.utils.WildcardPattern;
/**
@@ -51,50 +47,6 @@ public class File extends Resource {
}
/**
- * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
- */
- @Deprecated
- public File(String relativePathFromSourceDir) {
- if (relativePathFromSourceDir == null) {
- throw new IllegalArgumentException("File key is null");
- }
- this.relativePathFromSourceDir = parseKey(relativePathFromSourceDir);
- }
-
- /**
- * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
- */
- @Deprecated
- public File(String relativeDirectoryPathFromSourceDir, String filename) {
- this.filename = StringUtils.trim(filename);
- if (StringUtils.isBlank(relativeDirectoryPathFromSourceDir)) {
- this.relativePathFromSourceDir = filename;
- } else {
- this.relativePathFromSourceDir = new StringBuilder().append(Directory.parseKey(relativeDirectoryPathFromSourceDir)).append(Directory.SEPARATOR).append(this.filename)
- .toString();
- }
- }
-
- /**
- * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
- */
- @Deprecated
- public File(Language language, String relativePathFromSourceDir) {
- this(relativePathFromSourceDir);
- this.language = language;
- }
-
- /**
- * Creates a File from language, directory and filename
- * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
- */
- @Deprecated
- public File(Language language, String relativeDirectoryPathFromSourceDir, String filename) {
- this(relativeDirectoryPathFromSourceDir, filename);
- this.language = language;
- }
-
- /**
* Internal.
*/
public String relativePathFromSourceDir() {
@@ -133,39 +85,6 @@ public class File extends Resource {
}
/**
- * Creates a File from an io.file and a list of sources directories
- * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
- */
- @Deprecated
- @CheckForNull
- public static File fromIOFile(java.io.File file, List<java.io.File> sourceDirs) {
- PathResolver.RelativePath relativePath = new PathResolver().relativePath(sourceDirs, file);
- if (relativePath != null) {
- return new File(relativePath.path());
- }
- return null;
- }
-
- /**
- * Creates a {@link File} from an absolute {@link java.io.File} and a module.
- * The returned {@link File} can be then passed for example to
- * {@link SensorContext#saveMeasure(Resource, org.sonar.api.measures.Measure)}.
- * @param file absolute path to a file
- * @param module
- * @return null if the file is not under module basedir.
- * @deprecated since 4.5 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
- */
- @Deprecated
- @CheckForNull
- public static File fromIOFile(java.io.File file, Project module) {
- String relativePathFromBasedir = new PathResolver().relativePath(module.getBaseDir(), file);
- if (relativePathFromBasedir != null) {
- return File.create(relativePathFromBasedir);
- }
- return null;
- }
-
- /**
* {@inheritDoc}
*
* @see Resource#getName()
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java
deleted file mode 100644
index 374c662a8db..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Java language implementation
- * This class have been moved in the plugin sonar-java
- *
- * @since 1.10
- * @deprecated in 3.6
- */
-@Deprecated
-public class Java extends AbstractLanguage {
-
- public static final Java INSTANCE = new Java();
-
- /**
- * Java key
- */
- public static final String KEY = "java";
-
- /**
- * Java name
- */
- public static final String NAME = "Java";
-
- /**
- * Default package name for classes without package def
- */
- public static final String DEFAULT_PACKAGE_NAME = "[default]";
-
- /**
- * Java files knows suffixes
- */
- public static final String[] SUFFIXES = {".java", ".jav"};
-
- /**
- * Default constructor
- */
- public Java() {
- super(KEY, NAME);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see AbstractLanguage#getFileSuffixes()
- */
- @Override
- public String[] getFileSuffixes() {
- return SUFFIXES;
- }
-
- public static boolean isJavaFile(java.io.File file) {
- String suffix = "." + StringUtils.lowerCase(StringUtils.substringAfterLast(file.getName(), "."));
- return ArrayUtils.contains(SUFFIXES, suffix);
- }
-
-}
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
deleted file mode 100644
index 18c62350e53..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * A class that represents a Java class. This class can either be a Test class or source class
- *
- * @since 1.10
- * @deprecated since 4.2 use {@link org.sonar.api.resources.File}. See
- * http://docs.codehaus.org/display/SONAR/API+Changes for more details
- */
-@Deprecated
-public class JavaFile extends Resource {
-
- @VisibleForTesting
- JavaFile() {
- }
-
- public JavaFile(String packageName, String className) {
- throw unsupported();
- }
-
- public JavaFile(String packageKey, String className, boolean unitTest) {
- throw unsupported();
- }
-
- public JavaFile(String deprecatedKey) {
- throw unsupported();
- }
-
- public JavaFile(String deprecatedKey, boolean unitTest) {
- throw unsupported();
- }
-
- @Override
- public JavaPackage getParent() {
- throw unsupported();
- }
-
- @Override
- public String getDescription() {
- throw unsupported();
- }
-
- @Override
- public Language getLanguage() {
- throw unsupported();
- }
-
- @Override
- public String getName() {
- throw unsupported();
- }
-
- @Override
- public String getLongName() {
- throw unsupported();
- }
-
- @Override
- public String getScope() {
- throw unsupported();
- }
-
- @Override
- public String getQualifier() {
- throw unsupported();
- }
-
- public boolean isUnitTest() {
- throw unsupported();
- }
-
- @Override
- public boolean matchFilePattern(String antPattern) {
- throw unsupported();
- }
-
- public static JavaFile fromIOFile(File file, Project module, boolean unitTest) {
- throw unsupported();
- }
-
- public static JavaFile fromRelativePath(String relativePath, boolean unitTest) {
- throw unsupported();
- }
-
- public static JavaFile fromIOFile(File file, List<File> sourceDirs, boolean unitTest) {
- throw unsupported();
- }
-
- public static JavaFile fromAbsolutePath(String path, List<File> sourceDirs, boolean unitTest) {
- throw unsupported();
- }
-
- private static UnsupportedOperationException unsupported() {
- throw new UnsupportedOperationException("Not supported since v4.2. See http://redirect.sonarsource.com/doc/api-changes.html");
- }
-
-}
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
deleted file mode 100644
index 98462574b99..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-/**
- * A class that represents a Java package in Sonar
- *
- * @since 1.10
- * @deprecated since 4.2 use {@link Directory} instead
- */
-@Deprecated
-public class JavaPackage extends Resource {
-
- public static final String DEFAULT_PACKAGE_NAME = "[default]";
-
- public JavaPackage() {
- // For testing
- }
-
- public JavaPackage(String deprecatedKey) {
- throw unsupported();
- }
-
- public boolean isDefault() {
- throw unsupported();
- }
-
- @Override
- public boolean matchFilePattern(String antPattern) {
- throw unsupported();
- }
-
- @Override
- public String getDescription() {
- throw unsupported();
- }
-
- @Override
- public String getScope() {
- throw unsupported();
- }
-
- @Override
- public String getQualifier() {
- throw unsupported();
- }
-
- @Override
- public String getName() {
- throw unsupported();
- }
-
- @Override
- public Resource getParent() {
- throw unsupported();
- }
-
- @Override
- public String getLongName() {
- throw unsupported();
- }
-
- @Override
- public Language getLanguage() {
- throw unsupported();
- }
-
- private static UnsupportedOperationException unsupported() {
- throw new UnsupportedOperationException("Not supported since v4.2. See http://redirect.sonarsource.com/doc/api-changes.html");
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java
deleted file mode 100644
index 5de0b8fed47..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-/**
- * @deprecated in 4.2. Only file system components are managed by SQ core (files/directories).
- */
-@Deprecated
-public class Method extends Resource {
-
- public static final String SCOPE = Scopes.BLOCK_UNIT;
-
- protected String qualifier;
- protected Language language;
-
- protected Method(String key, String qualifier, Language language) {
- setKey(key);
- this.qualifier = qualifier;
- this.language = language;
- }
-
- @Override
- public String getName() {
- return getKey();
- }
-
- @Override
- public String getLongName() {
- return getKey();
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public final Language getLanguage() {
- return language;
- }
-
- @Override
- public final String getScope() {
- return SCOPE;
- }
-
- @Override
- public final String getQualifier() {
- return qualifier;
- }
-
- @Override
- public Resource getParent() {
- return null;
- }
-
- @Override
- public final boolean matchFilePattern(String antPattern) {
- return false;
- }
-
- @Override
- public final boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof Method)) {
- return false;
- }
- Method method = (Method) o;
- if (!getKey().equals(method.getKey())) {
- return false;
- }
- if (!qualifier.equals(method.qualifier)) {
- return false;
- }
- return true;
- }
-
- @Override
- public final int hashCode() {
- int result = super.hashCode();
- result = 31 * result + qualifier.hashCode();
- result = 31 * result + getKey().hashCode();
- return result;
- }
-
- public static Method createMethod(String key, Language language) {
- return new Method(key, Qualifiers.METHOD, language);
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
index 238084692a2..6c88617a87e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
@@ -53,30 +53,11 @@ public class Project extends Resource implements Component {
public static final String SCOPE = Scopes.PROJECT;
- /**
- * Enumerates the type of possible analysis
- * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report.
- */
- @Deprecated
- public enum AnalysisType {
- STATIC, DYNAMIC, REUSE_REPORTS;
-
- /**
- * @param includeReuseReportMode whether to count report reuse as dynamic or not
- * @return whether this a dynamic analysis
- */
- public boolean isDynamic(boolean includeReuseReportMode) {
- return equals(Project.AnalysisType.DYNAMIC) ||
- (equals(Project.AnalysisType.REUSE_REPORTS) && includeReuseReportMode);
- }
- }
-
private String branch;
private String name;
private String description;
private Language language;
private Date analysisDate;
- private AnalysisType analysisType;
private String analysisVersion;
private Settings settings;
@@ -139,6 +120,11 @@ public class Project extends Resource implements Component {
return this;
}
+ @Override
+ public Language getLanguage() {
+ return null;
+ }
+
/**
* For internal use only.
*/
@@ -166,34 +152,6 @@ public class Project extends Resource implements Component {
}
/**
- * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report.
- */
- @Deprecated
- public AnalysisType getAnalysisType() {
- return analysisType;
- }
-
- /**
- * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report.
- */
- @Deprecated
- public Project setAnalysisType(AnalysisType at) {
- this.analysisType = at;
- return this;
- }
-
- /**
- * whether it's the latest analysis done on this project (displayed in sonar dashboard) or an analysis on a past revision.
- *
- * @since 2.0
- * @deprecated in 3.6. The analysis is now always the latest one (past analysis must be done in a chronological order). See http://jira.sonarsource.com/browse/SONAR-4334
- */
- @Deprecated
- public boolean isLatestAnalysis() {
- return true;
- }
-
- /**
* For internal use only.
*
* @deprecated in 3.6. It's not possible to analyze a project before the latest known quality snapshot.
@@ -209,27 +167,9 @@ public class Project extends Resource implements Component {
}
/**
- * @return the project language when there is only one language
- * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()}
- */
- @Deprecated
- @Override
- public Language getLanguage() {
- return language;
- }
-
- /**
- * Internal use
- */
- public Project setLanguage(Language language) {
- this.language = language;
- return this;
- }
-
- /**
- * @return the language key or empty if no language is specified
- * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()}
- */
+ * @return the language key or empty if no language is specified
+ * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()}
+ */
@Deprecated
public String getLanguageKey() {
if (settings == null) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
deleted file mode 100644
index 8d92fed539a..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import com.google.common.collect.Lists;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @since 1.10
- * @deprecated see method comments
- */
-@Deprecated
-public final class ProjectUtils {
-
- private ProjectUtils() {
- // utility class with only static methods
- }
-
- /**
- * @since 2.7
- * @deprecated in 4.2. Replaced by org.sonar.api.resources.InputFileUtils#toFiles()
- */
- @Deprecated
- public static List<java.io.File> toIoFiles(Collection<InputFile> inputFiles) {
- List<java.io.File> files = Lists.newArrayList();
- for (InputFile inputFile : inputFiles) {
- files.add(inputFile.getFile());
- }
- return files;
- }
-}
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 6190190e991..b66930059ad 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
@@ -63,33 +63,8 @@ public final class Qualifiers {
*/
public static final String MODULE = "BRC";
- /**
- * @deprecated since 4.2 now packages are considered as regular directories. Use {@link #DIRECTORY} instead.
- */
- @Deprecated
- public static final String PACKAGE = "PAC";
public static final String DIRECTORY = "DIR";
public static final String FILE = "FIL";
- /**
- * @deprecated since 4.2 now java files are considered as regular files. Use {@link #FILE} instead.
- */
- @Deprecated
- public static final String CLASS = "CLA";
- /**
- * @deprecated since 4.2 resources under FILE level will no more be supported.
- */
- @Deprecated
- public static final String PARAGRAPH = "PAR";
- /**
- * @deprecated since 4.2 resources under FILE level will no more be supported.
- */
- @Deprecated
- public static final String METHOD = "MET";
- /**
- * @deprecated since 4.2 resources under FILE level will no more be supported.
- */
- @Deprecated
- public static final String FIELD = "FLD";
// ugly, should be replaced by "natures"
public static final String UNIT_TEST_FILE = "UTS";
@@ -139,40 +114,9 @@ public final class Qualifiers {
}
/**
- * @deprecated since 4.2 Package is now a directory. Use {@link #isDirectory(Resource)}
- */
- @Deprecated
- public static boolean isPackage(final Resource resource) {
- return StringUtils.equals(PACKAGE, resource.getQualifier()) || isDirectory(resource);
- }
-
- /**
* @param resource not nullable
*/
public static boolean isFile(final Resource resource) {
return StringUtils.equals(FILE, resource.getQualifier());
}
-
- /**
- * @param resource not nullable
- * @deprecated since 4.2 CLA qualifier is deprecated
- */
- @Deprecated
- public static boolean isClass(final Resource resource) {
- return StringUtils.equals(CLASS, resource.getQualifier()) || isFile(resource);
- }
-
- /**
- * @param resource not nullable
- */
- public static boolean isMethod(final Resource resource) {
- return StringUtils.equals(METHOD, resource.getQualifier());
- }
-
- /**
- * @param resource not nullable
- */
- public static boolean isParagraph(final Resource resource) {
- return StringUtils.equals(PARAGRAPH, resource.getQualifier());
- }
}
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 fa9447168b3..79454dd456b 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
@@ -81,12 +81,6 @@ public abstract class Resource implements Serializable {
public static final String QUALIFIER_MODULE = Qualifiers.MODULE;
/**
- * @deprecated since 2.6. Use Qualifiers.PACKAGE.
- */
- @Deprecated
- public static final String QUALIFIER_PACKAGE = Qualifiers.PACKAGE;
-
- /**
* @deprecated since 2.6. Use Qualifiers.DIRECTORY.
*/
@Deprecated
@@ -98,30 +92,6 @@ public abstract class Resource implements Serializable {
@Deprecated
public static final String QUALIFIER_FILE = Qualifiers.FILE;
- /**
- * @deprecated since 2.6. Use Qualifiers.CLASS.
- */
- @Deprecated
- public static final String QUALIFIER_CLASS = Qualifiers.CLASS;
-
- /**
- * @deprecated since 2.6. Use Qualifiers.FIELD.
- */
- @Deprecated
- public static final String QUALIFIER_FIELD = Qualifiers.FIELD;
-
- /**
- * @deprecated since 2.6. Use Qualifiers.METHOD.
- */
- @Deprecated
- public static final String QUALIFIER_METHOD = Qualifiers.METHOD;
-
- /**
- * @deprecated since 2.6. Use Qualifiers.UNIT_TEST_FILE.
- */
- @Deprecated
- public static final String QUALIFIER_UNIT_TEST_CLASS = Qualifiers.UNIT_TEST_FILE;
-
private Integer id;
private String key;
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 8373a5f89a1..6f29811822e 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
@@ -60,14 +60,6 @@ public final class ResourceUtils {
}
/**
- * @deprecated since 4.2 Package are now directory. Use {@link #isDirectory(Resource)}
- */
- @Deprecated
- public static boolean isPackage(Resource resource) {
- return resource != null && Qualifiers.PACKAGE.equals(resource.getQualifier());
- }
-
- /**
* @return whether a resource is a set
*/
public static boolean isSet(Resource resource) {
@@ -112,15 +104,6 @@ public final class ResourceUtils {
/* QUALIFIERS */
/**
- * @return whether a resource is a class
- * @deprecated since 4.2 CLA qualifier is deprecated
- */
- @Deprecated
- public static boolean isClass(Resource resource) {
- return Qualifiers.CLASS.equals(resource.getQualifier());
- }
-
- /**
* @return whether a resource is a unit test class
* @deprecated since 5.1 use {@link #isUnitTestFile(Resource)}
*/
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
index 6c04ad3b24f..8133bbcc876 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
@@ -50,7 +50,7 @@ public class PropertyDefinitionTest {
.options("de", "en")
.description("desc")
.type(PropertyType.FLOAT)
- .onlyOnQualifiers(Qualifiers.FILE, Qualifiers.CLASS)
+ .onlyOnQualifiers(Qualifiers.FILE)
.multiValues(true)
.propertySetKey("set")
.build();
@@ -63,7 +63,7 @@ public class PropertyDefinitionTest {
assertThat(def.description()).isEqualTo("desc");
assertThat(def.type()).isEqualTo(PropertyType.FLOAT);
assertThat(def.global()).isFalse();
- assertThat(def.qualifiers()).containsOnly(Qualifiers.FILE, Qualifiers.CLASS);
+ assertThat(def.qualifiers()).containsOnly(Qualifiers.FILE);
assertThat(def.multiValues()).isTrue();
assertThat(def.propertySetKey()).isEqualTo("set");
assertThat(def.fields()).isEmpty();
@@ -149,8 +149,7 @@ public class PropertyDefinitionTest {
.name("Hello")
.fields(
PropertyFieldDefinition.build("first").name("First").description("Description").options("A", "B").build(),
- PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build()
- )
+ PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build())
.build();
assertThat(def.fields()).hasSize(2);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java
index 648d82f6379..f707951bb76 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java
@@ -23,11 +23,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import java.io.IOException;
-
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
public class FileTest {
@@ -35,15 +31,6 @@ public class FileTest {
public TemporaryFolder temp = new TemporaryFolder();
@Test
- public void createFromIoFileShouldComputeCorrectKey() throws IOException {
- java.io.File baseDir = temp.newFolder();
- Project project = mock(Project.class);
- when(project.getBaseDir()).thenReturn(baseDir);
- Resource file = File.fromIOFile(new java.io.File(baseDir, "src/foo/bar/toto.sql"), project);
- assertThat(file.getKey()).isEqualTo("src/foo/bar/toto.sql");
- }
-
- @Test
public void trimKeyAndName() {
File file = File.create(" foo/bar/toto.sql ");
assertThat(file.getKey()).isEqualTo("foo/bar/toto.sql");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
deleted file mode 100644
index 0726a8b2c41..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import org.junit.Test;
-
-import java.util.List;
-
-public class JavaFileTest {
-
- JavaFile javaFile = new JavaFile();
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConstructor() {
- JavaFile javaClass = new JavaFile("", "");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConstructor2() {
- JavaFile javaClass = new JavaFile("", "", true);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConstructor3() {
- JavaFile javaClass = new JavaFile("");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConstructor4() {
- JavaFile javaClass = new JavaFile("", true);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetParent() {
- javaFile.getParent();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetDescription() {
- javaFile.getDescription();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetLanguage() {
- javaFile.getLanguage();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetName() {
- javaFile.getName();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetLongName() {
- javaFile.getLongName();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetScope() {
- javaFile.getScope();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetQualifier() {
- javaFile.getQualifier();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testIsUnitTest() {
- javaFile.isUnitTest();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testMathFilePattern() {
- javaFile.matchFilePattern("");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void fromIoFile1() {
- JavaFile.fromIOFile(null, (Project) null, true);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void fromIoFile2() {
- JavaFile.fromIOFile(null, (List<java.io.File>) null, true);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void fromRelativePath() {
- JavaFile.fromRelativePath("", false);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void fromAbsolutePath() {
- JavaFile.fromAbsolutePath("", (List<java.io.File>) null, false);
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java
deleted file mode 100644
index 7c2228f3f6e..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import org.junit.Test;
-
-public class JavaPackageTest {
-
- JavaPackage javaPackage = new JavaPackage();
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConstructor() {
- new JavaPackage("");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetParent() {
- javaPackage.getParent();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetDescription() {
- javaPackage.getDescription();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetLanguage() {
- javaPackage.getLanguage();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetName() {
- javaPackage.getName();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetLongName() {
- javaPackage.getLongName();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetScope() {
- javaPackage.getScope();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testGetQualifier() {
- javaPackage.getQualifier();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testIsUnitTest() {
- javaPackage.isDefault();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testMathFilePattern() {
- javaPackage.matchFilePattern("");
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java
deleted file mode 100644
index ea515f15d2d..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class JavaTest {
-
- @Test
- public void test() {
- Java language = new Java();
- assertThat(language.getFileSuffixes()).isEqualTo(new String[] {".java", ".jav"});
-
- assertThat(Java.isJavaFile(new java.io.File("Example.java"))).isTrue();
- assertThat(Java.isJavaFile(new java.io.File("Example.JAVA"))).isTrue();
- assertThat(Java.isJavaFile(new java.io.File("Example.jav"))).isTrue();
- assertThat(Java.isJavaFile(new java.io.File("Example.Jav"))).isTrue();
- assertThat(Java.isJavaFile(new java.io.File("Example.notjava"))).isFalse();
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java
deleted file mode 100644
index a3e940d696d..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.resources;
-
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-public class MethodTest {
-
- @Test
- public void shouldAcceptOverridding() {
- Method method = Method.createMethod("Foo.foo()", Java.INSTANCE);
- Method fakeMethod = new FakeMethod("Foo.foo()");
-
- assertThat(method.equals(fakeMethod), is(true));
- assertThat(fakeMethod.equals(method), is(true));
-
- assertThat(method.hashCode(), is(fakeMethod.hashCode()));
- assertThat(fakeMethod.hashCode(), is(method.hashCode()));
- }
-
- static class FakeMethod extends Method {
- protected FakeMethod(String key) {
- super(key, Qualifiers.METHOD, Java.INSTANCE);
- }
- }
-}
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 248c711822d..03d2c618033 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
@@ -30,8 +30,6 @@ public class ResourceUtilsTest {
@Test
public void checkFile() {
File file = File.create("hello.Foo");
- assertThat(ResourceUtils.isClass(file)).isFalse();
- assertThat(ResourceUtils.isPackage(file)).isFalse();
assertThat(ResourceUtils.isModuleProject(file)).isFalse();
assertThat(ResourceUtils.isSpace(file)).isFalse();
assertThat(ResourceUtils.isEntity(file)).isTrue();
@@ -44,8 +42,6 @@ public class ResourceUtilsTest {
public void checkUnitTest() {
File utFile = File.create("hello.Foo");
utFile.setQualifier(Qualifiers.UNIT_TEST_FILE);
- assertThat(ResourceUtils.isClass(utFile)).isFalse();
- assertThat(ResourceUtils.isPackage(utFile)).isFalse();
assertThat(ResourceUtils.isModuleProject(utFile)).isFalse();
assertThat(ResourceUtils.isSpace(utFile)).isFalse();
assertThat(ResourceUtils.isEntity(utFile)).isTrue();
@@ -57,8 +53,6 @@ public class ResourceUtilsTest {
@Test
public void checkDirectory() {
Directory dir = Directory.create("hello");
- assertThat(ResourceUtils.isClass(dir)).isFalse();
- assertThat(ResourceUtils.isPackage(dir)).isFalse();
assertThat(ResourceUtils.isModuleProject(dir)).isFalse();
assertThat(ResourceUtils.isSpace(dir)).isTrue();
assertThat(ResourceUtils.isEntity(dir)).isFalse();