Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/checkstyle-checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@
<module name="ModifierOrder"/>

<!-- Naming Conventions -->
<module name="AbstractClassName"/>
<module name="ClassTypeParameterName"/>
<module name="RecordTypeParameterName"/>
<module name="RecordComponentName"/>
Expand Down
8 changes: 4 additions & 4 deletions config/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]BuiltInConfigurationType.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]BuiltInFilePropertyResolver.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]ClasspathVariableResolver.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]ConfigurationType.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]AbstractConfigurationType.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]ConfigurationTypes.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]ExternalFileConfigurationType.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]config[/\\]configtypes[/\\]IConfigurationType.java" />
Expand Down Expand Up @@ -82,11 +82,11 @@
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]projectconfig[/\\]filters[/\\]PackageFilter.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]projectconfig[/\\]filters[/\\]UnOpenedFilesFilter.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]projectconfig[/\\]filters[/\\]WriteProtectedFilter.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]CTransformationClass.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]AbstractCTransformationClass.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]CheckstyleFileWriter.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]CheckstyleSetting.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]CheckstyleTransformer.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]FTransformationClass.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]AbstractFTransformationClass.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]FormatterConfigParser.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]FormatterConfigWriter.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.core[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]core[/\\]transformer[/\\]FormatterConfiguration.java" />
Expand Down Expand Up @@ -153,7 +153,7 @@
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]configtypes[/\\]InternalConfigurationEditor.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]configtypes[/\\]ProjectConfigurationEditor.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]configtypes[/\\]RemoteConfigurationEditor.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]widgets[/\\]ConfigPropertyWidgetAbstractBase.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]widgets[/\\]AbstractConfigPropertyWidget.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]widgets[/\\]ConfigPropertyWidgetBoolean.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]widgets[/\\]ConfigPropertyWidgetFactory.java" />
<suppress id="regexpHeader" files="[/\\]net.sf.eclipsecs.ui[/\\]src[/\\]net[/\\]sf[/\\]eclipsecs[/\\]ui[/\\]config[/\\]widgets[/\\]ConfigPropertyWidgetFile.java" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* Base implementation of <code>IConfigurationType</code>.
*
*/
public abstract class ConfigurationType implements IConfigurationType {
public abstract class AbstractConfigurationType implements IConfigurationType {

/** The name. */
private String mName;
Expand Down Expand Up @@ -238,13 +238,13 @@ public void notifyCheckConfigRemoved(ICheckConfiguration checkConfiguration)
@Override
public boolean equals(Object obj) {

if (obj == null || !(obj instanceof ConfigurationType)) {
if (obj == null || !(obj instanceof AbstractConfigurationType)) {
return false;
}
if (this == obj) {
return true;
}
ConfigurationType rhs = (ConfigurationType) obj;
AbstractConfigurationType rhs = (AbstractConfigurationType) obj;
return mIsCreatable == rhs.mIsCreatable && mIsEditable == rhs.mIsEditable
&& mIsConfigurable == rhs.mIsConfigurable
&& Objects.equals(mName, rhs.mName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* inside the plugin.
*
*/
public class BuiltInConfigurationType extends ConfigurationType {
public class BuiltInConfigurationType extends AbstractConfigurationType {

/**
* constant for the contributor key. It stores the id of the plugin which contributes the built in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Implementation of a check configuration that uses an exteral checkstyle configuration file.
*
*/
public class ExternalFileConfigurationType extends ConfigurationType {
public class ExternalFileConfigurationType extends AbstractConfigurationType {

/** Key to access the information if the configuration is protected. */
public static final String KEY_PROTECT_CONFIG = "protect-config-file"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* inside the plugin.
*
*/
public class InternalConfigurationType extends ConfigurationType {
public class InternalConfigurationType extends AbstractConfigurationType {

/**
* Resolves the location inside the plugins workspace state location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* Implementation of a check configuration that uses an exteral checkstyle configuration file.
*
*/
public class ProjectConfigurationType extends ConfigurationType {
public class ProjectConfigurationType extends AbstractConfigurationType {

/** Key to access the information if the configuration is protected. */
public static final String KEY_PROTECT_CONFIG = "protect-config-file"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* Implementation of a check configuration that uses an exteral checkstyle configuration file.
*
*/
public class RemoteConfigurationType extends ConfigurationType {
public class RemoteConfigurationType extends AbstractConfigurationType {

/** Key to access the information if the configuration should be cached. */
public static final String KEY_CACHE_CONFIG = "cache-file"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* react on a checkstyle-rule.
*
*/
public abstract class CTransformationClass {
public abstract class AbstractCTransformationClass {
/** The eclipse-configuration for this rule. */
private final FormatterConfiguration mFormatterSetting = new FormatterConfiguration();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* react on a formatter-setting.
*
*/
public abstract class FTransformationClass {
public abstract class AbstractFTransformationClass {
/** The checkstyle-configuration for this rule. */
private final CheckstyleSetting mCheckstyleSetting = new CheckstyleSetting();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class CheckstyleTransformer {
/**
* The list with all TransformationClass-instances loaded in method loadTransformationClasses().
*/
private final List<CTransformationClass> mTransformationClasses = new ArrayList<>();
private final List<AbstractCTransformationClass> mTransformationClasses = new ArrayList<>();

private IProject mProject;

Expand Down Expand Up @@ -98,7 +98,7 @@ private void loadTransformationClasses(final List<String> classnames)
try {
transformationClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
.loadClass(name);
final CTransformationClass transObj = (CTransformationClass) transformationClass.getDeclaredConstructor()
final AbstractCTransformationClass transObj = (AbstractCTransformationClass) transformationClass.getDeclaredConstructor()
.newInstance();
transObj.setRule(rule);
mTransformationClasses.add(transObj);
Expand Down Expand Up @@ -129,7 +129,7 @@ public void transformRules() {
*/
private void loadRuleConfigurations() {
FormatterConfiguration settings;
final Iterator<CTransformationClass> it = mTransformationClasses.iterator();
final Iterator<AbstractCTransformationClass> it = mTransformationClasses.iterator();
while (it.hasNext()) {
settings = it.next().transformRule();
mFormatterSetting.addConfiguration(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class FormatterTransformer {

private final Map<String, Class<? extends FTransformationClass>> allTransformers;
private final Map<String, Class<? extends AbstractFTransformationClass>> allTransformers;

/**
* Creates a new instance of class CheckstyleTransformer.
Expand All @@ -63,7 +63,7 @@ public void transformRules(final String path, Map<String, String> formatterSetti
throws CheckstylePluginException {
CheckstyleSetting checkstyleSetting = new CheckstyleSetting();
loadTransformationClasses(formatterSettings).stream()
.map(FTransformationClass::transformRule)
.map(AbstractFTransformationClass::transformRule)
.forEach(checkstyleSetting::addSetting);
new CheckstyleFileWriter(checkstyleSetting, path);
}
Expand All @@ -74,18 +74,18 @@ public void transformRules(final String path, Map<String, String> formatterSetti
* constructor.
* @return
*/
private List<FTransformationClass> loadTransformationClasses(Map<String, String> formatterSettings)
private List<AbstractFTransformationClass> loadTransformationClasses(Map<String, String> formatterSettings)
throws CheckstylePluginException {
List<FTransformationClass> targetTransformers = new ArrayList<>();
List<AbstractFTransformationClass> targetTransformers = new ArrayList<>();
for (Map.Entry<String, String> entry : formatterSettings.entrySet()) {
String rule = entry.getKey();
String value = entry.getValue();

Class<? extends FTransformationClass> transformationClass = allTransformers.get(rule);
Class<? extends AbstractFTransformationClass> transformationClass = allTransformers.get(rule);

if (transformationClass != null) {
try {
final FTransformationClass transObj = transformationClass.getDeclaredConstructor()
final AbstractFTransformationClass transObj = transformationClass.getDeclaredConstructor()
.newInstance();

transObj.setValue(value);
Expand All @@ -101,7 +101,7 @@ private List<FTransformationClass> loadTransformationClasses(Map<String, String>
}

@SuppressWarnings("unchecked")
private static Map<String, Class<? extends FTransformationClass>> discoverTransformers() {
private static Map<String, Class<? extends AbstractFTransformationClass>> discoverTransformers() {
String formatterKeyAnnotation = FormatterKey.class.getName();
ClassLoader loader = CheckstylePlugin.getDefault().getAddonExtensionClassLoader();
try (ScanResult scanResult = new ClassGraph()
Expand All @@ -113,7 +113,7 @@ private static Map<String, Class<? extends FTransformationClass>> discoverTransf
classInfo -> "org.eclipse.jdt.core.formatter."
+ classInfo.getAnnotationInfo(formatterKeyAnnotation)
.getParameterValues().getValue("value"),
classInfo -> (Class<? extends FTransformationClass>) classInfo.loadClass()));
classInfo -> (Class<? extends AbstractFTransformationClass>) classInfo.loadClass()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule AvoidStarImport to appropriate
* eclipse-formatter-rules.
*
*/
public class AvoidStarImportTransformer extends CTransformationClass {
public class AvoidStarImportTransformer extends AbstractCTransformationClass {

@Override
public FormatterConfiguration transformRule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule FileTabCharacter to appropriate
* eclipse-formatter-rules.
*
*/
public class FileTabCharacterTransformer extends CTransformationClass {
public class FileTabCharacterTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
userFormatterSetting("use_tabs_only_for_leading_indentations", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

import java.util.StringTokenizer;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule FinalLocalVariableWrap to appropriate
* eclipse-formatter-rules.
*
*/
public class FinalLocalVariableTransformer extends CTransformationClass {
public class FinalLocalVariableTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
String val = getAttribute("tokens");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule FinalParameters to appropriate
* eclipse-formatter-rules.
*
*/
public class FinalParametersTransformer extends CTransformationClass {
public class FinalParametersTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
// TODO tokens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule GerenricWhitespace to appropriate
* eclipse-formatter-rules.
*
*/
public class GenericWhitespaceTransformer extends CTransformationClass {
public class GenericWhitespaceTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
userFormatterSetting("insert_space_before_question_in_wildcard", "do not insert");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule IdentationWrap to appropriate
* eclipse-formatter-rules.
*
*/
public class IndentationTransformer extends CTransformationClass {
public class IndentationTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
String val = getAttribute("basicOffset");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

import java.util.StringTokenizer;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule LeftCurly to appropriate eclipse-formatter-rules.
*
*/
public class LeftCurlyTransformer extends CTransformationClass {
public class LeftCurlyTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
// TODO token LITERAL_SYNCHRONIZED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule LineLength to appropriate
* eclipse-formatter-rules.
*
*/
public class LineLengthTransformer extends CTransformationClass {
public class LineLengthTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
String val = getAttribute("max");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

import java.util.StringTokenizer;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule MethodParamPad to appropriate
* eclipse-formatter-rules.
*
*/
public class MethodParamPadTransformer extends CTransformationClass {
public class MethodParamPadTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
String val = getAttribute("tokens");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

package net.sf.eclipsecs.core.transformer.ctransformerclasses;

import net.sf.eclipsecs.core.transformer.CTransformationClass;
import net.sf.eclipsecs.core.transformer.AbstractCTransformationClass;
import net.sf.eclipsecs.core.transformer.FormatterConfiguration;

/**
* Wrapperclass for converting the checkstyle-rule MissingDeprecated to appropriate
* eclipse-formatter-rules.
*
*/
public class MissingDeprecatedTransformer extends CTransformationClass {
public class MissingDeprecatedTransformer extends AbstractCTransformationClass {
@Override
public FormatterConfiguration transformRule() {
useCleanupSetting("add_missing_annotations", "true");
Expand Down
Loading
Loading