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
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: pmd/pmd-github-action@v2.0.0
id: pmd
with:
version: '7.19.0'
version: '7.21.0'
rulesets: 'ddk-configuration/pmd/ruleset.xml'
analyzeModifiedFilesOnly: false
- name: Fail build if there are violations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public Collection<String> getSubTypes(final String parentNode) {
* the names of adjacent vertices with outbound edges
*/
private static record Vertex(Set<String> inbound, Set<String> outbound) {
public boolean isTreeNode() {
boolean isTreeNode() {
return inbound().size() <= 1;
}
}
Expand All @@ -275,7 +275,7 @@ private static final class Graph implements Forest {
* the map
* @return the result graph
*/
public static Graph fromTypesMap(final Map<String, Set<String>> typesMap) {
static Graph fromTypesMap(final Map<String, Set<String>> typesMap) {
Graph graph = new Graph();
for (Entry<String, Set<String>> entry : typesMap.entrySet()) {
String toKey = entry.getKey();
Expand All @@ -296,7 +296,7 @@ public static Graph fromTypesMap(final Map<String, Set<String>> typesMap) {
* {@link #vertexMap} as lookups of individual vertices do not benefit from that.
* For operations that require deterministic order we must sort the keys first.
*/
public Graph() {
Graph() {
vertexMap = new HashMap<>();
}

Expand All @@ -305,7 +305,7 @@ public Graph() {
*
* @return a boolean result
*/
public boolean isForest() {
boolean isForest() {
return vertexMap.values().stream().allMatch(Vertex::isTreeNode);
}

Expand All @@ -325,7 +325,7 @@ private Vertex makeVertex() {
* the key
* @return the added or existing vertex
*/
public Vertex addVertex(final String key) {
Vertex addVertex(final String key) {
return vertexMap.computeIfAbsent(key, x -> makeVertex());
}

Expand All @@ -339,7 +339,7 @@ public Vertex addVertex(final String key) {
* @throws CycleDetectedException
* if adding the edge would create a cycle
*/
public void addEdgeWithVertices(final String from, final String to) throws CycleDetectedException {
void addEdgeWithVertices(final String from, final String to) throws CycleDetectedException {
if (from.equals(to) || isReachable(to, from)) {
throw new CycleDetectedException(from, to);
}
Expand All @@ -359,7 +359,7 @@ public void addEdgeWithVertices(final String from, final String to) throws Cycle
* @param to
* the target vertex
*/
public void removeEdge(final String from, final String to) {
void removeEdge(final String from, final String to) {
Vertex fromVertex = vertexMap.get(from);
Vertex toVertex = vertexMap.get(to);
fromVertex.outbound().remove(to);
Expand Down Expand Up @@ -393,7 +393,7 @@ private void breakDiamondTo(final String toKey) {
* Tries to break diamond-structured inheritance hierarchies.
* A no-operation if that is not applicable or possible.
*/
public void breakDiamonds() {
void breakDiamonds() {
List<String> toVertices = vertexMap.entrySet().stream().//
filter(entry -> !entry.getValue().isTreeNode()).map(Entry::getKey).sorted().toList();
toVertices.forEach(toKey -> breakDiamondTo(toKey));
Expand All @@ -407,7 +407,7 @@ public void breakDiamonds() {
* in a mutually exclusive way. As it is we assume that we can leave each problem vertex
* under any one of its supertypes, without it ending up excluded from checking.
*/
public void forestify() {
void forestify() {
List<String> toVertices = vertexMap.entrySet().stream().//
filter(entry -> !entry.getValue().isTreeNode()).map(Entry::getKey).sorted().toList();
for (String toKey : toVertices) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public abstract class AbstractDispatchingCheckImpl extends AbstractCheckImpl {
* A tracker for disabled methods.
* Concurrent access is allowed.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected static class DisabledMethodTracker {
private final Map<String, Boolean> disabled = new ConcurrentHashMap<>();

Expand Down Expand Up @@ -145,6 +146,7 @@ protected void handleContextMethodFailure(final String contextName, final EObjec
/**
* The class holding the current state for a validation method being executed.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public fields needed for subclass access in other packages
protected static class State implements ValidationMessageAcceptorMixin, DiagnosticCollector {
// CHECKSTYLE:OFF
public DiagnosticChain chain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public ValidationMessageAcceptor getMessageAcceptor() {
/**
* The class holding the current state for a validation method being executed.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public fields needed for subclass access in other packages
protected static class State {
// CHECKSTYLE:OFF
public DiagnosticChain chain = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public int hashCode() {
* the parameter class
* @return true, if given class is assignable from current method's first formal parameter type
*/
public boolean isMatching(final Class<?> param) {
boolean isMatching(final Class<?> param) {
return method.getParameterTypes()[0].isAssignableFrom(param);
}

Expand All @@ -216,8 +216,10 @@ public boolean isMatching(final Class<?> param) {
* the state
* @throws InvocationTargetException
* if the method called throws an exception
* @throws IllegalStateException
* if state is already assigned
*/
public void invoke(final State state) throws InvocationTargetException {
void invoke(final State state) throws InvocationTargetException {
State instanceState = instance.getThreadLocalState().get();
if (instanceState != null && instanceState != state) {
throw new IllegalStateException("State is already assigned."); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract class DispatchingCheckImpl extends AbstractCheckImpl {
* A tracker for disabled methods.
* Concurrent access is allowed.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected static class DisabledMethodTracker {
private final Map<String, Boolean> disabled = new ConcurrentHashMap<>();

Expand Down Expand Up @@ -154,6 +155,7 @@ protected void handleContextMethodFailure(final String contextName, final EObjec
/**
* The class holding the current state for a validation method being executed.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public fields needed for subclass access in other packages
protected static class State implements ValidationMessageAcceptorMixin, DiagnosticCollector {
// CHECKSTYLE:OFF
public DiagnosticChain chain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static final class InstanceHolder {
// Initialize-on-demand holder pattern.
private static final CheckXtextTestUtil INSTANCE = new CheckXtextTestUtil();

public static CheckXtextTestUtil get() {
static CheckXtextTestUtil get() {
return INSTANCE;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class CheckExtensionGenerator {
// CHECKSTYLE:ON
private static final Logger LOGGER = LogManager.getLogger(CheckExtensionGenerator.class);

public static final String PREFERENCE_PLUGIN_XML_FILENAME = "PluginXmlFilename";
public static final String STANDARD_PLUGIN_FILENAME = ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
public static final String STANDARD_FRAGMENT_FILENAME = ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR;
static final String PREFERENCE_PLUGIN_XML_FILENAME = "PluginXmlFilename";
static final String STANDARD_PLUGIN_FILENAME = ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR;
static final String STANDARD_FRAGMENT_FILENAME = ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR;

@Inject
private CheckProjectHelper projectHelper;
Expand All @@ -109,6 +109,7 @@ class CheckExtensionGenerator {
/**
* A plug-in model that can be loaded/saved from a file.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected static final class CheckWorkspacePluginModel extends WorkspacePluginModel {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -142,6 +143,7 @@ public IPluginAttribute createAttribute(final IPluginElement element) {
/**
* A {@code Plugin} that can load/save plugin xml from file other than "plugin.xml".
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected static final class CheckPlugin extends Plugin {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -173,6 +175,7 @@ protected void processChild(final Node child) {
/**
* A {@code PluginExtension} that can be loaded from an xml file.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected static final class CheckPluginExtension extends PluginExtension {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -230,6 +233,7 @@ public void checkLoad(final Node node) {
/**
* A {@code PluginElement} that can be loaded from an xml file.
*/
@SuppressWarnings("PMD.PublicMemberInNonPublicType") // Public methods needed for subclass access in other packages
protected class CheckPluginElement extends PluginElement {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -334,7 +338,7 @@ void checkLoad(final Node node) {
* @throws CoreException
* the core exception
*/
public void changePluginXmlFile(final IBuildContext context, final Delta delta, final IProgressMonitor monitor) throws CoreException {
void changePluginXmlFile(final IBuildContext context, final Delta delta, final IProgressMonitor monitor) throws CoreException {
URI uri = delta.getUri();
CheckCatalog catalog = projectHelper.getCatalog(context, uri);
if (catalog == null) {
Expand Down Expand Up @@ -536,8 +540,10 @@ private void mergeManifest(final CheckCatalog catalog, final IProgressMonitor mo
* a modification
* @param monitor
* progress monitor
* @throws OperationCanceledException
* if the operation was canceled
*/
public void modifyModel(final ModelModification modification, final IProgressMonitor monitor) {
void modifyModel(final ModelModification modification, final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
Expand Down Expand Up @@ -569,7 +575,7 @@ public void run() {
* @throws CoreException
* the core exception
*/
public void handleCatalogDeletion(final Delta delta, final IProgressMonitor monitor) throws CoreException {
void handleCatalogDeletion(final Delta delta, final IProgressMonitor monitor) throws CoreException {
IFile file = getPluginFile(delta.getUri());
if (validPluginFile(file)) {
Iterable<IEObjectDescription> catalogs = delta.getOld().getExportedObjectsByType(CheckPackage.Literals.CHECK_CATALOG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private TestPlan(final List<AbstractStep> setupSteps, final List<AbstractStep> t
*
* @return a new test plan instance, never {@code null}
*/
public static TestPlan create() {
static TestPlan create() {
return new TestPlan();
}

Expand All @@ -72,7 +72,7 @@ public static TestPlan create() {
* the setup step, must not be {@code null}
* @return the newly added {@link AbstractStep}, never {@code null}
*/
public <T extends AbstractStep> T addSetupStep(final T setupStep) {
<T extends AbstractStep> T addSetupStep(final T setupStep) {
Assert.assertTrue("Must not add a setup step after adding a test step.", getCompoundTestStep().getSteps().isEmpty()); //$NON-NLS-1$
getCompoundSetupStep().addStep(setupStep);
return setupStep;
Expand All @@ -87,7 +87,7 @@ public <T extends AbstractStep> T addSetupStep(final T setupStep) {
* the test step, must not be {@code null}
* @return the newly added {@link AbstractStep}, never {@code null}
*/
public <T extends AbstractStep> T addTestStep(final T testStep) {
<T extends AbstractStep> T addTestStep(final T testStep) {
getCompoundTestStep().addStep(testStep);
return testStep;
}
Expand Down Expand Up @@ -133,7 +133,7 @@ private List<TestEntityAction> getAllTestEntityActions() {
* whether a system test plan shall be created
* @return test plan containing previous test steps that need to be undone, never {@code null}
*/
public static TestPlan createUndoTestPlan(final TestPlan testPlan, final TestPlan previousTestPlan, final boolean systemTest) {
static TestPlan createUndoTestPlan(final TestPlan testPlan, final TestPlan previousTestPlan, final boolean systemTest) {
if (systemTest) {
// If the current and the previous test are system tests, compute the steps to undo.
List<AbstractStep> setupStepsToUndo = computeStepsToUndo(previousTestPlan.getCompoundSetupStep().getSteps(), testPlan);
Expand All @@ -157,7 +157,7 @@ public static TestPlan createUndoTestPlan(final TestPlan testPlan, final TestPla
* the test plan, must not be {@code null}
* @return a set of all steps with previously existing test entities, never {@code null}
*/
public static Set<AbstractStep> getAllStepsWithPreExistingTestEntities(final TestPlan previousTestPlan, final TestPlan testPlan) {
static Set<AbstractStep> getAllStepsWithPreExistingTestEntities(final TestPlan previousTestPlan, final TestPlan testPlan) {
Set<AbstractStep> stepsWithPreExistingTestEntities = new HashSet<AbstractStep>();
stepsWithPreExistingTestEntities.addAll(getStepsWithPreExistingEntities(testPlan, previousTestPlan.compoundSetupStep));
stepsWithPreExistingTestEntities.addAll(getStepsWithPreExistingEntities(testPlan, previousTestPlan.compoundTestStep));
Expand Down Expand Up @@ -207,7 +207,7 @@ private boolean hasAllTestEntities(final ITestEntityActionProvider step) {
*
* @return all executed steps, never {@code null}
*/
public Set<AbstractStep> getAllExecutedSteps() {
Set<AbstractStep> getAllExecutedSteps() {
Set<AbstractStep> executedSteps = new HashSet<AbstractStep>();
executedSteps.addAll(getCompoundSetupStep().getExecutedSteps());
executedSteps.addAll(getCompoundTestStep().getExecutedSteps());
Expand All @@ -223,7 +223,7 @@ public Set<AbstractStep> getAllExecutedSteps() {
* the filter, must not be {@code null}
* @return the new filtered test plan, never {@code null}
*/
public static TestPlan createFilteredTestPlan(final TestPlan testPlan, final Collection<AbstractStep> filter) {
static TestPlan createFilteredTestPlan(final TestPlan testPlan, final Collection<AbstractStep> filter) {
List<AbstractStep> filteredSetupSteps = filterCompoundStep(filter, testPlan.getCompoundSetupStep());
List<AbstractStep> filteredTestSteps = filterCompoundStep(filter, testPlan.getCompoundTestStep());
return new TestPlan(filteredSetupSteps, filteredTestSteps);
Expand All @@ -236,7 +236,7 @@ public static TestPlan createFilteredTestPlan(final TestPlan testPlan, final Col
* the test plan, must not be {@code null}
* @return the test reverse test plan, never {@code null}
*/
public static TestPlan createReverseTestPlan(final TestPlan testPlan) {
static TestPlan createReverseTestPlan(final TestPlan testPlan) {
List<AbstractStep> setupSteps = testPlan.getCompoundSetupStep().getSteps();
Collections.reverse(setupSteps);
List<AbstractStep> testSteps = testPlan.getCompoundTestStep().getSteps();
Expand Down Expand Up @@ -270,7 +270,7 @@ private static List<AbstractStep> filterCompoundStep(final Collection<AbstractSt
* the test plan, must not be {@code null}
* @return the test plan containing all undo-steps, never {@code null}
*/
public static TestPlan createUndoStepsTestPlan(final TestPlan testPlan) {
static TestPlan createUndoStepsTestPlan(final TestPlan testPlan) {
List<AbstractStep> setupUndoSteps = getAllUndoSteps(testPlan.getCompoundSetupStep().getSteps());
List<AbstractStep> testUndoSteps = getAllUndoSteps(testPlan.getCompoundTestStep().getSteps());
return new TestPlan(setupUndoSteps, testUndoSteps);
Expand Down Expand Up @@ -360,7 +360,7 @@ private boolean hasTestEntity(final TestEntityAction testEntityAction) {
* previous test plan, can be {@code null}
* @return executable test plan, never {@code null}
*/
public static TestPlan createExecutableTestPlan(final TestPlan testPlan, final TestPlan previousTestPlan) {
static TestPlan createExecutableTestPlan(final TestPlan testPlan, final TestPlan previousTestPlan) {
final List<AbstractStep> setupStepsToExecute = Lists.newArrayList(Collections2.filter(testPlan.getCompoundSetupStep().getSteps(), input -> input != null
&& isStepToExecute(input, previousTestPlan)));
return new TestPlan(setupStepsToExecute, testPlan.getCompoundTestStep().getSteps());
Expand Down Expand Up @@ -393,7 +393,7 @@ private static boolean isStepToExecute(final AbstractStep setupStep, final TestP
*
* @return the compound setup step, never {@code null}
*/
public CompoundStep getCompoundSetupStep() {
CompoundStep getCompoundSetupStep() {
return compoundSetupStep;
}

Expand All @@ -402,7 +402,7 @@ public CompoundStep getCompoundSetupStep() {
*
* @return the compound test step, never {@code null}
*/
public CompoundStep getCompoundTestStep() {
CompoundStep getCompoundTestStep() {
return compoundTestStep;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class SorterUtil {
private static final class SingletonHolder {
private static SorterUtil instance = new SorterUtil();

public static SorterUtil get() {
static SorterUtil get() {
return instance;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum RadioWidgetInstance {
this.text = text;
}

public String getText() {
String getText() {
return text;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ private static String getThreadInfo() {
Set<Long> deadlockedThreads = getDeadlockThreadIds();
ThreadInfo[] threadInfos = THREAD_BEAN.dumpAllThreads(true, true);
// CHECKSTYLE:OFF MagicNumber
StringBuilder trace = new StringBuilder(150).append(threadInfos.length).append(" active threads").append(NEW_LINE);
StringBuilder trace = new StringBuilder(200).append(threadInfos.length).append(" active threads").append(NEW_LINE);
// CHECKSTYLE:ON
for (ThreadInfo info : threadInfos) {
if (info == null) {
Expand Down
Loading