* @deprecated since 4.2 not used anymore
*/
@Deprecated
- Resource createResource(File file, List<File> sourceDirs);
+ default Resource createResource(File file, List<File> sourceDirs) {
+ throw new UnsupportedOperationException("Never called by the platform");
+ }
}
@Deprecated
public interface SensorContext extends org.sonar.api.batch.sensor.SensorContext {
- /**
- * Indexes a resource as a direct child of project. This method does nothing and returns true if the resource already indexed.
- *
- * @return false if the resource is excluded
- * @deprecated since 4.2 Resource indexing is done by the platform for all physical resources.
- */
- @Deprecated
- boolean index(Resource resource);
-
- /**
- * Indexes a resource. This method does nothing if the resource is already indexed.
- *
- * @param resource the resource to index. Not nullable
- * @param parentReference a reference to the parent. If null, the the resource is indexed as a direct child of project.
- * @return false if the parent is not indexed or if the resource is excluded
- * @deprecated since 4.2 Resource indexing is done by the platform for all physical resources.
- */
- @Deprecated
- boolean index(Resource resource, Resource parentReference);
-
- /**
- * Returns true if the referenced resource is indexed and excluded.
- *
- * @since 2.6
- * @deprecated since 4.2 Excluded resources are not indexed.
- */
- @Deprecated
- boolean isExcluded(Resource reference);
-
- /**
- * Returns true if the referenced resource is indexed.
- *
- * @since 2.6
- * @deprecated since 4.2 Excluded resources are not indexed.
- */
- @Deprecated
- boolean isIndexed(Resource reference, boolean acceptExcluded);
-
/**
* Search for an indexed resource.
*
@Deprecated
Dependency saveDependency(Dependency dependency);
- // ----------- FILE SOURCES --------------
-
- /**
- * Save the source code of a file. The file must be have been indexed before.
- *
- * @throws org.sonar.api.resources.DuplicatedSourceException if the source has already been set on this resource
- * @since 1.10. Returns a boolean since 2.6.
- * @deprecated since 4.2 Source import is done by the platform
- */
- @Deprecated
- void saveSource(Resource reference, String source);
-
/**
* Save measure on {@link InputFile}
* @since 4.2
+++ /dev/null
-/*
- * 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.batch;
-
-import org.sonar.api.resources.JavaFile;
-import org.sonar.api.resources.JavaPackage;
-
-/**
- * @deprecated since 4.2
- */
-@Deprecated
-public final class SquidUtils {
-
- private SquidUtils() {
- // only static methods
- }
-
- /**
- * @deprecated since 4.2 JavaFile is deprecated
- */
- @Deprecated
- public static JavaFile convertJavaFileKeyFromSquidFormat(String key) {
- throw unsupported();
- }
-
- /**
- * @deprecated since 4.2 JavaPackage is deprecated
- */
- @Deprecated
- public static JavaPackage convertJavaPackageKeyFromSquidFormat(String key) {
- throw unsupported();
- }
-
- private static UnsupportedOperationException unsupported() {
- return new UnsupportedOperationException("Not supported since v4.2. See http://redirect.sonarsource.com/doc/api-changes.html");
- }
-
- /**
- * @deprecated since 4.0
- */
- @Deprecated
- public static String convertToSquidKeyFormat(JavaFile file) {
- throw new UnsupportedOperationException("Not supported since v4.0. Was badly implemented");
- }
-}
+++ /dev/null
-/*
- * 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.batch;
-
-import org.junit.Test;
-import org.sonar.api.resources.JavaFile;
-
-public class SquidUtilsTest {
-
- @Test(expected = UnsupportedOperationException.class)
- public void convertJavaFileKeyFromSquidFormat() {
- SquidUtils.convertJavaFileKeyFromSquidFormat("java/lang/String");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void shouldConvertJavaPackageKeyFromSquidFormat() {
- SquidUtils.convertJavaPackageKeyFromSquidFormat("java/lang");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void shouldConvertToSquidKeyFormat() {
- SquidUtils.convertToSquidKeyFormat(new JavaFile("com.foo.Bar"));
- }
-}
import org.sonar.api.resources.File;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
-import org.sonar.api.utils.SonarException;
import org.sonar.batch.index.DefaultIndex;
import org.sonar.batch.sensor.DefaultSensorContext;
import org.sonar.batch.sensor.coverage.CoverageExclusions;
return project;
}
- @Override
- public boolean index(Resource resource) {
- // SONAR-5006
- logWarning();
- return true;
- }
-
- @Override
- public boolean index(Resource resource, Resource parentReference) {
- // SONAR-5006
- logWarning();
- return true;
- }
-
- private static void logWarning() {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Plugins are no more responsible for indexing physical resources like directories and files. This is now handled by the platform.", new SonarException(
- "Plugin should not index physical resources"));
- }
- }
-
- @Override
- public boolean isExcluded(Resource reference) {
- return index.isExcluded(reference);
- }
-
- @Override
- public boolean isIndexed(Resource reference, boolean acceptExcluded) {
- return index.isIndexed(reference, acceptExcluded);
- }
-
@Override
public Resource getParent(Resource reference) {
return index.getParent(reference);
return null;
}
- @Override
- public void saveSource(Resource reference, String source) {
- // useless since 4.2.
- }
-
private Resource resourceOrProject(Resource resource) {
if (resource == null) {
return project;