diff --git a/config/checkstyle-checks.xml b/config/checkstyle-checks.xml
index 8cce03779..213e61bb3 100644
--- a/config/checkstyle-checks.xml
+++ b/config/checkstyle-checks.xml
@@ -747,6 +747,9 @@
+
+
+
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/CheckstylePlugin.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/CheckstylePlugin.java
index 131e7d9ed..431953855 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/CheckstylePlugin.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/CheckstylePlugin.java
@@ -113,6 +113,12 @@ public static Locale getPlatformLocale() {
return platformLocale;
}
+ /**
+ * Sets the platform locale.
+ *
+ * @param locale
+ * the locale to set
+ */
public static void setPlatformLocale(final Locale locale) {
platformLocale = locale;
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/Messages.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/Messages.java
index 17b131039..1a7b75742 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/Messages.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/Messages.java
@@ -109,6 +109,9 @@ public final class Messages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private Messages() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/Auditor.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/Auditor.java
index b3355117f..78935a36e 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/Auditor.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/Auditor.java
@@ -163,6 +163,16 @@ public void runAudit(IProject project, IProgressMonitor monitor)
}
}
+ /**
+ * Handles a failure that occurred during the checkstyle run.
+ *
+ * @param project
+ * the project being audited
+ * @param error
+ * the thrown checkstyle exception
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private void handleCheckstyleFailure(IProject project, CheckstyleException error)
throws CheckstylePluginException {
try {
@@ -196,6 +206,11 @@ public void addFile(IFile file) {
mFiles.put(file.getLocation().toString(), file);
}
+ /**
+ * Determines whether files have been added to the audit.
+ *
+ * @return true if at least one file has been added, false otherwise
+ */
public boolean hasFiles() {
return !mFiles.isEmpty();
}
@@ -260,6 +275,12 @@ private class CheckstyleAuditListener implements AuditListener {
*/
private Set mConnectedFileBufferPaths = new HashSet<>();
+ /**
+ * Creates a listener for the checkstyle audit.
+ *
+ * @param project
+ * the project to audit
+ */
CheckstyleAuditListener(IProject project) {
mProject = project;
@@ -395,6 +416,9 @@ public void auditFinished(AuditEvent event) {
public void auditStarted(AuditEvent event) {
}
+ /**
+ * Cleans up the state of the listener.
+ */
public void cleanup() {
mDocument = null;
@@ -446,6 +470,13 @@ private void calculateMarkerOffset(AuditEvent error, Map markerA
}
}
+ /**
+ * Connects the file buffer for the given resource.
+ *
+ * @param resource
+ * the resource to connect
+ * @return the connected document or null
+ */
private IDocument connectFileBuffer(IResource resource) {
IDocument document = null;
if (resource instanceof IFile) {
@@ -463,6 +494,12 @@ private IDocument connectFileBuffer(IResource resource) {
return document;
}
+ /**
+ * Disconnects the file buffer for the given resource.
+ *
+ * @param resource
+ * the resource to disconnect
+ */
private void disconnectFileBuffer(IResource resource) {
if (resource instanceof IFile) {
final IPath path = resource.getFullPath();
@@ -470,6 +507,12 @@ private void disconnectFileBuffer(IResource resource) {
}
}
+ /**
+ * Disconnects the file buffer for the given path.
+ *
+ * @param path
+ * the path to disconnect
+ */
private void disconnectFileBuffer(IPath path) {
try {
@@ -484,6 +527,13 @@ private void disconnectFileBuffer(IPath path) {
}
}
+ /**
+ * Converts a severity level into the corresponding marker severity value.
+ *
+ * @param severity
+ * the severity level
+ * @return the marker severity value
+ */
private int getSeverityValue(SeverityLevel severity) {
int result = IMarker.SEVERITY_WARNING;
@@ -500,6 +550,13 @@ else if (severity.equals(SeverityLevel.ERROR)) {
return result;
}
+ /**
+ * Builds the message shown for the given audit event.
+ *
+ * @param error
+ * the audit event
+ * @return the assembled message
+ */
private String getMessage(AuditEvent error) {
String moduleId = error.getModuleId();
@@ -534,6 +591,13 @@ private String getMessage(AuditEvent error) {
return buf.toString();
}
+ /**
+ * Determines the rule name for the given audit event.
+ *
+ * @param error
+ * the audit event
+ * @return the rule name
+ */
private String getRuleName(AuditEvent error) {
final String ruleName;
final RuleMetadata metaData = MetadataFactory.getRuleMetadata(error.getSourceName());
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckerFactory.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckerFactory.java
index a241b0e2b..7d563aef5 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckerFactory.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckerFactory.java
@@ -250,6 +250,12 @@ private static Checker createCheckerInternal(InputSource input, PropertyResolver
return checker;
}
+ /**
+ * Sets the locale on the given checker if it changed.
+ *
+ * @param checker
+ * the checker to update
+ */
private static void setLocaleIfChanged(final Checker checker) {
final String lc = getLocale();
if (lc != null && !lc.equals(CheckstylePlugin.getPlatformLocale().getLanguage())) {
@@ -257,6 +263,14 @@ private static void setLocaleIfChanged(final Checker checker) {
}
}
+ /**
+ * Sets the locale on the given checker.
+ *
+ * @param checker
+ * the checker to update
+ * @param lang
+ * the language to apply
+ */
private static void setLocale(final Checker checker, final String lang) {
final String lastLocale;
if (lang != null) {
@@ -277,6 +291,11 @@ private static void setLocale(final Checker checker, final String lang) {
}
}
+ /**
+ * Returns the configured locale language.
+ *
+ * @return the configured language or null if the default should be used
+ */
private static String getLocale() {
String lang = CheckstylePluginPrefs.getString(CheckstylePluginPrefs.PREF_LOCALE_LANGUAGE);
if (lang != null && (lang.isEmpty() || "default".equals(lang))) {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckstyleMarker.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckstyleMarker.java
index 1234768aa..0fad6545c 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckstyleMarker.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/builder/CheckstyleMarker.java
@@ -56,10 +56,20 @@ public final class CheckstyleMarker {
*/
public static final int CATEGORY_ID = 999;
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckstyleMarker() {
// utility class
}
+ /**
+ * Determines whether the given marker is a checkstyle marker.
+ *
+ * @param marker
+ * the marker to check
+ * @return true if the marker is a checkstyle marker
+ */
public static boolean isCheckstyleMarker(IMarker marker) {
boolean isCheckstyleMarker;
try {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationFactory.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationFactory.java
index 6ab8e0061..b83427862 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationFactory.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationFactory.java
@@ -88,6 +88,9 @@ public final class CheckConfigurationFactory {
refresh();
}
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckConfigurationFactory() {
}
@@ -213,6 +216,13 @@ public FileVisitResult visitFile(final Path file, final BasicFileAttributes attr
}
}
+ /**
+ * Calculates the state location within the given workspace root.
+ *
+ * @param newWorkspaceRoot
+ * the new workspace root
+ * @return the target state location
+ */
private static IPath getTargetStateLocation(IPath newWorkspaceRoot) {
final IPath currentWorkspaceRoot = Platform.getLocation();
IPath currentStateLocation = CheckstylePlugin.getDefault().getStateLocation();
@@ -277,6 +287,11 @@ private static void loadFromPersistence() throws CheckstylePluginException {
}
}
+ /**
+ * Returns the file used to store the check configurations in the state location.
+ *
+ * @return the internal configuration file
+ */
private static File getInternalConfigurationFile() {
IPath configPath = CheckstylePlugin.getDefault().getStateLocation();
configPath = configPath.append(CHECKSTYLE_CONFIG_FILE);
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationTester.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationTester.java
index c1653af26..1a9edeeed 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationTester.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationTester.java
@@ -45,6 +45,9 @@
*/
public final class CheckConfigurationTester {
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckConfigurationTester() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationXmlWriter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationXmlWriter.java
index 998d4a2ec..f2c4ae9e4 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationXmlWriter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/CheckConfigurationXmlWriter.java
@@ -29,6 +29,9 @@
*/
public final class CheckConfigurationXmlWriter {
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckConfigurationXmlWriter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigProperty.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigProperty.java
index 015116ca3..24be48316 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigProperty.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigProperty.java
@@ -76,6 +76,13 @@ public ConfigProperty(String name, String value) {
this.value = value;
}
+ /**
+ * Determines the initial value for a property from its metadata.
+ *
+ * @param metaData
+ * the property metadata
+ * @return the initial value
+ */
private static String determineInitialValue(ConfigPropertyMetadata metaData) {
final String value;
if (metaData.getOverrideDefault() != null) {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationReader.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationReader.java
index 71bfb23ef..7c5a93fe9 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationReader.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationReader.java
@@ -155,6 +155,13 @@ public static List read(InputSource input) throws CheckstylePluginExcept
return rules;
}
+ /**
+ * Extracts the modules declared in the given document.
+ *
+ * @param document
+ * the document to read
+ * @return the list of modules
+ */
private static List getModules(final Document document) {
final List modules = new ArrayList<>();
@@ -170,6 +177,13 @@ public void visit(final Element node) {
return modules;
}
+ /**
+ * Creates a module from the given XML element.
+ *
+ * @param node
+ * the module element
+ * @return the created module
+ */
private static Module createModule(final Element node) {
final String name = node.attributeValue(XMLTags.NAME_TAG);
final RuleMetadata metadata = MetadataFactory.getRuleMetadata(name);
@@ -190,6 +204,14 @@ private static Module createModule(final Element node) {
return module;
}
+ /**
+ * Adds the property elements of the module element to the module.
+ *
+ * @param moduleEl
+ * the module element
+ * @param module
+ * the module to fill
+ */
private static void addProperties(final Element moduleEl, final Module module) {
final List propertyEls = moduleEl.elements(XMLTags.PROPERTY_TAG);
@@ -233,6 +255,14 @@ else if (module.getMetaData() != null) {
}
}
+ /**
+ * Adds the message elements of the module element to the module.
+ *
+ * @param moduleEl
+ * the module element
+ * @param module
+ * the module to fill
+ */
private static void addMessages(final Element moduleEl, final Module module) {
final List messageEls = moduleEl.elements(XMLTags.MESSAGE_TAG);
@@ -246,6 +276,14 @@ private static void addMessages(final Element moduleEl, final Module module) {
}
}
+ /**
+ * Adds the metadata elements of the module element to the module.
+ *
+ * @param moduleEl
+ * the module element
+ * @param module
+ * the module to fill
+ */
private static void addMetadata(final Element moduleEl, final Module module) {
final List metaEls = moduleEl.elements(XMLTags.METADATA_TAG);
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationWriter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationWriter.java
index 9e1da5ed4..f93bf199e 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationWriter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/ConfigurationWriter.java
@@ -129,6 +129,18 @@ public static void write(OutputStream out, List modules,
}
}
+ /**
+ * Writes the given module and its remaining children into the result tree.
+ *
+ * @param module
+ * the module to write
+ * @param parent
+ * the parent branch in the result tree
+ * @param parentSeverity
+ * the severity inherited from the parent module
+ * @param remainingModules
+ * the list of modules that still need to be written
+ */
private static void writeModules(Module module, Branch parent, Severity parentSeverity,
List remainingModules) {
final Element moduleEl = writeModule(module, parent);
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/Severity.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/Severity.java
index 1f0b47646..d0bc6b92c 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/Severity.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/Severity.java
@@ -47,6 +47,12 @@ public enum Severity {
/** String used to serialize the Severity in XML files. */
private final String xmlValue;
+ /**
+ * Creates a severity with the given XML value.
+ *
+ * @param xmlValue
+ * the XML value
+ */
Severity(String xmlValue) {
this.xmlValue = xmlValue;
}
@@ -60,6 +66,13 @@ public String getXmlValue() {
return xmlValue;
}
+ /**
+ * Converts an XML value to the corresponding severity.
+ *
+ * @param xmlValue
+ * the XML value
+ * @return the matching severity
+ */
public static Severity fromXmlValue(String xmlValue) {
return Arrays.stream(Severity.values())
.filter(severity -> severity.getXmlValue().equals(xmlValue)).findFirst()
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/XMLTags.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/XMLTags.java
index 466165785..a30bba161 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/XMLTags.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/XMLTags.java
@@ -219,6 +219,9 @@ public final class XMLTags {
/** Default weight of a builtin configuration. */
public static final String DEFAULT_WEIGHT = "default-weight";
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private XMLTags() {
// NOOP
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/PropertyResolverFactory.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/PropertyResolverFactory.java
index 8faa3bb19..bb1147406 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/PropertyResolverFactory.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/PropertyResolverFactory.java
@@ -39,10 +39,26 @@
*/
public final class PropertyResolverFactory {
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private PropertyResolverFactory() {
}
+ /**
+ * Creates the property resolver for the given configuration.
+ *
+ * @param config
+ * the check configuration
+ * @param configFile
+ * the configuration file
+ * @return the assembled property resolver
+ * @throws IOException
+ * the configuration file could not be read
+ * @throws URISyntaxException
+ * the configuration file URL is malformed
+ */
public static PropertyResolver getPropertyResolver(ICheckConfiguration config,
CheckstyleConfigurationFile configFile) throws IOException, URISyntaxException {
final MultiPropertyResolver multiResolver = new MultiPropertyResolver();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/RemoteConfigurationType.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/RemoteConfigurationType.java
index 4e31f8b9c..340cc5c8c 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/RemoteConfigurationType.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/configtypes/RemoteConfigurationType.java
@@ -169,6 +169,19 @@ public CheckstyleConfigurationFile getCheckstyleConfiguration(
return data;
}
+ /**
+ * Loads the addition properties bundle for the given configuration.
+ *
+ * @param originalFileSuccess
+ * whether the original file was resolved successfully
+ * @param useCacheFile
+ * whether a cached file should be used
+ * @param data
+ * the configuration file data
+ * @param checkConfiguration
+ * the check configuration
+ * @return the bundle bytes if available
+ */
private Optional getPropertiesBundle(boolean originalFileSuccess, boolean useCacheFile,
CheckstyleConfigurationFile data, ICheckConfiguration checkConfiguration) {
Optional bundle = Optional.empty();
@@ -268,6 +281,16 @@ private Optional getBytesFromCacheBundleFile(ICheckConfiguration checkCo
return bytes;
}
+ /**
+ * Writes the configuration bytes into the cache file of the given configuration.
+ *
+ * @param checkConfig
+ * the check configuration
+ * @param configFileBytes
+ * the configuration file bytes
+ * @param bundleBytes
+ * the addition properties bundle bytes
+ */
private void writeToCacheFile(ICheckConfiguration checkConfig, byte[] configFileBytes,
byte[] bundleBytes) {
@@ -458,6 +481,15 @@ public static void removeCachedAuthInfo(URL resolvedCheckConfigurationURL)
}
}
+ /**
+ * Converts the given configuration URL into a secure storage path.
+ *
+ * @param resolvedCheckConfigurationURL
+ * the resolved configuration URL
+ * @return the secure storage path
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static String getSecureStoragePath(URL resolvedCheckConfigurationURL)
throws CheckstylePluginException {
@@ -482,10 +514,20 @@ private static String getSecureStoragePath(URL resolvedCheckConfigurationURL)
return "eclipse-cs/" + urlHash;
}
+ /**
+ * Returns the stored username.
+ *
+ * @return the username
+ */
public String getUsername() {
return username;
}
+ /**
+ * Returns the stored password.
+ *
+ * @return the password
+ */
public String getPassword() {
return password;
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckUtil.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckUtil.java
index 36320bcc7..509fb8406 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckUtil.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckUtil.java
@@ -41,9 +41,21 @@
*
*/
public final class CheckUtil {
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckUtil() {
}
+ /**
+ * Determines the modifiable tokens of the given check.
+ *
+ * @param checkName
+ * the name of the check
+ * @return the comma separated list of modifiable token names
+ * @throws IllegalStateException
+ * if the check has an unexpected class hierarchy
+ */
public static String getModifiableTokens(String checkName) {
final Object checkResult = getCheck(checkName);
String result = null;
@@ -66,6 +78,15 @@ else if (AbstractCheck.class.isAssignableFrom(checkResult.getClass())) {
return result;
}
+ /**
+ * Creates an instance of the given check.
+ *
+ * @param checkName
+ * the name of the check
+ * @return the created check instance
+ * @throws IllegalStateException
+ * if the check could not be loaded
+ */
private static AbstractCheck getCheck(String checkName) {
final ClassLoader classLoader =
CheckstylePlugin.getDefault().getAddonExtensionClassLoader();
@@ -79,6 +100,15 @@ private static AbstractCheck getCheck(String checkName) {
}
}
+ /**
+ * Removes the required tokens from the given tokens.
+ *
+ * @param tokens
+ * the tokens
+ * @param requiredTokens
+ * the tokens to remove
+ * @return the list of remaining tokens
+ */
private static List subtractTokens(int[] tokens, int... requiredTokens) {
final Set requiredTokensSet =
new HashSet<>(Arrays.stream(requiredTokens).boxed().collect(Collectors.toList()));
@@ -86,6 +116,15 @@ private static List subtractTokens(int[] tokens, int... requiredTokens)
.collect(Collectors.toList());
}
+ /**
+ * Converts the given token ids into their names.
+ *
+ * @param function
+ * the function mapping a token id to its name
+ * @param modifiableTokens
+ * the token ids to convert
+ * @return the comma separated list of token names
+ */
private static String getTokens(Function function,
List modifiableTokens) {
return modifiableTokens.stream().map(function::apply).collect(Collectors.joining(","));
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckstyleMetadataAdapter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckstyleMetadataAdapter.java
index 46a751f6f..d9fb2d660 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckstyleMetadataAdapter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/CheckstyleMetadataAdapter.java
@@ -57,6 +57,9 @@ public class CheckstyleMetadataAdapter {
*/
private final Map propertyTypes;
+ /**
+ * Creates the metadata adapter and initializes the internal mappings.
+ */
public CheckstyleMetadataAdapter() {
this.packageToGroupName = createPackageToGroupNameMapping();
this.propertyTypes = createPropertyTypeMapping();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ConfigPropertyType.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ConfigPropertyType.java
index 6010f1dcd..ad3a80ba1 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ConfigPropertyType.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ConfigPropertyType.java
@@ -52,6 +52,15 @@ public enum ConfigPropertyType {
/** A value that contains a regular expression. */
REGEX;
+ /**
+ * Converts an XML value to the corresponding property type.
+ *
+ * @param xmlValue
+ * the XML value
+ * @return the property type
+ * @throws IllegalArgumentException
+ * if the XML value is unexpected
+ */
static ConfigPropertyType fromXmlValue(String xmlValue) {
return switch (xmlValue) {
case "String" -> STRING;
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataFactory.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataFactory.java
index 0c438df72..e398f1f55 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataFactory.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataFactory.java
@@ -168,6 +168,12 @@ public static RuleMetadata createGenericMetadata(Module module) {
return ruleMeta;
}
+ /**
+ * Registers the alternative names of the given rule metadata.
+ *
+ * @param ruleMetadata
+ * the rule metadata
+ */
private static void registerAlternativeNames(RuleMetadata ruleMetadata) {
ruleMetadata.identity().alternativeNames()
.forEach(alternativeName -> alternativeNamesMap.put(alternativeName, ruleMetadata));
@@ -381,6 +387,13 @@ private static void doInitialization() throws CheckstylePluginException {
loadRuleMetadata();
}
+ /**
+ * Determines the group id of the given metadata file.
+ *
+ * @param metadataFile
+ * the metadata file name
+ * @return the group id
+ */
private static String groupId(String metadataFile) {
String res = StringUtils.substringBetween(metadataFile, "/checks/", FILE_NAME_SEPARATOR);
res = StringUtils.defaultString(res, metadataFile);
@@ -458,6 +471,20 @@ private static ResourceBundle getMetadataI18nBundle(String metadataFile,
return resourceBundle;
}
+ /**
+ * Parses the metadata from the given stream and registers it.
+ *
+ * @param metadataStream
+ * the stream containing the metadata
+ * @param metadataBundle
+ * the resource bundle for localization
+ * @param groupId
+ * the id of the rule group
+ * @throws DocumentException
+ * the metadata document could not be read
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static void parseMetadata(InputStream metadataStream, ResourceBundle metadataBundle,
String groupId) throws DocumentException, CheckstylePluginException {
final Collection groups = MetadataXmlReader.parseMetadata(metadataStream,
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataXmlReader.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataXmlReader.java
index a526d2a73..fd8749052 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataXmlReader.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/MetadataXmlReader.java
@@ -55,10 +55,28 @@ public final class MetadataXmlReader {
"-//eclipse-cs//DTD Check Metadata 1.1//EN",
"/com/puppycrawl/tools/checkstyle/checkstyle-metadata_1_1.dtd");
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private MetadataXmlReader() {
}
+ /**
+ * Parses the metadata from the given stream.
+ *
+ * @param metadataStream
+ * the stream containing the metadata
+ * @param metadataBundle
+ * the resource bundle for localization
+ * @param groupId
+ * the id of the rule group
+ * @return the parsed rule groups
+ * @throws DocumentException
+ * the metadata document could not be read
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
public static Collection parseMetadata(InputStream metadataStream,
ResourceBundle metadataBundle, String groupId)
throws DocumentException, CheckstylePluginException {
@@ -105,6 +123,19 @@ public static Collection parseMetadata(InputStream metadataSt
return groups.values();
}
+ /**
+ * Processes the modules declared in the given group element.
+ *
+ * @param groupElement
+ * the group element
+ * @param groupMetadata
+ * the group metadata
+ * @param metadataBundle
+ * the resource bundle for localization
+ * @return the list of rule metadata
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static List processModules(Element groupElement,
RuleGroupMetadata groupMetadata, ResourceBundle metadataBundle)
throws CheckstylePluginException {
@@ -181,6 +212,15 @@ private static boolean isNotFalse(Element element, String attributeName) {
return !"false".equals(element.attributeValue(attributeName));
}
+ /**
+ * Localizes the given candidate using the supplied resource bundle.
+ *
+ * @param localizationCandidate
+ * the candidate to localize
+ * @param metadataBundle
+ * the resource bundle for localization
+ * @return the localized value or the candidate if it could not be localized
+ */
private static String localize(String localizationCandidate, ResourceBundle metadataBundle) {
String localized = localizationCandidate;
if (metadataBundle != null && localizationCandidate != null
@@ -195,6 +235,17 @@ private static String localize(String localizationCandidate, ResourceBundle meta
return localized;
}
+ /**
+ * Processes the properties declared in the given module element.
+ *
+ * @param moduleElement
+ * the module element
+ * @param metadataBundle
+ * the resource bundle for localization
+ * @return the list of property metadata
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static List processProperties(Element moduleElement,
ResourceBundle metadataBundle) throws CheckstylePluginException {
final List properties = new ArrayList<>();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/RuleGroupMetadata.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/RuleGroupMetadata.java
index 08c00dfc0..4c9e58b6b 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/RuleGroupMetadata.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/RuleGroupMetadata.java
@@ -48,6 +48,20 @@ public class RuleGroupMetadata {
/** The list of modules belonging to the group. */
private List mRuleMetadata = new LinkedList<>();
+ /**
+ * Creates the metadata for a rule group.
+ *
+ * @param groupId
+ * the group id
+ * @param groupName
+ * the group name
+ * @param groupDesc
+ * the group description
+ * @param hidden
+ * whether the group is hidden
+ * @param priority
+ * the priority of the group
+ */
RuleGroupMetadata(String groupId, String groupName, String groupDesc, boolean hidden,
int priority) {
mGroupId = groupId;
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ThirdPartyRuleGroupParser.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ThirdPartyRuleGroupParser.java
index 2e73bde9d..c6c6a9d63 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ThirdPartyRuleGroupParser.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/config/meta/ThirdPartyRuleGroupParser.java
@@ -32,6 +32,9 @@
*/
final class ThirdPartyRuleGroupParser {
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private ThirdPartyRuleGroupParser() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/AbstractCheckJob.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/AbstractCheckJob.java
index 337d8fcc2..00c9f027f 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/AbstractCheckJob.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/AbstractCheckJob.java
@@ -33,6 +33,12 @@ public abstract class AbstractCheckJob extends WorkspaceJob implements IScheduli
*/
public static final Object CHECKSTYLE_JOB_FAMILY = new Object();
+ /**
+ * Creates a check job with the given name.
+ *
+ * @param name
+ * the job name
+ */
public AbstractCheckJob(String name) {
super(name);
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/RunCheckstyleOnFilesJob.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/RunCheckstyleOnFilesJob.java
index 830078693..b856fb060 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/RunCheckstyleOnFilesJob.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/RunCheckstyleOnFilesJob.java
@@ -112,6 +112,13 @@ public final IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreE
return Status.OK_STATUS;
}
+ /**
+ * Groups the given files by their project.
+ *
+ * @param filesToCheck
+ * the files to check
+ * @return the files grouped by project
+ */
private static Map>
getFilesSortedToProject(final List filesToCheck) {
@@ -132,6 +139,14 @@ public final IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreE
return projectFilesMap;
}
+ /**
+ * Removes files that are filtered by the given project configuration.
+ *
+ * @param files
+ * the files to filter
+ * @param projectConfig
+ * the project configuration providing the filters
+ */
private static void filter(final List files, final IProjectConfiguration projectConfig) {
final List filters = projectConfig.getFilters();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java
index c7c7e6af4..5b68f12b8 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java
@@ -130,6 +130,14 @@ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreExcepti
return status;
}
+ /**
+ * Adds the given module and all its children to the flat list.
+ *
+ * @param module
+ * the module to visit
+ * @param flatModules
+ * the list collecting the modules
+ */
private static void recurseConfiguration(Configuration module,
List flatModules) {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/nature/CheckstyleNature.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/nature/CheckstyleNature.java
index 1f542d677..13178f8cf 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/nature/CheckstyleNature.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/nature/CheckstyleNature.java
@@ -82,6 +82,12 @@ public void configure() throws CoreException {
}
}
+ /**
+ * Ensures the .project file of the project is writable.
+ *
+ * @throws CoreException
+ * the file could not be updated
+ */
private void ensureProjectFileWritable() throws CoreException {
final IFile projectFile = mProject.getFile(".project");
if (projectFile.isReadOnly()) {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/ProjectConfigurationFactory.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/ProjectConfigurationFactory.java
index e16c222a1..4a9d075f1 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/ProjectConfigurationFactory.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/ProjectConfigurationFactory.java
@@ -66,6 +66,9 @@ public final class ProjectConfigurationFactory {
private static final List SUPPORTED_VERSIONS = Arrays.asList("1.0.0",
"1.1.0", CURRENT_FILE_FORMAT_VERSION);
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private ProjectConfigurationFactory() {
}
@@ -189,6 +192,19 @@ private static IProjectConfiguration loadFromPersistence(IProject project)
return configuration;
}
+ /**
+ * Reads the project configuration from the given input stream.
+ *
+ * @param input
+ * the input stream
+ * @param project
+ * the project
+ * @return the project configuration
+ * @throws DocumentException
+ * the configuration document could not be read
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static IProjectConfiguration getProjectConfiguration(InputStream input,
IProject project) throws DocumentException, CheckstylePluginException {
@@ -215,6 +231,15 @@ private static IProjectConfiguration getProjectConfiguration(InputStream input,
syncFormatter);
}
+ /**
+ * Reads the local check configurations from the given root element.
+ *
+ * @param root
+ * the root element
+ * @param project
+ * the project
+ * @return the list of check configurations
+ */
private static List getLocalCheckConfigs(Element root, IProject project) {
final List configurations = new ArrayList<>();
@@ -268,6 +293,17 @@ private static List getLocalCheckConfigs(Element root, IPro
return configurations;
}
+ /**
+ * Reads the file sets from the given root element.
+ *
+ * @param root
+ * the root element
+ * @param localCheckConfigs
+ * the local check configurations
+ * @return the list of file sets
+ * @throws CheckstylePluginException
+ * an unexpected exception occurred
+ */
private static List getFileSets(Element root,
List localCheckConfigs) throws CheckstylePluginException {
@@ -318,6 +354,13 @@ private static List getFileSets(Element root,
return fileSets;
}
+ /**
+ * Reads the filters from the given root element.
+ *
+ * @param root
+ * the root element
+ * @return the list of filters
+ */
private static List getFilters(Element root) {
final List filters = new ArrayList<>();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/XMLTags.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/XMLTags.java
index e8177b527..4ca81d116 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/XMLTags.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/XMLTags.java
@@ -88,6 +88,9 @@ public final class XMLTags {
/** Sync formatter flag tag. */
static final String SYNC_FORMATTER_TAG = "sync-formatter";
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private XMLTags() {
// NOOP
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/AbstractFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/AbstractFilter.java
index 6b979dcab..2f9497eb2 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/AbstractFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/AbstractFilter.java
@@ -47,6 +47,9 @@ public abstract class AbstractFilter implements IFilter {
/** Flags, if the filter is readonly. */
private boolean mReadonly;
+ /**
+ * Creates a new abstract filter.
+ */
protected AbstractFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/DerivedFilesFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/DerivedFilesFilter.java
index 47a055907..82a99850d 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/DerivedFilesFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/DerivedFilesFilter.java
@@ -28,6 +28,9 @@
*/
public class DerivedFilesFilter extends AbstractFilter {
+ /**
+ * Creates a filter that filters all derived resources.
+ */
public DerivedFilesFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesInSyncFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesInSyncFilter.java
index 1e3c683c7..24e6b89a4 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesInSyncFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesInSyncFilter.java
@@ -37,6 +37,9 @@
*/
public class FilesInSyncFilter extends AbstractFilter {
+ /**
+ * Creates a filter that filters files in sync with the source repository.
+ */
public FilesInSyncFilter() {
}
@@ -73,6 +76,15 @@ public boolean accept(Object element) {
return accept;
}
+ /**
+ * Determines whether the given file has changed according to the subscriber.
+ *
+ * @param file
+ * the file to check
+ * @param subscriber
+ * the repository subscriber
+ * @return true if the file has changes
+ */
private boolean hasChanges(IFile file, Subscriber subscriber) {
boolean hasChanges = false;
try {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesOlderThanOneDayFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesOlderThanOneDayFilter.java
index 45806e0cb..bdea39574 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesOlderThanOneDayFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/FilesOlderThanOneDayFilter.java
@@ -31,6 +31,9 @@ public class FilesOlderThanOneDayFilter extends AbstractFilter {
/** Milliseconds in 24 hours. */
private static final long MILLIS_IN_24_HOURS = 1000 * 60 * 60 * 24;
+ /**
+ * Creates a filter that filters files older than one day.
+ */
public FilesOlderThanOneDayFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/NonSrcDirsFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/NonSrcDirsFilter.java
index 89b966f9f..ddecf0482 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/NonSrcDirsFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/NonSrcDirsFilter.java
@@ -45,6 +45,9 @@ public class NonSrcDirsFilter extends AbstractFilter {
/** The list of source paths of the current project. */
private List mCurrentSourcePaths;
+ /**
+ * Creates a filter that filters files outside the source directories.
+ */
public NonSrcDirsFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/PackageFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/PackageFilter.java
index b1b6f419c..5809da501 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/PackageFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/PackageFilter.java
@@ -48,6 +48,9 @@ public class PackageFilter extends AbstractFilter {
/** Whether to exclude sub-packages. */
private boolean mExcludeSubPackages = true;
+ /**
+ * Creates a filter that filters files by package.
+ */
public PackageFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/UnOpenedFilesFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/UnOpenedFilesFilter.java
index 80744a373..66529167f 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/UnOpenedFilesFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/UnOpenedFilesFilter.java
@@ -34,6 +34,9 @@ public class UnOpenedFilesFilter extends AbstractFilter {
/** The list of opened files. */
private static final List OPENED_FILES = new ArrayList<>();
+ /**
+ * Creates a filter that filters files that are not opened.
+ */
public UnOpenedFilesFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/WriteProtectedFilter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/WriteProtectedFilter.java
index 2a437b137..9c2e4a3f8 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/WriteProtectedFilter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/projectconfig/filters/WriteProtectedFilter.java
@@ -29,6 +29,9 @@
*/
public class WriteProtectedFilter extends AbstractFilter {
+ /**
+ * Creates a filter that filters all write protected resources.
+ */
public WriteProtectedFilter() {
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/CheckstyleFileWriter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/CheckstyleFileWriter.java
index 572dceac5..728bdfb1f 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/CheckstyleFileWriter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/CheckstyleFileWriter.java
@@ -58,6 +58,9 @@ public CheckstyleFileWriter(final CheckstyleSetting setting, final String file)
this.file = file;
}
+ /**
+ * Writes the configured checkstyle settings to an XML file.
+ */
public void writeXmlFile() {
try (FileOutputStream fw = new FileOutputStream(file)) {
writeXMLFile(fw);
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterConfigWriter.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterConfigWriter.java
index 15986ba17..17958fe2a 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterConfigWriter.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterConfigWriter.java
@@ -104,6 +104,16 @@ private void writeFormatterSettings(final Map settings) {
}
}
+ /**
+ * Creates or updates the given settings file with the supplied stream.
+ *
+ * @param settingsFile
+ * the settings file to update
+ * @param stream
+ * the stream with the new content
+ * @throws CoreException
+ * the file could not be updated
+ */
private static void createOrUpdateFile(IFile settingsFile, InputStream stream)
throws CoreException {
if (settingsFile.exists()) {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterTransformer.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterTransformer.java
index e3ed32d3e..270d26b31 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterTransformer.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/FormatterTransformer.java
@@ -109,6 +109,11 @@ private List loadTransformationClasses(
return targetTransformers;
}
+ /**
+ * Discovers the formatter transformation classes.
+ *
+ * @return the discovered transformations by their formatter key
+ */
@SuppressWarnings("unchecked")
private static Map>
discoverTransformers() {
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/CheckstyleTokens.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/CheckstyleTokens.java
index 337b96720..d761c1c89 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/CheckstyleTokens.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/CheckstyleTokens.java
@@ -203,6 +203,9 @@ public final class CheckstyleTokens {
/** Type that refers to all types ({@code "?"}). */
public static final String WILDCARD_TYPE = "WILDCARD_TYPE";
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckstyleTokens() {
}
}
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/LeftCurlyTransformer.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/LeftCurlyTransformer.java
index 262018dd4..dcf2bf054 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/LeftCurlyTransformer.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/transformer/ctransformerclasses/LeftCurlyTransformer.java
@@ -63,6 +63,13 @@ public class LeftCurlyTransformer extends AbstractCTransformationClass {
private static final List SWITCH_SETTINGS = List
.of(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH);
+ /**
+ * Returns the formatter settings for the given token.
+ *
+ * @param token
+ * the token to look up
+ * @return the formatter settings for the token
+ */
private static List getSettingsForToken(String token) {
return switch (token) {
case null -> Collections.emptyList();
diff --git a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/util/CheckstyleLog.java b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/util/CheckstyleLog.java
index 06a184f28..413f78b9e 100644
--- a/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/util/CheckstyleLog.java
+++ b/net.sf.eclipsecs.core/src/main/java/net/sf/eclipsecs/core/util/CheckstyleLog.java
@@ -36,6 +36,9 @@ public final class CheckstyleLog {
/** The platform log. */
private static ILog log;
+ /**
+ * Utility class, not intended to be instantiated.
+ */
private CheckstyleLog() {
}
diff --git a/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/checks/MethodLimitCheck.java b/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/checks/MethodLimitCheck.java
index b270de482..4c52de553 100644
--- a/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/checks/MethodLimitCheck.java
+++ b/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/checks/MethodLimitCheck.java
@@ -56,6 +56,13 @@ public int[] getDefaultTokens() {
};
}
+ /**
+ * Sets the maximum number of methods.
+ *
+ * @param limit
+ * the maximum number of methods
+ * @since 6.0
+ */
public void setMax(int limit) {
max = limit;
}
diff --git a/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/filter/SampleFilter.java b/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/filter/SampleFilter.java
index e217393d0..232222a4f 100644
--- a/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/filter/SampleFilter.java
+++ b/net.sf.eclipsecs.sample/src/main/java/net/sf/eclipsecs/sample/filter/SampleFilter.java
@@ -30,6 +30,9 @@
@ThreadSafe
public class SampleFilter extends AbstractFilter {
+ /**
+ * Creates a filter that rejects all files.
+ */
public SampleFilter() {
}
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/ApplicationStartedHandler.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/ApplicationStartedHandler.java
index f23c6ff65..79f4a2ed3 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/ApplicationStartedHandler.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/ApplicationStartedHandler.java
@@ -77,6 +77,9 @@ public void handleEvent(org.osgi.service.event.Event event) {
}
}
+ /**
+ * Registers the listeners needed for the check-on-open support on the workbench windows.
+ */
private void registerListener() {
// add listeners for the Check-On-Open support
final IWorkbench workbench = PlatformUI.getWorkbench();
@@ -100,6 +103,9 @@ public void run() {
});
}
+ /**
+ * Registers the checkstyle icon for the checkstyle job family in the progress service.
+ */
protected void registerProgressIcon() {
final IProgressService service = PlatformUI.getWorkbench().getProgressService();
if (service != null) {
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/CheckstyleUIPluginImages.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/CheckstyleUIPluginImages.java
index 8cfdbbced..b5d7b8180 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/CheckstyleUIPluginImages.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/CheckstyleUIPluginImages.java
@@ -116,10 +116,21 @@ public enum CheckstyleUIPluginImages {
*/
private Image image;
+ /**
+ * Creates an image descriptor entry.
+ *
+ * @param factory
+ * the lazy creation factory
+ */
CheckstyleUIPluginImages(Supplier factory) {
this.factory = factory;
}
+ /**
+ * Returns the image descriptor, lazily creating it on first access.
+ *
+ * @return the image descriptor
+ */
public ImageDescriptor getImageDescriptor() {
if (imageDescriptor == null) {
imageDescriptor = factory.get();
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/Messages.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/Messages.java
index 5d165b5d9..ed9ee2c95 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/Messages.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/Messages.java
@@ -491,6 +491,9 @@ public final class Messages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
+ /**
+ * Utility class, cannot be instantiated.
+ */
private Messages() {
}
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ActivateProjectsAction.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ActivateProjectsAction.java
index 61fb0b08e..81bfcb07c 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ActivateProjectsAction.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ActivateProjectsAction.java
@@ -76,6 +76,12 @@ private static class BulkCheckstyleActivateJob extends WorkspaceJob {
/** The projects to activate Checkstyle on. */
private Collection mProjectsToActivate;
+ /**
+ * Creates the job to activate Checkstyle on the given projects.
+ *
+ * @param projectsToActivate
+ * the projects to activate Checkstyle on
+ */
BulkCheckstyleActivateJob(Collection projectsToActivate) {
super(Messages.ActivateProjectsPrintAction_msgActivateSelectedProjects);
this.mProjectsToActivate = projectsToActivate;
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/CheckSelectedFilesAction.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/CheckSelectedFilesAction.java
index 1b13b79c8..d68a26d55 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/CheckSelectedFilesAction.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/CheckSelectedFilesAction.java
@@ -74,6 +74,12 @@ public void run(IAction action) {
checkSelection(mSelection);
}
+ /**
+ * Checks the files contained in the given selection.
+ *
+ * @param selection
+ * the selection of resources
+ */
private void checkSelection(IStructuredSelection selection) {
final Set resources = new HashSet<>();
for (Object object : selection.toList()) {
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ClearSelectedFilesAction.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ClearSelectedFilesAction.java
index e63142dcd..805138071 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ClearSelectedFilesAction.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ClearSelectedFilesAction.java
@@ -79,6 +79,12 @@ private static class ClearMarkersJob extends WorkspaceJob {
/** The resources to clear markers from. */
private Collection mResourcesToClear;
+ /**
+ * Creates the job that clears the checkstyle markers from the given resources.
+ *
+ * @param resourcesToClear
+ * the resources whose markers should be cleared
+ */
ClearMarkersJob(Collection resourcesToClear) {
super(Messages.ClearSelectedFilesAction_title);
this.mResourcesToClear = resourcesToClear;
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ConfigureProjectFromBluePrintAction.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ConfigureProjectFromBluePrintAction.java
index 671faa20a..bbef28649 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ConfigureProjectFromBluePrintAction.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/ConfigureProjectFromBluePrintAction.java
@@ -117,6 +117,14 @@ private static class BulkConfigureJob extends WorkspaceJob {
/** The projects to configure from the blueprint. */
private final Collection mProjectsToConfigure;
+ /**
+ * Creates the job configuring the given projects from the blueprint project.
+ *
+ * @param blueprint
+ * the blueprint project to copy configuration from
+ * @param projectsToConfigure
+ * the projects to configure
+ */
BulkConfigureJob(IProject blueprint, Collection projectsToConfigure) {
super(Messages.ConfigureProjectFromBluePrintAction_msgConfiguringFromBluePrint);
this.mBlueprint = blueprint;
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/DeactivateProjectsAction.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/DeactivateProjectsAction.java
index 1ab396913..f3c223eea 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/DeactivateProjectsAction.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/actions/DeactivateProjectsAction.java
@@ -76,6 +76,12 @@ private static class BulkCheckstyleActivateJob extends WorkspaceJob {
/** The projects to deactivate Checkstyle on. */
private Collection mProjectsToDeactivate;
+ /**
+ * Creates the job that deactivates Checkstyle on the given projects.
+ *
+ * @param projectsToDeactivate
+ * the projects to deactivate Checkstyle on
+ */
BulkCheckstyleActivateJob(Collection projectsToDeactivate) {
super(Messages.DeactivateProjectsPrintAction_msgDeactivateSelectedProjects);
this.mProjectsToDeactivate = projectsToDeactivate;
diff --git a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/config/AvailableModulesViewer.java b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/config/AvailableModulesViewer.java
index 802ee0721..01612deed 100644
--- a/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/config/AvailableModulesViewer.java
+++ b/net.sf.eclipsecs.ui/src/main/java/net/sf/eclipsecs/ui/config/AvailableModulesViewer.java
@@ -67,6 +67,22 @@ public final class AvailableModulesViewer extends Composite {
/** The callback for adding new modules. */
private final Consumer> newModule;
+ /**
+ * Creates the available modules viewer.
+ *
+ * @param parent
+ * the parent composite
+ * @param style
+ * the style of the composite
+ * @param labelProvider
+ * the label provider for the tree viewer
+ * @param configurable
+ * whether the add button is enabled
+ * @param newModule
+ * the callback for adding new modules
+ * @param selectionChanged
+ * the callback for selection changes
+ */
public AvailableModulesViewer(Composite parent, int style,
AvailableModulesViewerLabelProvider labelProvider, boolean configurable,
Consumer> newModule, Consumer