Skip to content

Commit

Permalink
Fix sevntu violations
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Bananeweizen committed Dec 20, 2023
1 parent 71c1fa3 commit b57b9f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/checkstyle_sevntu_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
java.util.Vector, java.util.Stack,com.google.collect.Iterables,
com.google.common.primitives.Ints,com.google.common.base.String,
com.google.common.base.Function,com.google.common.base.Supplier,
com.google.common.base.Charsets,com.google.common.base.MoreObjects,
com.google.common.base.Charsets,
com.google.common.base.Optional,com.google.common.base.Equivalence,
com.google.common.base.Preconditions,com.google.common.base.Predicate,
com.google.common.io.CharSource,com.google.common.annotations.Beta,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -42,7 +43,6 @@
import org.xml.sax.InputSource;

import com.google.common.io.Closeables;
import com.google.common.io.Files;

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

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

// refresh the files if within the workspace
// Bug 1251194 - Resource out of sync after performing changes to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
Expand All @@ -35,8 +36,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;

import com.google.common.io.Files;

import net.sf.eclipsecs.core.CheckstylePlugin;
import net.sf.eclipsecs.core.Messages;
import net.sf.eclipsecs.core.config.configtypes.BuiltInConfigurationType;
Expand Down Expand Up @@ -289,7 +288,7 @@ private void storeToPersistence() throws CheckstylePluginException {
// write to the file after the document creation was successful
// prevents corrupted files in case of error
byte[] data = XMLUtil.toByteArray(doc);
Files.write(data, configFile);
Files.write(configFile.toPath(), data);
} catch (IOException ex) {
CheckstylePluginException.rethrow(ex, Messages.errorWritingConfigFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
Expand All @@ -44,7 +45,6 @@
import org.eclipse.osgi.util.NLS;

import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import com.puppycrawl.tools.checkstyle.PropertyResolver;

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

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

try {
Files.write(bundleBytes, propsCacheFile);
Files.write(propsCacheFile.toPath(), bundleBytes);
} catch (IOException ex) {
// ignore this since there simply might be no properties file
}
Expand Down

0 comments on commit b57b9f5

Please sign in to comment.