Skip to content

Commit 248f34d

Browse files
BananeweizenCalixte
authored andcommitted
Fix sevntu violations
* remove Guava Files class * allow MoreObjects again. It's not useful to enforce removing the toString() helper class and to reimplement all toString() methods, as that could lead to functional changes.
1 parent 59aa31f commit 248f34d

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

config/checkstyle_sevntu_checks.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
java.util.Vector, java.util.Stack,com.google.collect.Iterables,
4949
com.google.common.primitives.Ints,com.google.common.base.String,
5050
com.google.common.base.Function,com.google.common.base.Supplier,
51-
com.google.common.base.Charsets,com.google.common.base.MoreObjects,
51+
com.google.common.base.Charsets,
5252
com.google.common.base.Optional,com.google.common.base.Equivalence,
5353
com.google.common.base.Preconditions,com.google.common.base.Predicate,
5454
com.google.common.io.CharSource,com.google.common.annotations.Beta,
@@ -117,7 +117,7 @@
117117
com\.google\.collect\.Iterables|com\.google\.common\.annotations\.Beta|
118118
com\.google\.common\.base\.Predicate|com\.google\.common\.base\.String|
119119
com\.google\.common\.base\.Function|com\.google\.common\.base\.Supplier|
120-
com\.google\.common\.base\.Charsets|com\.google\.common\.base\.MoreObjects|
120+
com\.google\.common\.base\.Charsets|
121121
com\.google\.common\.base\.Equivalence|com\.google\.common\.base\.Preconditions|
122122
com\.google\.common\.base\.Optional|com\.google\.common\.io\.CharSource|
123123
com\.google\.common\.primitives.*|com\.google\.common\.collect\.Sets|

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/CheckConfigurationWorkingCopy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.net.URISyntaxException;
2727
import java.net.URL;
28+
import java.nio.file.Files;
2829
import java.util.ArrayList;
2930
import java.util.HashMap;
3031
import java.util.List;
@@ -42,7 +43,6 @@
4243
import org.xml.sax.InputSource;
4344

4445
import com.google.common.io.Closeables;
45-
import com.google.common.io.Files;
4646

4747
import net.sf.eclipsecs.core.CheckstylePlugin;
4848
import net.sf.eclipsecs.core.Messages;
@@ -264,7 +264,7 @@ public void setModules(List<Module> modules) throws CheckstylePluginException {
264264

265265
// all went ok, write to the file
266266
File configFile = URIUtil.toFile(getResolvedConfigurationFileURL().toURI());
267-
Files.write(byteOut.toByteArray(), configFile);
267+
Files.write(configFile.toPath(), byteOut.toByteArray());
268268

269269
// refresh the files if within the workspace
270270
// Bug 1251194 - Resource out of sync after performing changes to

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/GlobalCheckConfigurationWorkingSet.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.File;
2424
import java.io.IOException;
25+
import java.nio.file.Files;
2526
import java.util.ArrayList;
2627
import java.util.Collection;
2728
import java.util.HashSet;
@@ -35,8 +36,6 @@
3536
import org.eclipse.core.resources.IProject;
3637
import org.eclipse.core.runtime.IPath;
3738

38-
import com.google.common.io.Files;
39-
4039
import net.sf.eclipsecs.core.CheckstylePlugin;
4140
import net.sf.eclipsecs.core.Messages;
4241
import net.sf.eclipsecs.core.config.configtypes.BuiltInConfigurationType;
@@ -289,7 +288,7 @@ private void storeToPersistence() throws CheckstylePluginException {
289288
// write to the file after the document creation was successful
290289
// prevents corrupted files in case of error
291290
byte[] data = XMLUtil.toByteArray(doc);
292-
Files.write(data, configFile);
291+
Files.write(configFile.toPath(), data);
293292
} catch (IOException ex) {
294293
CheckstylePluginException.rethrow(ex, Messages.errorWritingConfigFile);
295294
}

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/configtypes/RemoteConfigurationType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.net.URL;
3131
import java.net.URLConnection;
3232
import java.net.UnknownHostException;
33+
import java.nio.file.Files;
3334
import java.security.MessageDigest;
3435
import java.security.NoSuchAlgorithmException;
3536
import java.util.Base64;
@@ -44,7 +45,6 @@
4445
import org.eclipse.osgi.util.NLS;
4546

4647
import com.google.common.io.ByteStreams;
47-
import com.google.common.io.Files;
4848
import com.puppycrawl.tools.checkstyle.PropertyResolver;
4949

5050
import net.sf.eclipsecs.core.CheckstylePlugin;
@@ -266,7 +266,7 @@ private void writeToCacheFile(ICheckConfiguration checkConfig, byte[] configFile
266266
File cacheFile = cacheFilePath.toFile();
267267

268268
try {
269-
Files.write(configFileBytes, cacheFile);
269+
Files.write(cacheFile.toPath(), configFileBytes);
270270
} catch (IOException ex) {
271271
CheckstyleLog.log(ex, NLS.bind(Messages.RemoteConfigurationType_msgRemoteCachingFailed,
272272
checkConfig.getName(), checkConfig.getLocation()));
@@ -282,7 +282,7 @@ private void writeToCacheFile(ICheckConfiguration checkConfig, byte[] configFile
282282
File propsCacheFile = propsCacheFilePath.toFile();
283283

284284
try {
285-
Files.write(bundleBytes, propsCacheFile);
285+
Files.write(propsCacheFile.toPath(), bundleBytes);
286286
} catch (IOException ex) {
287287
// ignore this since there simply might be no properties file
288288
}

0 commit comments

Comments
 (0)