aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2018-07-05 11:51:17 +0200
committerSonarTech <sonartech@sonarsource.com>2018-09-19 10:54:37 +0200
commitfdf0f2f89300342c932ab23b71c895866c7d4834 (patch)
tree2a8be2a4e5bf3d39e59efbef7ceefa192ee76711 /sonar-plugin-api
parent4013c04fad08403ec9feaa406eb69f2e9dc6d745 (diff)
downloadsonarqube-fdf0f2f89300342c932ab23b71c895866c7d4834.tar.gz
sonarqube-fdf0f2f89300342c932ab23b71c895866c7d4834.zip
SONAR-10541, SONAR-10331 Drop compatibility mode and clean plugin classloader
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/build.gradle3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java75
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java2
5 files changed, 79 insertions, 6 deletions
diff --git a/sonar-plugin-api/build.gradle b/sonar-plugin-api/build.gradle
index 047cf35b695..e9c781e7e47 100644
--- a/sonar-plugin-api/build.gradle
+++ b/sonar-plugin-api/build.gradle
@@ -17,9 +17,6 @@ dependencies {
// shaded, but not relocated
compile project(':sonar-check-api')
- compile(project(':sonar-duplications')) {
- exclude group: 'org.slf4', module: 'slf4j-api'
- }
shadow 'org.codehaus.staxmate:staxmate'
shadow 'org.codehaus.woodstox:stax2-api'
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
index 16ac7816508..06c5e30c0dd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
@@ -30,7 +30,6 @@ import org.sonar.api.batch.sensor.cpd.NewCpdTokens;
import org.sonar.api.batch.sensor.internal.DefaultStorable;
import org.sonar.api.batch.sensor.internal.SensorStorage;
import org.sonar.api.config.Configuration;
-import org.sonar.duplications.internal.pmd.TokensLine;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Collections.unmodifiableList;
@@ -39,7 +38,7 @@ import static java.util.Objects.requireNonNull;
public class DefaultCpdTokens extends DefaultStorable implements NewCpdTokens {
private final Configuration config;
- private final ArrayList<TokensLine> result = new ArrayList<>();
+ private final List<TokensLine> result = new ArrayList<>();
private InputFile inputFile;
private int startLine = Integer.MIN_VALUE;
private int startIndex = 0;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java
new file mode 100644
index 00000000000..648fddbf37a
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java
@@ -0,0 +1,75 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info 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.sensor.cpd.internal;
+
+/**
+ * Immutable code fragment, which formed from tokens of one line.
+ */
+public class TokensLine {
+
+ private final String value;
+
+ private final int startLine;
+ private final int hashCode;
+
+ private final int startUnit;
+ private final int endUnit;
+
+ public TokensLine(int startUnit, int endUnit, int startLine, String value) {
+ if (startLine <= 0) {
+ throw new IllegalArgumentException("Start line should be strictly positive");
+ }
+ // TODO do we have requirements for length and hashcode ?
+ this.startLine = startLine;
+ this.value = value;
+ this.hashCode = value.hashCode();
+
+ this.startUnit = startUnit;
+ this.endUnit = endUnit;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public int getStartLine() {
+ return startLine;
+ }
+
+ /**
+ * Same as {@link #getStartLine()}
+ */
+ public int getEndLine() {
+ return startLine;
+ }
+
+ public int getHashCode() {
+ return hashCode;
+ }
+
+ public int getStartUnit() {
+ return startUnit;
+ }
+
+ public int getEndUnit() {
+ return endUnit;
+ }
+
+}
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 76977f55bd7..3559ebdb258 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
@@ -53,6 +53,7 @@ import org.sonar.api.batch.sensor.coverage.NewCoverage;
import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage;
import org.sonar.api.batch.sensor.cpd.NewCpdTokens;
import org.sonar.api.batch.sensor.cpd.internal.DefaultCpdTokens;
+import org.sonar.api.batch.sensor.cpd.internal.TokensLine;
import org.sonar.api.batch.sensor.error.AnalysisError;
import org.sonar.api.batch.sensor.error.NewAnalysisError;
import org.sonar.api.batch.sensor.error.internal.DefaultAnalysisError;
@@ -80,7 +81,6 @@ import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.measures.Metric;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.Version;
-import org.sonar.duplications.internal.pmd.TokensLine;
import static java.util.Collections.unmodifiableMap;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java
index 3b0e01073e9..fff63e272fd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java
@@ -19,6 +19,7 @@
*/
package org.sonar.api.server.authentication;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.server.ServerSide;
/**
@@ -32,6 +33,7 @@ import org.sonar.api.server.ServerSide;
* @since 5.4
*/
@ServerSide
+@ExtensionPoint
public interface IdentityProvider {
/**