Skip to content

Commit 059646c

Browse files
authored
Merge pull request #1647 from guwirth/remove-guava
remove guava dependencies
2 parents 2ff6f41 + 51b7dda commit 059646c

File tree

25 files changed

+105
-100
lines changed

25 files changed

+105
-100
lines changed

cxx-checks/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
<artifactId>cxx-squid</artifactId>
1919
<version>${project.version}</version>
2020
</dependency>
21-
2221
<dependency>
2322
<groupId>org.sonarsource.sslr</groupId>
2423
<artifactId>sslr-testing-harness</artifactId>
2524
<scope>test</scope>
2625
</dependency>
27-
2826
<dependency>
2927
<groupId>junit</groupId>
3028
<artifactId>junit</artifactId>

cxx-checks/src/main/java/org/sonar/cxx/checks/ReservedNamesCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.List;
2929
import java.util.Locale;
3030
import java.util.regex.Matcher;
@@ -61,7 +61,7 @@ public class ReservedNamesCheck extends SquidCheck<Grammar> implements CxxCharse
6161
public void visitFile(AstNode astNode) {
6262
List<String> lines;
6363
try {
64-
lines = Files.readLines(getContext().getFile(), charset);
64+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
6565
} catch (IOException e) {
6666
throw new IllegalStateException(e);
6767
}

cxx-checks/src/main/java/org/sonar/cxx/checks/UseCorrectIncludeCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.List;
2929
import java.util.regex.Pattern;
3030
import org.sonar.check.Priority;
@@ -58,7 +58,7 @@ public class UseCorrectIncludeCheck extends SquidCheck<Grammar> implements CxxCh
5858
public void visitFile(AstNode astNode) {
5959
List<String> lines;
6060
try {
61-
lines = Files.readLines(getContext().getFile(), charset);
61+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
6262
} catch (IOException e) {
6363
throw new IllegalStateException(e);
6464
}

cxx-checks/src/main/java/org/sonar/cxx/checks/file/TabCharacterCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks.file;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.List;
2929
import org.sonar.check.Priority;
3030
import org.sonar.check.Rule;
@@ -69,7 +69,7 @@ public void setCharset(Charset charset) {
6969
public void visitFile(AstNode astNode) {
7070
List<String> lines;
7171
try {
72-
lines = Files.readLines(getContext().getFile(), charset);
72+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
7373
} catch (IOException e) {
7474
throw new IllegalStateException(e);
7575
}

cxx-checks/src/main/java/org/sonar/cxx/checks/metrics/TooLongLineCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks.metrics;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.List;
2929
import org.sonar.check.Priority;
3030
import org.sonar.check.Rule;
@@ -80,7 +80,7 @@ public void setCharset(Charset charset) {
8080
public void visitFile(AstNode astNode) {
8181
List<String> lines;
8282
try {
83-
lines = Files.readLines(getContext().getFile(), charset);
83+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
8484
} catch (IOException e) {
8585
throw new IllegalStateException(e);
8686
}

cxx-checks/src/main/java/org/sonar/cxx/checks/regex/FileHeaderCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks.regex;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.Iterator;
2929
import java.util.List;
3030
import java.util.regex.Matcher;
@@ -118,15 +118,15 @@ public void visitFile(AstNode astNode) {
118118
if (isRegularExpression) {
119119
String fileContent;
120120
try {
121-
fileContent = Files.toString(getContext().getFile(), charset);
121+
fileContent = new String(Files.readAllBytes(getContext().getFile().toPath()), charset);
122122
} catch (IOException e) {
123123
throw new AnalysisException(e);
124124
}
125125
checkRegularExpression(fileContent);
126126
} else {
127127
List<String> lines;
128128
try {
129-
lines = Files.readLines(getContext().getFile(), charset);
129+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
130130
} catch (IOException e) {
131131
throw new IllegalStateException(e);
132132
}

cxx-checks/src/main/java/org/sonar/cxx/checks/regex/FileRegularExpressionCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks.regex;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.regex.Matcher;
2929
import java.util.regex.Pattern;
3030
import org.sonar.api.utils.PathUtils;
@@ -123,7 +123,7 @@ public void visitFile(AstNode fileNode) {
123123
if (!compare(invertFilePattern, matchFile())) {
124124
return;
125125
}
126-
final String fileContent = Files.toString(getContext().getFile(), charset);
126+
final String fileContent = new String(Files.readAllBytes(getContext().getFile().toPath()), charset);
127127
Matcher matcher = pattern.matcher(fileContent);
128128
if (compare(invertRegularExpression, matcher.find())) {
129129
getContext().createFileViolation(this, message);

cxx-checks/src/main/java/org/sonar/cxx/checks/regex/LineRegularExpressionCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
*/
2020
package org.sonar.cxx.checks.regex;
2121

22-
import com.google.common.io.Files;
2322
import com.sonar.sslr.api.AstNode;
2423
import com.sonar.sslr.api.Grammar;
2524
import java.io.IOException;
2625
import java.nio.charset.Charset;
2726
import java.nio.charset.StandardCharsets;
27+
import java.nio.file.Files;
2828
import java.util.List;
2929
import java.util.regex.Matcher;
3030
import java.util.regex.Pattern;
@@ -123,7 +123,7 @@ public void visitFile(AstNode fileNode) {
123123
if (compare(invertFilePattern, matchFile())) {
124124
List<String> lines;
125125
try {
126-
lines = Files.readLines(getContext().getFile(), charset);
126+
lines = Files.readAllLines(getContext().getFile().toPath(), charset);
127127
} catch (IOException e) {
128128
throw new IllegalStateException(e);
129129
}

cxx-lint/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
<version>1.2.3</version>
2626
<scope>test</scope>
2727
</dependency>
28-
<dependency>
28+
<dependency>
2929
<groupId>com.google.code.gson</groupId>
3030
<artifactId>gson</artifactId>
3131
<version>2.6.2</version>
3232
</dependency>
3333
<dependency>
3434
<groupId>org.sonarsource.sonarqube</groupId>
3535
<artifactId>sonar-check-api</artifactId>
36-
<version>5.4</version>
36+
<version>${sonar.version}</version>
3737
<type>jar</type>
3838
</dependency>
3939
<dependency>
@@ -57,6 +57,11 @@
5757
<artifactId>assertj-core</artifactId>
5858
<scope>test</scope>
5959
</dependency>
60+
<dependency>
61+
<groupId>com.google.guava</groupId>
62+
<artifactId>guava</artifactId>
63+
<scope>test</scope>
64+
</dependency>
6065
</dependencies>
6166

6267
<build>

cxx-sensors/pom.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,16 @@
3131
<artifactId>cxx-checks</artifactId>
3232
<version>${project.version}</version>
3333
</dependency>
34-
3534
<dependency>
3635
<groupId>org.sonarsource.sslr</groupId>
3736
<artifactId>sslr-testing-harness</artifactId>
3837
<scope>test</scope>
3938
</dependency>
40-
4139
<dependency>
4240
<groupId>org.sonarsource.sonarqube</groupId>
4341
<artifactId>sonar-testing-harness</artifactId>
4442
<scope>test</scope>
4543
</dependency>
46-
4744
<dependency>
4845
<groupId>org.apache.ant</groupId>
4946
<artifactId>ant</artifactId>
@@ -57,10 +54,6 @@
5754
<artifactId>mockito-core</artifactId>
5855
<scope>test</scope>
5956
</dependency>
60-
<dependency>
61-
<groupId>com.google.guava</groupId>
62-
<artifactId>guava</artifactId>
63-
</dependency>
6457
<dependency>
6558
<groupId>commons-io</groupId>
6659
<artifactId>commons-io</artifactId>
@@ -72,9 +65,8 @@
7265
<dependency>
7366
<groupId>com.fasterxml.jackson.core</groupId>
7467
<artifactId>jackson-databind</artifactId>
75-
<version>2.9.7</version>
68+
<version>2.9.8</version>
7669
</dependency>
77-
<!-- https://mvnrepository.com/artifact/com.googlecode.plist/dd-plist -->
7870
<dependency>
7971
<groupId>com.googlecode.plist</groupId>
8072
<artifactId>dd-plist</artifactId>
@@ -85,5 +77,10 @@
8577
<artifactId>assertj-core</artifactId>
8678
<scope>test</scope>
8779
</dependency>
80+
<dependency>
81+
<groupId>junit</groupId>
82+
<artifactId>junit</artifactId>
83+
<scope>test</scope>
84+
</dependency>
8885
</dependencies>
8986
</project>

0 commit comments

Comments
 (0)