From 78270c3c370e6e7dc2af736d002f46238f9bbece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 14:35:08 +0100 Subject: [PATCH 1/8] chore: replace bare TODO comments in PMD ruleset with actionable descriptions Replace on three excluded PMD rules with descriptive comments explaining what needs to happen before each rule can be enabled: - GuardLogStatement: ~35 log calls need parameterized logging - PreserveStackTrace: catch blocks need cause-chaining audit - UseTryWithResources: manual try/finally needs conversion audit Co-Authored-By: Claude Opus 4.6 --- ddk-configuration/pmd/ruleset.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ddk-configuration/pmd/ruleset.xml b/ddk-configuration/pmd/ruleset.xml index cca425c723..5dc8afcd5e 100644 --- a/ddk-configuration/pmd/ruleset.xml +++ b/ddk-configuration/pmd/ruleset.xml @@ -75,7 +75,7 @@ - + @@ -84,10 +84,10 @@ - + - + From 301009d91aedefd97f98b4f3db5c2440404b4f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 15:54:08 +0100 Subject: [PATCH 2/8] chore: enable PMD GuardLogStatement rule for debug and trace levels Configure the rule to only flag unguarded debug/trace log calls where arguments involve method calls (eager evaluation). Info/warn/error levels are excluded since those are typically always enabled. Co-Authored-By: Claude Opus 4.6 --- ddk-configuration/pmd/ruleset.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ddk-configuration/pmd/ruleset.xml b/ddk-configuration/pmd/ruleset.xml index 5dc8afcd5e..22164ef236 100644 --- a/ddk-configuration/pmd/ruleset.xml +++ b/ddk-configuration/pmd/ruleset.xml @@ -75,7 +75,6 @@ - @@ -90,6 +89,12 @@ + + + + + + From df3182e97e9f2038d94bd0b0357d0d960b51ece7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 15:56:12 +0100 Subject: [PATCH 3/8] refactor: convert string concatenation in log calls to parameterized logging Replace `+` concatenation and MessageFormat.format/NLS.bind in log statements with Log4j2 parameterized `{}` placeholders. This avoids unnecessary string construction when the log level is disabled. Co-Authored-By: Claude Opus 4.6 --- .../check/core/test/AbstractCheckTestCase.java | 4 ++-- .../CheckConfigurationStoreService.java | 6 +++--- .../runtime/context/AbstractCheckContext.java | 2 +- .../check/runtime/issue/AbstractCheckImpl.java | 4 ++-- .../runtime/label/CheckRuleLabelProvider.java | 2 +- .../validation/AbstractCheckValidator.java | 5 ++--- .../ui/builder/util/CheckProjectHelper.java | 4 ++-- .../ddk/check/ui/popup/actions/DeployJob.java | 10 +++++----- .../ddk/check/ui/popup/actions/UndeployJob.java | 6 +++--- .../avaloq/tools/ddk/checkcfg/CheckCfgUtil.java | 2 +- .../avaloq/tools/ddk/test/core/LoggingRule.java | 16 ++++------------ .../tools/ddk/test/core/jupiter/LoggingRule.java | 16 ++++------------ .../ddk/typesystem/BuiltInTypeModelAccess.java | 4 ++-- .../builder/MonitoredClusteringBuilderState.java | 12 ++++++------ .../expression/generator/CompilationContext.java | 6 +++--- .../expression/generator/GenModelUtil2.java | 2 +- .../parser/antlr/KeywordAnalysisHelper.java | 4 ++-- .../util/CustomClassAwareEcoreGenerator.java | 7 +++---- .../test/generator/AbstractGeneratorTest.java | 4 ++-- .../ExtendedFormattingConfigBasedStream.java | 4 ++-- .../linking/DefaultCrossReferenceHelper.java | 2 +- .../ddk/xtext/linking/LazyLinkingResource2.java | 9 ++++----- .../tools/ddk/xtext/linking/LinkingService.java | 2 +- .../ExtendableInferredModelAssociator.java | 2 +- .../modelinference/InferredModelAssociator.java | 2 +- .../AbstractResourceDescriptionStrategy.java | 3 +-- .../resource/XtextGMFLazyLinkingResource.java | 2 +- .../ddk/xtext/resource/XtextGMFResourceUtil.java | 2 +- .../tools/ddk/xtext/resource/messages.properties | 2 +- .../AbstractPolymorphicScopeProvider.java | 3 +-- .../tools/ddk/xtext/scoping/DelegatingScope.java | 2 +- .../tools/ddk/xtext/scoping/INameFunction.java | 4 ++-- .../xtext/util/BuilderParticipantSettings.java | 2 +- .../tools/ddk/xtext/util/EmfResourceUtil.java | 2 +- 34 files changed, 69 insertions(+), 90 deletions(-) diff --git a/com.avaloq.tools.ddk.check.core.test/src/com/avaloq/tools/ddk/check/core/test/AbstractCheckTestCase.java b/com.avaloq.tools.ddk.check.core.test/src/com/avaloq/tools/ddk/check/core/test/AbstractCheckTestCase.java index 21ac794f36..03cb2cd233 100644 --- a/com.avaloq.tools.ddk.check.core.test/src/com/avaloq/tools/ddk/check/core/test/AbstractCheckTestCase.java +++ b/com.avaloq.tools.ddk.check.core.test/src/com/avaloq/tools/ddk/check/core/test/AbstractCheckTestCase.java @@ -260,7 +260,7 @@ public EObject getModel(final String fileName) throws Exception { // NOPMD try { s.close(); } catch (IOException e) { - LOGGER.info("Failed to close test file " + fileName); + LOGGER.info("Failed to close test file {}", fileName); } } } @@ -338,7 +338,7 @@ protected void execute(final IProgressMonitor monitor) throws CoreException, Inv IFile file = IResourcesSetupUtil.createFile(resourceURI.toPlatformString(true), contents); getFiles().add(file); } catch (IOException e) { - LOGGER.error("failed adding file to workspace: " + fileName, e); + LOGGER.error("failed adding file to workspace: {}", fileName, e); fail("Error adding file " + fileName + " to workspace: " + e.getMessage()); } } diff --git a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/configuration/CheckConfigurationStoreService.java b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/configuration/CheckConfigurationStoreService.java index a1773a1e1b..a3ae486a25 100644 --- a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/configuration/CheckConfigurationStoreService.java +++ b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/configuration/CheckConfigurationStoreService.java @@ -90,7 +90,7 @@ private String getCode(final IMarker marker) { try { return (String) marker.getAttribute(Issue.CODE_KEY); } catch (CoreException e) { - LOGGER.error("Could not get code for marker: " + marker, e); //$NON-NLS-1$ + LOGGER.error("Could not get code for marker: {}", marker, e); //$NON-NLS-1$ return null; } } @@ -99,7 +99,7 @@ private URI getUri(final IMarker marker) { try { return URI.createURI((String) marker.getAttribute(Issue.URI_KEY)); } catch (CoreException e) { - LOGGER.error("Could not get uri for marker: " + marker, e); //$NON-NLS-1$ + LOGGER.error("Could not get uri for marker: {}", marker, e); //$NON-NLS-1$ return null; } } @@ -111,7 +111,7 @@ private String getLanguage(final URI uri) { if (resourceServiceProvider != null) { return resourceServiceProvider.get(Injector.class).getInstance(Key.get(String.class, Names.named(Constants.LANGUAGE_NAME))); } else { - LOGGER.error("Could not fetch a ResourceServiceProvider for URI: " + uri); //$NON-NLS-1$ + LOGGER.error("Could not fetch a ResourceServiceProvider for URI: {}", uri); //$NON-NLS-1$ } } else { LOGGER.warn("Could not fetch eResource from issue: URI to problem is null"); //$NON-NLS-1$ diff --git a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/context/AbstractCheckContext.java b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/context/AbstractCheckContext.java index c899fd4a46..4951c6be94 100644 --- a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/context/AbstractCheckContext.java +++ b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/context/AbstractCheckContext.java @@ -73,7 +73,7 @@ private boolean checkIssueCodePredicates(final EObject context, final String iss // caught and disabled by the usual check infrastructure. } catch (Exception e) { // CHECKSTYLE:CHECK-ON IllegalCatch - LOGGER.error("Failed to execute predicate " + method.getName() + " for issue code " + issueCode + ". Removing predicate for this issue code.", e); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + LOGGER.error("Failed to execute predicate {} for issue code {}. Removing predicate for this issue code.", method.getName(), issueCode, e); //$NON-NLS-1$ predicatesForIssueCode.remove(issueCode, method); } } diff --git a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/issue/AbstractCheckImpl.java b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/issue/AbstractCheckImpl.java index e8191ba037..353a3b5fe2 100644 --- a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/issue/AbstractCheckImpl.java +++ b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/issue/AbstractCheckImpl.java @@ -40,8 +40,8 @@ public abstract class AbstractCheckImpl implements ICheckValidatorImpl { protected void logCheckMethodFailure(final String rule, final EObject object, final Exception e) { final Throwable cause = e instanceof InvocationTargetException ? ((InvocationTargetException) e).getTargetException() : e; final Resource res = object.eResource(); - LOGGER.error("Permanently disabling check method " + rule + " for context " + object.getClass().getName() + " because of failure" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + (res != null ? " in " + res.getURI() : ""), cause); //$NON-NLS-1$ //$NON-NLS-2$ + LOGGER.error("Permanently disabling check method {} for context {} because of failure{}", rule, object.getClass().getName(), //$NON-NLS-1$ + (res != null ? " in " + res.getURI() : ""), cause); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/label/CheckRuleLabelProvider.java b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/label/CheckRuleLabelProvider.java index a1307f7ad1..da7435a6c4 100644 --- a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/label/CheckRuleLabelProvider.java +++ b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/label/CheckRuleLabelProvider.java @@ -109,7 +109,7 @@ private static Map merge(final Stream mergedMap = new HashMap(); maps.map(Map::entrySet).flatMap(Set::stream).forEach(entry -> { if (null != mergedMap.putIfAbsent(entry.getKey(), entry.getValue())) { - LOGGER.warn("Non-unique Check issue code found: " + entry.getKey()); //$NON-NLS-1$ + LOGGER.warn("Non-unique Check issue code found: {}", entry.getKey()); //$NON-NLS-1$ } }); return mergedMap; diff --git a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/validation/AbstractCheckValidator.java b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/validation/AbstractCheckValidator.java index 42ff9e2b7b..607eca1c01 100644 --- a/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/validation/AbstractCheckValidator.java +++ b/com.avaloq.tools.ddk.check.runtime.core/src/com/avaloq/tools/ddk/check/runtime/validation/AbstractCheckValidator.java @@ -19,7 +19,6 @@ import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.osgi.util.NLS; import org.eclipse.xtext.validation.AbstractInjectableValidator; import com.avaloq.tools.ddk.check.runtime.issue.ICheckValidatorImpl; @@ -83,7 +82,7 @@ protected Iterable internalCollectValidators(fina if (language == null) { throw new IllegalArgumentException("Input language cannot be null"); //$NON-NLS-1$ } else if (injector == null) { - LOGGER.debug(NLS.bind("No injector found for {0}. Could not inject registered validators.", language)); //$NON-NLS-1$ + LOGGER.debug("No injector found for {}. Could not inject registered validators.", language); //$NON-NLS-1$ } final List result = Lists.newArrayList(); @@ -98,7 +97,7 @@ protected Iterable internalCollectValidators(fina // CHECKSTYLE:OFF } catch (Exception e) { // CHECKSTYLE:ON - LOGGER.error("failed to inject validator " + validator, e); //$NON-NLS-1$ + LOGGER.error("failed to inject validator {}", validator, e); //$NON-NLS-1$ } } } diff --git a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java index 1a904cbce5..2307bda5f4 100644 --- a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java +++ b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java @@ -90,7 +90,7 @@ public String getCatalogPluginPath(final CheckCatalog catalog) { String result = packageFragment.getElementName().replace('.', '/'); return result + '/' + file.getName(); } catch (JavaModelException e) { - LOGGER.error("Could not determine plugin path for catalog " + catalog.getName(), e); + LOGGER.error("Could not determine plugin path for catalog {}", catalog.getName(), e); } return null; } @@ -114,7 +114,7 @@ public String getCatalogQualifiedName(final CheckCatalog catalog) { final String fileNameWithoutExtension = file.getName().substring(0, file.getName().length() - (file.getFileExtension().length() + 1)); return packageFragment.getElementName() + '.' + fileNameWithoutExtension; } catch (JavaModelException e) { - LOGGER.error("Could not determine plugin path for catalog " + catalog.getName(), e); + LOGGER.error("Could not determine plugin path for catalog {}", catalog.getName(), e); } return null; } diff --git a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/DeployJob.java b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/DeployJob.java index 3d02494f8b..1aca9a9225 100644 --- a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/DeployJob.java +++ b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/DeployJob.java @@ -101,7 +101,7 @@ protected IStatus run(final IProgressMonitor monitor) { return new Status(Status.ERROR, Activator.getPluginId(), Messages.DeployJob_CouldNotDeployCheckBundle, e); } - LOGGER.info(NLS.bind("Generated bundle from project {0} deployed.", project.getName())); //$NON-NLS-1$ + LOGGER.info("Generated bundle from project {} deployed.", project.getName()); //$NON-NLS-1$ try { deployCheckConfiguration(); @@ -109,7 +109,7 @@ protected IStatus run(final IProgressMonitor monitor) { return new Status(Status.ERROR, Activator.getPluginId(), Messages.DeployJob_CannotDeployMoreThanOneCheckConfiguration, e); } - LOGGER.info(NLS.bind("Check configuration for project {0} deployed.", project.getName())); //$NON-NLS-1$ + LOGGER.info("Check configuration for project {} deployed.", project.getName()); //$NON-NLS-1$ return Status.OK_STATUS; } @@ -137,16 +137,16 @@ private void deployCheckBundle() throws DeployException { Bundle managedBundle = Platform.getBundle(project.getName()); if (managedBundle != null) { - LOGGER.info(NLS.bind(Messages.DeployJob_BundleAlreadyDeployed, project.getName())); + LOGGER.info("Bundle {} already deployed. Stopping and uninstalling it.", project.getName()); //$NON-NLS-1$ try { UndeployJob.undeployBundle(managedBundle); } catch (BundleException e) { - LOGGER.error(NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e); + LOGGER.error("Failed to stop and uninstall bundle with symbolic name {}.", managedBundle.getSymbolicName(), e); //$NON-NLS-1$ throw new DeployException(e); } } - LOGGER.info(NLS.bind("Starting the bundle {0} generated from the project {1}", bundleLocation, project.getName())); //$NON-NLS-1$ + LOGGER.info("Starting the bundle {} generated from the project {}", bundleLocation, project.getName()); //$NON-NLS-1$ try { managedBundle = bundleContext.installBundle(bundleLocation, Files.asByteSource(jar).openStream()); managedBundle.start(); diff --git a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/UndeployJob.java b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/UndeployJob.java index 865c0d2d29..1d20c1fce6 100644 --- a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/UndeployJob.java +++ b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/popup/actions/UndeployJob.java @@ -58,16 +58,16 @@ public UndeployJob(final String name, final IProject project) { protected IStatus run(final IProgressMonitor monitor) { Bundle managedBundle = Platform.getBundle(project.getName()); if (managedBundle == null) { - LOGGER.info(NLS.bind(Messages.UndeployJob_NoBundleWithSymbolicNameInstalled, project.getName())); + LOGGER.info("No bundle with symbolic name {} installed.", project.getName()); //$NON-NLS-1$ return new Status(Status.INFO, Activator.getPluginId(), NLS.bind(Messages.UndeployJob_NoBundleWithSymbolicNameInstalled, project.getName())); } try { undeployBundle(managedBundle); } catch (BundleException e) { - LOGGER.error(NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e); + LOGGER.error("Failed to stop and uninstall bundle with symbolic name {}.", managedBundle.getSymbolicName(), e); //$NON-NLS-1$ return new Status(Status.ERROR, Activator.getPluginId(), NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e); } - LOGGER.info(NLS.bind(Messages.UndeployJob_DundleUndeployed, managedBundle.getSymbolicName())); + LOGGER.info("Bundle {} undeployed.", managedBundle.getSymbolicName()); //$NON-NLS-1$ try { undeployCheckConfiguration(); diff --git a/com.avaloq.tools.ddk.checkcfg.core/src/com/avaloq/tools/ddk/checkcfg/CheckCfgUtil.java b/com.avaloq.tools.ddk.checkcfg.core/src/com/avaloq/tools/ddk/checkcfg/CheckCfgUtil.java index 5bb04e8d6f..27385e209b 100644 --- a/com.avaloq.tools.ddk.checkcfg.core/src/com/avaloq/tools/ddk/checkcfg/CheckCfgUtil.java +++ b/com.avaloq.tools.ddk.checkcfg.core/src/com/avaloq/tools/ddk/checkcfg/CheckCfgUtil.java @@ -82,7 +82,7 @@ public static Collection getAllPropertyContribut try { contributions.add((ICheckCfgPropertySpecification) element.createExecutableExtension(PROPERTY_EXECUTABLE_EXTENSION_ATTRIBUTE)); } catch (CoreException e) { - LOGGER.warn("Failed to instantiate property from " + element.getContributor(), e); //$NON-NLS-1$ + LOGGER.warn("Failed to instantiate property from {}", element.getContributor(), e); //$NON-NLS-1$ } } } else { diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java index b4a18dce7b..1f77b4b00f 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java @@ -63,29 +63,21 @@ private String getDescriptionName(final Description description) { @Override public void starting(final Description description) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("STARTING: " + getDescriptionName(description)); - } + LOGGER.info("STARTING: {}", () -> getDescriptionName(description)); } @Override protected void finished(final Description description) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("FINISHED: " + getDescriptionName(description)); - } + LOGGER.info("FINISHED: {}", () -> getDescriptionName(description)); } @Override protected void succeeded(final Description description) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("SUCCEEDED: " + getDescriptionName(description)); - } + LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(description)); } @Override protected void failed(final Throwable e, final Description description) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("FAILED: " + getDescriptionName(description)); - } + LOGGER.info("FAILED: {}", () -> getDescriptionName(description)); } } diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java index 13539a76f5..b960424c44 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java @@ -54,9 +54,7 @@ public static LoggingRule getInstance() { @Override public void beforeEach(final ExtensionContext context) throws Exception { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("STARTING: " + getDescriptionName(context)); - } + LOGGER.info("STARTING: {}", () -> getDescriptionName(context)); } /** @@ -72,22 +70,16 @@ private String getDescriptionName(final ExtensionContext context) { @Override public void testSuccessful(final ExtensionContext context) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("SUCCEEDED: " + getDescriptionName(context)); - } + LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(context)); } @Override public void testFailed(final ExtensionContext context, final Throwable cause) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("FAILED: " + getDescriptionName(context)); - } + LOGGER.info("FAILED: {}", () -> getDescriptionName(context)); } @Override public void afterEach(final ExtensionContext context) throws Exception { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("FINISHED: " + getDescriptionName(context)); - } + LOGGER.info("FINISHED: {}", () -> getDescriptionName(context)); } } diff --git a/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccess.java b/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccess.java index 0a6249613d..053382321b 100644 --- a/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccess.java +++ b/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccess.java @@ -117,7 +117,7 @@ private synchronized void load() { // We *do* want to catch any exception here because we are in construction and need to initialize with something } catch (Exception ex) { // CHECKSTYLE:CHECK-ON IllegalCatch - LOGGER.error("Error loading metamodel from " + modelURI, ex); //$NON-NLS-1$ + LOGGER.error("Error loading metamodel from {}", modelURI, ex); //$NON-NLS-1$ // Create an empty model... model = BuiltInTypeModelPackage.eINSTANCE.getBuiltInTypeModelFactory().createBuiltInTypeModel(); } @@ -128,7 +128,7 @@ private synchronized void load() { if (!Strings.isEmpty(typeName)) { internalTypesByName.put(typeName, type); } else { - LOGGER.error("incomplete internal type in " + MODEL_LOCATION); //$NON-NLS-1$ + LOGGER.error("incomplete internal type in {}", MODEL_LOCATION); //$NON-NLS-1$ } } } diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java index ebfa1c1489..219aa1987f 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java @@ -727,9 +727,9 @@ protected void storeBinaryResource(final Resource resource, final BuildData buil } catch (RejectedExecutionException e) { String errorMessage = "Unable to submit a new task to store a binary resource."; //$NON-NLS-1$ if (binaryStorageExecutor.isShutdown()) { - LOGGER.info(errorMessage + " The worker pool has shut down."); //$NON-NLS-1$ + LOGGER.info("{} The worker pool has shut down.", errorMessage); //$NON-NLS-1$ } else { - LOGGER.error(errorMessage + " Exception information: " + e.getMessage()); //$NON-NLS-1$ + LOGGER.error("{} Exception information: {}", errorMessage, e.getMessage()); //$NON-NLS-1$ } } } @@ -751,12 +751,12 @@ protected void doStoreBinaryResource(final Resource resource, final BuildData bu LOGGER.info("saving binary taking longer than expected ({} ms): {}", elapsedMillis, resource.getURI()); //$NON-NLS-1$ } } catch (WrappedException ex) { - LOGGER.error(FAILED_TO_SAVE_BINARY + resource.getURI(), ex.exception()); + LOGGER.error("{}{}", FAILED_TO_SAVE_BINARY, resource.getURI(), ex.exception()); // CHECKSTYLE:OFF } catch (Throwable ex) { // CHECKSTYLE:ON - LOGGER.error(FAILED_TO_SAVE_BINARY + resource.getURI(), ex); + LOGGER.error("{}{}", FAILED_TO_SAVE_BINARY, resource.getURI(), ex); } } @@ -1205,7 +1205,7 @@ protected void flushChanges(final ResourceDescriptionsData newData) { } long flushTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - time); if (flushTime > COMMIT_WARN_WAIT_SEC) { - LOGGER.warn("Flushing of the database changes took " + flushTime + " seconds."); //$NON-NLS-1$//$NON-NLS-2$ + LOGGER.warn("Flushing of the database changes took {} seconds.", flushTime); //$NON-NLS-1$ } } } @@ -1299,7 +1299,7 @@ protected void queueAffectedResources(final Set allRemainingURIs, final IRe // CHECKSTYLE:CHECK-OFF IllegalCatch - Failing here means the build fails completely } catch (Throwable t) { // CHECKSTYLE:CHECK-ON IllegalCatch - LOGGER.warn(manager.getClass().getSimpleName() + " failed to enqueue the affected resources", t); //$NON-NLS-1$ + LOGGER.warn("{} failed to enqueue the affected resources", manager.getClass().getSimpleName(), t); //$NON-NLS-1$ } progressMonitor.worked(1); if (allRemainingURIs.isEmpty()) { diff --git a/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/CompilationContext.java b/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/CompilationContext.java index 9ea73bc407..3de9243ef5 100644 --- a/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/CompilationContext.java +++ b/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/CompilationContext.java @@ -223,7 +223,7 @@ public boolean isType(final String name) { public String javaType(final String name) { Type type = findType(name); if (type == null) { - LOGGER.warn("No type found for " + name); + LOGGER.warn("No type found for {}", name); return name; } return javaType(type); @@ -320,7 +320,7 @@ public String getQualifiedTypeName(final String typeName) { } // CHECKSTYLE:OFF } catch (final Exception e) { - LOGGER.warn(NLS.bind("Could not determine qualified type name for {0}", typeName), e); //$NON-NLS-1$ + LOGGER.warn("Could not determine qualified type name for {}", typeName, e); //$NON-NLS-1$ } // CHECKSTYLE:ON @@ -343,7 +343,7 @@ public EClass getEClass(final Type type) { // CHECKSTYLE:OFF } catch (Exception e) { // CHECKSTYLE:ON - LOGGER.error("Could not determine EClass for " + type, e); + LOGGER.error("Could not determine EClass for {}", type, e); } } return null; diff --git a/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/GenModelUtil2.java b/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/GenModelUtil2.java index 7bbc4e2161..0118652afe 100644 --- a/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/GenModelUtil2.java +++ b/com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator/GenModelUtil2.java @@ -127,7 +127,7 @@ public static GenModel findGenModel(final EModelElement eModelElement, final Res // CHECKSTYLE:CHECK-OFF IllegalCatch } catch (RuntimeException e) { // CHECKSTYLE:CHECK-ON IllegalCatch - LOGGER.error(NLS.bind("Exception in findGenModel ({0})", eModelElement), e); //$NON-NLS-1$ + LOGGER.error("Exception in findGenModel ({})", eModelElement, e); //$NON-NLS-1$ } return null; diff --git a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/parser/antlr/KeywordAnalysisHelper.java b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/parser/antlr/KeywordAnalysisHelper.java index d216693afc..23d6c4accb 100644 --- a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/parser/antlr/KeywordAnalysisHelper.java +++ b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/parser/antlr/KeywordAnalysisHelper.java @@ -254,7 +254,7 @@ public void printViolations(final String srcGenPath) { } if (problemsReported) { LOGGER.error("REJECTED KEYWORDS BY ID RULES DETECTED."); - LOGGER.error("Read " + fileName + " !"); + LOGGER.error("Read {} !", fileName); writer.println(); writer.println("(!) Problems were detected: neither reserved words nor keywords, but rejected by identifier rules"); writer.println("Use " + Path.fromPortableString(getReportFileName(srcGenPath)).lastSegment() + " to find out why these words are keywords."); @@ -448,7 +448,7 @@ public void printReport(final String srcGenPath) { PrintWriter docuWriter = new PrintWriter(new File(docuFileName), StandardCharsets.UTF_8); docuWriter.print(new CombinedGrammarReportBuilder(grammarExtensions).getDocumentation(grammar, parserRules, enumRules)); docuWriter.close(); - LOGGER.info("report on keywords is written into " + fileName); + LOGGER.info("report on keywords is written into {}", fileName); } catch (IOException e) { throw new UncheckedIOException(e); } diff --git a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/CustomClassAwareEcoreGenerator.java b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/CustomClassAwareEcoreGenerator.java index 103987ec51..0fe475560f 100644 --- a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/CustomClassAwareEcoreGenerator.java +++ b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/CustomClassAwareEcoreGenerator.java @@ -103,7 +103,7 @@ public JControlModel getJControlModel() { return jControlModel; } }; - LOGGER.info("generating EMF code for " + this.genModel); + LOGGER.info("generating EMF code for {}", this.genModel); generator.getAdapterFactoryDescriptorRegistry().addDescriptor(GenModelPackage.eNS_URI, new GeneratorAdapterDescriptor(getTypeMapper(), getLineDelimiter())); generator.setInput(model); @@ -170,7 +170,7 @@ public void preInvoke() { } } } - LOGGER.info("Registered source path to discover custom classes: " + Joiner.on(", ").join(this.srcPaths)); + LOGGER.info("Registered source path to discover custom classes: {}", () -> Joiner.on(", ").join(this.srcPaths)); } /** @@ -187,8 +187,7 @@ private void addSourcePathForPlugin(final String pluginId) { } URI createURI = URI.createURI(path); if (!URIConverter.INSTANCE.exists(createURI, null)) { - LOGGER.warn("Cannot access path '" + path - + "'. Make sure to checkout all parent languages before running the workflow. Otherwise custom implementations (*ImplCustom) will not be considered."); + LOGGER.warn("Cannot access path '{}'. Make sure to checkout all parent languages before running the workflow. Otherwise custom implementations (*ImplCustom) will not be considered.", path); } this.srcPaths.add(path); } diff --git a/com.avaloq.tools.ddk.xtext.test.core/src/com/avaloq/tools/ddk/xtext/test/generator/AbstractGeneratorTest.java b/com.avaloq.tools.ddk.xtext.test.core/src/com/avaloq/tools/ddk/xtext/test/generator/AbstractGeneratorTest.java index 1877aebb2f..e90e087489 100644 --- a/com.avaloq.tools.ddk.xtext.test.core/src/com/avaloq/tools/ddk/xtext/test/generator/AbstractGeneratorTest.java +++ b/com.avaloq.tools.ddk.xtext.test.core/src/com/avaloq/tools/ddk/xtext/test/generator/AbstractGeneratorTest.java @@ -60,7 +60,7 @@ /** * A base class for xtext generator tests. Allows creating a project and adding files. */ -@SuppressWarnings({"PMD.AbstractClassWithoutAbstractMethod", "restriction", "nls"}) +@SuppressWarnings({"PMD.AbstractClassWithoutAbstractMethod", "nls"}) public abstract class AbstractGeneratorTest { private static final String MESSAGE_GENERATED_FILE_MUST_EXIST = "Generated file ''{0}'' must exist."; private static final String MESSAGE_GENERATED_CODE_MUST_BE_CORRECT = "Generated contents of ''{0}'' must be correct."; @@ -320,7 +320,7 @@ protected void execute(final IProgressMonitor monitor) throws CoreException, Inv URI resourceURI = URI.createPlatformResourceURI(getFullFileName(projectName, outputFileName), true); IResourcesSetupUtil.createFile(resourceURI.toPlatformString(true), contents); } catch (IOException e) { - LOGGER.error("failed adding file to workspace: " + outputFileName, e); //$NON-NLS-1$ + LOGGER.error("failed adding file to workspace: {}", outputFileName, e); //$NON-NLS-1$ Assert.fail("Error adding file " + outputFileName + " to workspace: " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/formatting/ExtendedFormattingConfigBasedStream.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/formatting/ExtendedFormattingConfigBasedStream.java index b3d19092e0..2343a874b2 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/formatting/ExtendedFormattingConfigBasedStream.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/formatting/ExtendedFormattingConfigBasedStream.java @@ -366,7 +366,7 @@ private List handleParametrizedLocators(final List refInfo = getEncoder().decode(this, uriFragment); EReference reference = refInfo.getSecond(); EObject context = refInfo.getFirst(); - LOGGER.debug("Failed unexpected attempt to resolve reference during indexing " + context.eClass().getName() + "#" //$NON-NLS-1$ //$NON-NLS-2$ - + reference.getName() + " for object " + EcoreUtil.getURI(context), new RuntimeException()); //$NON-NLS-1$ + LOGGER.debug("Failed unexpected attempt to resolve reference during indexing {}#{} for object {}", //$NON-NLS-1$ + context.eClass().getName(), reference.getName(), EcoreUtil.getURI(context), new RuntimeException()); } rs.getLoadOptions().put(MARK_UNRESOLVABLE_XREFS, Boolean.TRUE); } @@ -172,8 +172,7 @@ public synchronized EObject getEObject(final String uriFragment) { Triple triple = getEncoder().decode(this, uriFragment); INode node = triple.getThird(); final String nodeName = getLinkingHelper().getCrossRefNodeAsString(node, true); - LOGGER.error("Resolution of uriFragment '" + uriFragment + "' in the resource '" + this.getURI() + "' node_name " + nodeName //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + " line " + node.getStartLine() + " offset " + node.getOffset() + " failed.", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LOGGER.error("Resolution of uriFragment '{}' in the resource '{}' node_name {} line {} offset {} failed.", uriFragment, this.getURI(), nodeName, node.getStartLine(), node.getOffset(), e); //$NON-NLS-1$ logged = true; } // CHECKSTYLE:OFF @@ -182,7 +181,7 @@ public synchronized EObject getEObject(final String uriFragment) { // ignore } if (!logged) { - LOGGER.error("Resolution of uriFragment '" + uriFragment + "' in the resource '" + this.getURI() + "' failed.", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LOGGER.error("Resolution of uriFragment '{}' in the resource '{}' failed.", uriFragment, this.getURI(), e); //$NON-NLS-1$ } throw e; } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LinkingService.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LinkingService.java index 528deff64f..18abff85d0 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LinkingService.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LinkingService.java @@ -199,7 +199,7 @@ private IEObjectDescription safeGetSingleElement(final EObject context, final ER try { return getSingleElement(context, ref, qualifiedLinkName); } catch (Exception e) { // IllegalCatchCheck OFF - LOGGER.error("Exception in getSingleElement for " + qualifiedLinkName.toString() + " at " + EObjectUtil.getLocationString(context), e); //$NON-NLS-1$ //$NON-NLS-2$ + LOGGER.error("Exception in getSingleElement for {} at {}", qualifiedLinkName, EObjectUtil.getLocationString(context), e); //$NON-NLS-1$ } return null; } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/ExtendableInferredModelAssociator.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/ExtendableInferredModelAssociator.java index d109341b15..d6e5491140 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/ExtendableInferredModelAssociator.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/ExtendableInferredModelAssociator.java @@ -39,7 +39,7 @@ protected void inferTargetModel(final EObject eObject, final IAcceptor // CHECKSTYLE:OFF } catch (RuntimeException e) { // CHECKSTYLE:ON - LOGGER.error("Failed to install additional derived state for resource " + eObject.eResource().getURI(), e); //$NON-NLS-1$ + LOGGER.error("Failed to install additional derived state for resource {}", eObject.eResource().getURI(), e); //$NON-NLS-1$ } } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/InferredModelAssociator.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/InferredModelAssociator.java index d9726cc2a6..95dc8f9bb3 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/InferredModelAssociator.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference/InferredModelAssociator.java @@ -206,7 +206,7 @@ public final void installDerivedState(final DerivedStateAwareResource resource, // CHECKSTYLE:OFF } catch (RuntimeException e) { // CHECKSTYLE:ON - LOGGER.error("Failed to install derived state for resource " + resource.getURI(), e); //$NON-NLS-1$ + LOGGER.error("Failed to install derived state for resource {}", resource.getURI(), e); //$NON-NLS-1$ } finally { inferenceStack.pop(); } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractResourceDescriptionStrategy.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractResourceDescriptionStrategy.java index b0f331236c..4e770f8ce5 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractResourceDescriptionStrategy.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractResourceDescriptionStrategy.java @@ -10,7 +10,6 @@ *******************************************************************************/ package com.avaloq.tools.ddk.xtext.resource; -import java.text.MessageFormat; import java.util.Map; import java.util.Set; @@ -64,7 +63,7 @@ public boolean createEObjectDescriptions(final EObject from, final IAcceptor getVisibleContainers(final EObject context, final Res // complexity...) final Resource resource = originalResource == null ? context.eResource() : originalResource; if (!(resource instanceof XtextResource)) { - LOGGER.error(MessageFormat.format("Context {0} is not in an Xtext resource: {1}", context, resource != null ? resource.getURI() : "null")); //$NON-NLS-1$ //$NON-NLS-2$ + LOGGER.error("Context {} is not in an Xtext resource: {}", context, resource != null ? resource.getURI() : "null"); //$NON-NLS-1$ //$NON-NLS-2$ throw new IllegalStateException(); } return getVisibleContainers((XtextResource) resource); diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/DelegatingScope.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/DelegatingScope.java index da2da8889b..cebcb02a59 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/DelegatingScope.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/DelegatingScope.java @@ -92,7 +92,7 @@ public String[] getUserDataKeys() { } private void logError() { - LOGGER.error("Cyclic delegate detected in scope \"" + stackOverflowScopeId + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ + LOGGER.error("Cyclic delegate detected in scope \"{}\".", stackOverflowScopeId); //$NON-NLS-1$ } }; diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/INameFunction.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/INameFunction.java index 3afc82e022..4af7c6a2a6 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/INameFunction.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/INameFunction.java @@ -32,8 +32,8 @@ public interface INameFunction extends Function { * @return The name. */ default QualifiedName apply(final IEObjectDescription from) { - LogManager.getLogger(INameFunction.class).warn("No explicit name function for description " + from.getEObjectURI() + " of type " //$NON-NLS-1$ //$NON-NLS-2$ - + EcoreUtil.getURI(from.getEClass())); + LogManager.getLogger(INameFunction.class).warn("No explicit name function for description {} of type {}", from.getEObjectURI(), //$NON-NLS-1$ + EcoreUtil.getURI(from.getEClass())); return from.getName(); } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/BuilderParticipantSettings.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/BuilderParticipantSettings.java index 3285b0ea91..3e795829be 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/BuilderParticipantSettings.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/BuilderParticipantSettings.java @@ -51,7 +51,7 @@ public static boolean isBuilderParticipantEnabled(final String languageName) { try { result = BuilderParticipantStatus.valueOf(value); } catch (IllegalArgumentException ex) { - LOGGER.error("Property " + languageName + " has an invalid value: " + value + " (should be one of enabled, disabled)"); + LOGGER.error("Property {} has an invalid value: {} (should be one of enabled, disabled)", languageName, value); result = BuilderParticipantStatus.ENABLED; } return result == BuilderParticipantStatus.ENABLED; diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/EmfResourceUtil.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/EmfResourceUtil.java index ed004c9c25..99c9e48070 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/EmfResourceUtil.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/util/EmfResourceUtil.java @@ -99,7 +99,7 @@ public static Resource loadURI(final URI uri, final ResourceSet resourceSet) { try { resource.load(resourceSet.getLoadOptions()); } catch (IOException e) { - LOGGER.warn("loadURI: Unable to load resource : " + resource.getURI().toString()); //$NON-NLS-1$ + LOGGER.warn("loadURI: Unable to load resource : {}", resource.getURI()); //$NON-NLS-1$ return null; } } From 439557c44a119be54c54b2d0a9ade78d50a08d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 15:56:29 +0100 Subject: [PATCH 4/8] refactor: use Supplier/method-refs for debug and trace log arguments Convert debug/trace log calls to use Log4j2 Supplier overloads (method references and lambdas) for lazy argument evaluation. Remove superfluous isDebugEnabled/isTraceEnabled guards that are no longer needed when all arguments are Suppliers. Co-Authored-By: Claude Opus 4.6 --- .../ui/validation/CheckMarkerUpdateJob.java | 15 ++++-------- .../util/DynamicContextActionUiTestUtil.java | 14 ++++------- .../util/WaitForDynamicContextMenuItem.java | 8 ++----- .../ddk/typesystem/AbstractTypeProvider.java | 12 +++------- .../CachingStateBasedContainerManager.java | 4 +--- .../xtext/builder/RebuildingXtextBuilder.java | 15 +++++------- .../ResponsiveXtextDocumentProvider.java | 6 +---- .../ddk/xtext/ui/util/RuntimeProjectUtil.java | 2 +- ...ractCachingResourceDescriptionManager.java | 16 ++++--------- .../ddk/xtext/scoping/NameFunctions.java | 23 ++++++++----------- 10 files changed, 37 insertions(+), 78 deletions(-) diff --git a/com.avaloq.tools.ddk.check.runtime.ui/src/com/avaloq/tools/ddk/check/runtime/ui/validation/CheckMarkerUpdateJob.java b/com.avaloq.tools.ddk.check.runtime.ui/src/com/avaloq/tools/ddk/check/runtime/ui/validation/CheckMarkerUpdateJob.java index 1386d6e9b5..ecd395e298 100644 --- a/com.avaloq.tools.ddk.check.runtime.ui/src/com/avaloq/tools/ddk/check/runtime/ui/validation/CheckMarkerUpdateJob.java +++ b/com.avaloq.tools.ddk.check.runtime.ui/src/com/avaloq/tools/ddk/check/runtime/ui/validation/CheckMarkerUpdateJob.java @@ -10,7 +10,6 @@ *******************************************************************************/ package com.avaloq.tools.ddk.check.runtime.ui.validation; -import java.text.MessageFormat; import java.util.Collection; import java.util.Set; @@ -95,9 +94,7 @@ private IFile getFileFromStorageMapper(final IStorage2UriMapper storage2UriMappe return (IFile) storage.getFirst(); } } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format("Could not find storage for URI {0}", fileUri.toString())); //$NON-NLS-1$ - } + LOGGER.debug("Could not find storage for URI {}", fileUri::toString); //$NON-NLS-1$ return null; } @@ -135,9 +132,7 @@ protected IStatus run(final IProgressMonitor monitor) { final IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri); if (serviceProvider == null) { // This may happen for non-Xtext resources in ice entities - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format("Could not validate {0}: no resource service provider found", uri.toString())); //$NON-NLS-1$ - } + LOGGER.debug("Could not validate {}: no resource service provider found", uri::toString); //$NON-NLS-1$ continue; // Skip to next URI } @@ -152,7 +147,7 @@ protected IStatus run(final IProgressMonitor monitor) { } if (resourceValidator == null) { - LOGGER.error(MessageFormat.format("Could not validate {0}: no resource validator found", iFile.getName())); //$NON-NLS-1$ + LOGGER.error("Could not validate {}: no resource validator found", iFile.getName()); //$NON-NLS-1$ } else if (iFile != null) { monitor.subTask("loading " + iFile.getName()); //$NON-NLS-1$ @@ -175,11 +170,11 @@ protected IStatus run(final IProgressMonitor monitor) { // CHECKSTYLE:OFF } catch (final RuntimeException e) { // CHECKSTYLE:ON - LOGGER.error(MessageFormat.format("{0} could not be validated.", iFile.getName()), e); //$NON-NLS-1$ + LOGGER.error("{} could not be validated.", iFile.getName(), e); //$NON-NLS-1$ } finally { if (eResource != null) { validateAndCreateMarkers(resourceValidator, markerCreator, iFile, eResource, monitor); - LOGGER.debug("Validated " + uri); //$NON-NLS-1$ + LOGGER.debug("Validated {}", uri); //$NON-NLS-1$ if (loaded) { // NOPMD // unload any resource that was previously loaded as part of this loop. eResource.unload(); diff --git a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/DynamicContextActionUiTestUtil.java b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/DynamicContextActionUiTestUtil.java index 91a2eb3a3f..e0c61c4574 100644 --- a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/DynamicContextActionUiTestUtil.java +++ b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/DynamicContextActionUiTestUtil.java @@ -65,9 +65,7 @@ public static void clickContextMenu(final AbstractSWTBot bot, * @throw {@link WidgetNotFoundException} if the context menu could not be found */ public static void clickContextMenu(final Runnable setSelection, final AbstractSWTBot bot, final DynamicMenuPredicate predicate, final String... labels) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("clickContextMenu(" + bot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - } + LOGGER.debug("clickContextMenu({} , {});", () -> bot, () -> Arrays.asList(labels)); //$NON-NLS-1$ try { setSelection.run(); logSelection(bot); @@ -101,7 +99,7 @@ private static void logSelection(final AbstractSWTBot bot) { if (LOGGER.isDebugEnabled()) { TableCollection selection = tryGetSelection(bot); if (selection != null) { - LOGGER.debug("setSelection(" + selection + ")"); // NOPMD GuardLogStatement //$NON-NLS-1$//$NON-NLS-2$ + LOGGER.debug("setSelection({})", selection); //$NON-NLS-1$ } } } @@ -140,9 +138,7 @@ private static void tryUnselect(final AbstractSWTBot bot) { * @return {@code true} if on the given widget bot a context menu with the given text is available, else {@code false} */ public static boolean hasContextMenuItem(final AbstractSWTBot widgetBot, final DynamicMenuPredicate predicate, final String... labels) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("hasContextMenuItem(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - } + LOGGER.debug("hasContextMenuItem({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$ try { return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels) != null; } catch (WidgetNotFoundException widgetNotFound) { @@ -164,9 +160,7 @@ public static boolean hasContextMenuItem(final AbstractSWTBot * @throw {@link WidgetNotFoundException} if the context menu could not be found */ public static boolean isEnabled(final AbstractSWTBot widgetBot, final DynamicMenuPredicate predicate, final String... labels) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("isEnabled(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - } + LOGGER.debug("isEnabled({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$ try { return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels).isEnabled(); } catch (WidgetNotFoundException widgetNotFound) { diff --git a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java index 896fd02f58..a2c4ec6780 100644 --- a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java +++ b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java @@ -78,18 +78,14 @@ public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenuItem menu, fi super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index); itemMatcher = (DynamicContextMenuItemMatcher) this.matcher; this.widget = menu.widget; - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$ - } + LOGGER.debug("MenuItem finder matching {}", itemMatcher); //$NON-NLS-1$ } public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenu menu, final Matcher matcher, final boolean recursive, final int index) { super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index); itemMatcher = (DynamicContextMenuItemMatcher) this.matcher; this.widget = menu.widget; - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$ - } + LOGGER.debug("MenuItem finder matching {}", itemMatcher); //$NON-NLS-1$ } @Override diff --git a/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProvider.java b/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProvider.java index 8fa32d8c7a..5da417d093 100644 --- a/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProvider.java +++ b/com.avaloq.tools.ddk.typesystem/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProvider.java @@ -154,14 +154,10 @@ public E get(final Object key, final Resource resource, final Provider pr @SuppressWarnings("unchecked") ImmutableLinkedItem linkedItem = (ImmutableLinkedItem) key; if (!(linkedItem.object instanceof EObject)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("cache skip: " + element); //$NON-NLS-1$ - } + LOGGER.debug("cache skip: {}", element); //$NON-NLS-1$ return element; } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("cache: " + element); //$NON-NLS-1$ - } + LOGGER.debug("cache: {}", element); //$NON-NLS-1$ adapter.set(composedKey, element); } else { cacheHit(adapter); @@ -263,9 +259,7 @@ public IType get() { return doComputation(t); } }); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("cache hit: " + hit[0] + " for: " + t); //$NON-NLS-1$ //$NON-NLS-2$ - } + LOGGER.debug("cache hit: {} for: {}", hit[0], t); //$NON-NLS-1$ return result; } else { if (computationData.resourceLeftOrCyclic) { diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/CachingStateBasedContainerManager.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/CachingStateBasedContainerManager.java index 96a0ae69b0..56acd864ed 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/CachingStateBasedContainerManager.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/CachingStateBasedContainerManager.java @@ -122,9 +122,7 @@ public void descriptionsChanged(final Event event) { public List getVisibleContainers(final IResourceDescription desc, final IResourceDescriptions resourceDescriptions) { String root = internalGetContainerHandle(desc, resourceDescriptions); if (root == null) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Cannot find IContainer for: " + desc.getURI()); //$NON-NLS-1$ - } + LOGGER.debug("Cannot find IContainer for: {}", desc::getURI); //$NON-NLS-1$ return Collections.emptyList(); } List handles = getState(resourceDescriptions).getVisibleContainerHandles(root); diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java index 1788f88ca3..1b9ddbea62 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java @@ -161,10 +161,9 @@ protected IProject[] build(final int kind, final Map args, final IProgressMonito @Override protected void doBuild(final ToBeBuilt toBeBuilt, final IProgressMonitor monitor, final BuildType type) throws CoreException { if (!toBeBuilt.getToBeDeleted().isEmpty() || !toBeBuilt.getToBeUpdated().isEmpty()) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Starting " + type.name() + " build:" + "\ndeleted(" + toBeBuilt.getToBeDeleted().size() + ")=" + toBeBuilt.getToBeDeleted().toString() - + "\nupdated(" + toBeBuilt.getToBeUpdated().size() + ")=" + toBeBuilt.getToBeUpdated().toString()); - } + LOGGER.debug("Starting {} build:\ndeleted({})={}\nupdated({})={}", type::name, + toBeBuilt.getToBeDeleted()::size, toBeBuilt.getToBeDeleted()::toString, + toBeBuilt.getToBeUpdated()::size, toBeBuilt.getToBeUpdated()::toString); SubMonitor progress = SubMonitor.convert(monitor, 1 + 1 + 1); // build + participant + rebuild @@ -194,11 +193,9 @@ protected void doBuild(final ToBeBuilt toBeBuilt, final IProgressMonitor monitor } resourceSet.getResources().clear(); resourceSet.eAdapters().clear(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Build done."); - } - } else if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Ignoring empty " + type.name() + " build."); + LOGGER.debug("Build done."); + } else { + LOGGER.debug("Ignoring empty {} build.", type::name); } } } diff --git a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java index df8b3441bd..3822a1b15f 100644 --- a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java +++ b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java @@ -19,7 +19,6 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.osgi.util.NLS; import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.eclipse.xtext.Constants; import org.eclipse.xtext.ui.editor.model.XtextDocument; @@ -81,11 +80,8 @@ protected void disconnected() { * the event */ @Override - @SuppressWarnings("PMD.UnnecessaryVarargsArrayCreation") public void propertyChange(final PropertyChangeEvent event) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(NLS.bind("Preference Change: {0} => {1} -> {2}", new Object[] {event.getProperty(), event.getOldValue(), event.getNewValue()})); //$NON-NLS-1$ - } + LOGGER.debug("Preference Change: {} => {} -> {}", event::getProperty, event::getOldValue, event::getNewValue); //$NON-NLS-1$ for (Iterator i = getConnectedElements(); i.hasNext();) { ((XtextDocument) getDocument(i.next())).checkAndUpdateAnnotations(); diff --git a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/util/RuntimeProjectUtil.java b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/util/RuntimeProjectUtil.java index eaa6e7d660..81f9f10fb3 100644 --- a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/util/RuntimeProjectUtil.java +++ b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/util/RuntimeProjectUtil.java @@ -62,7 +62,7 @@ public boolean apply(final Pair input) { return (IFile) fileStorage.getFirst(); } catch (NoSuchElementException e) { - LOGGER.debug("Cannot find file storage for " + uri); //$NON-NLS-1$ + LOGGER.debug("Cannot find file storage for {}", uri); //$NON-NLS-1$ return null; } } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java index a04110b446..8e24329748 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java @@ -154,9 +154,7 @@ public boolean isAffected(final Collection deltas, final IResourceDescrip final URI deltaURI = delta.getUri();// NOPMD - potentially could be lost due to call on getNew() after // deleted resources are no longer visible resources so we test them, too. if (delta.getNew() == null && isReferencedBy(delta, candidate, context)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(candidate.getURI() + " is affected by " + delta.getUri()); //$NON-NLS-1$ - } + LOGGER.debug("{} is affected by {}", candidate::getURI, delta::getUri); //$NON-NLS-1$ return true; } @@ -165,9 +163,7 @@ public boolean isAffected(final Collection deltas, final IResourceDescrip for (IContainer container : containers) { if (container.getResourceDescription(deltaURI) != null) { if (isReferencedBy(delta, candidate, context)) { - if (LOGGER.isDebugEnabled()) { // NOPMD AvoidDeeplyNestedIfStmts - LOGGER.debug(candidate.getURI() + " is affected by " + delta.getUri()); //$NON-NLS-1$ - } + LOGGER.debug("{} is affected by {}", candidate::getURI, delta::getUri); //$NON-NLS-1$ return true; } break; @@ -370,9 +366,7 @@ public boolean isAffected(final Delta delta, final IResourceDescription candidat if (delta.getUri().equals(candidate.getURI())) { // If the delta is for ourselves, we're always affected; otherwise the dirty state manager may omit to update the editor // state. - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(delta.getUri() + " is the same as " + candidate.getURI()); //$NON-NLS-1$ - } + LOGGER.debug("{} is the same as {}", delta::getUri, candidate::getURI); //$NON-NLS-1$ return true; } if (!delta.haveEObjectDescriptionsChanged()) { @@ -396,7 +390,7 @@ public boolean isAffected(final Delta delta, final IResourceDescription candidat boolean disjointResolved = Collections.disjoint(resolvedNames, resolvedAndUnresolvedNames.getFirst()); if (!disjointResolved && LOGGER.isDebugEnabled()) { resolvedNames.retainAll(getImportedNames(candidate)); - LOGGER.debug("resolved names imported by " + candidate.getURI() + " are exported by " + delta.getUri() + " intersection:" + resolvedNames.toString()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + LOGGER.debug("resolved names imported by {} are exported by {} intersection:{}", candidate::getURI, delta::getUri, resolvedNames::toString); //$NON-NLS-1$ } if (!disjointResolved) { return true; @@ -404,7 +398,7 @@ public boolean isAffected(final Delta delta, final IResourceDescription candidat boolean disjointUnresolved = Collections.disjoint(unresolvedNames, resolvedAndUnresolvedNames.getSecond()); if (!disjointUnresolved && LOGGER.isDebugEnabled()) { unresolvedNames.retainAll(getImportedNames(candidate)); - LOGGER.debug("unrevolved names imported by " + candidate.getURI() + " are exported by " + delta.getUri() + " intersection:" + unresolvedNames.toString()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + LOGGER.debug("unresolved names imported by {} are exported by {} intersection:{}", candidate::getURI, delta::getUri, unresolvedNames::toString); //$NON-NLS-1$ } return !disjointUnresolved; } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/NameFunctions.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/NameFunctions.java index 405e0cc711..2eb2d93b2c 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/NameFunctions.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/NameFunctions.java @@ -10,7 +10,6 @@ *******************************************************************************/ package com.avaloq.tools.ddk.xtext.scoping; -import java.text.MessageFormat; import java.util.Arrays; import org.apache.logging.log4j.LogManager; @@ -35,11 +34,11 @@ public final class NameFunctions { private static final String FEATURE_NAME = "FeatureName:";//$NON-NLS-1$ - private static final String UNKNOWN_FEATURE_0_FROM_1 = "Unknown feature {0} from {1}";//$NON-NLS-1$ + private static final String UNKNOWN_FEATURE_0_FROM_1 = "Unknown feature {} from {}";//$NON-NLS-1$ - private static final String COULD_NOT_READ_FEATURE_0_FROM_1 = "Could not read feature {0} from {1}";//$NON-NLS-1$ + private static final String COULD_NOT_READ_FEATURE_0_FROM_1 = "Could not read feature {} from {}";//$NON-NLS-1$ - private static final String NO_USER_DATA_0_FOUND_FOR_1 = "No user data \'\'{0}\'\' found for {1}."; //$NON-NLS-1$ + private static final String NO_USER_DATA_0_FOUND_FOR_1 = "No user data ''{}'' found for {}."; //$NON-NLS-1$ /** Class-wide logger. */ private static final Logger LOGGER = LogManager.getLogger(NameFunctions.class); @@ -76,8 +75,8 @@ public static INameFunction fromFeature(final EStructuralFeature feature) { @Override public QualifiedName apply(final IEObjectDescription from) { String res = from.getUserData(feature.getName()); - if (res == null && LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format(NO_USER_DATA_0_FOUND_FOR_1, feature.getName(), from.getEObjectOrProxy())); + if (res == null) { + LOGGER.debug(NO_USER_DATA_0_FOUND_FOR_1, feature::getName, from::getEObjectOrProxy); } return QualifiedNames.safeQualifiedName(res); } @@ -89,9 +88,7 @@ public QualifiedName apply(final EObject from) { value = from.eGet(feature); // CHECKSTYLE:OFF } catch (final RuntimeException e) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format(COULD_NOT_READ_FEATURE_0_FROM_1, feature, from), e); - } + LOGGER.debug(COULD_NOT_READ_FEATURE_0_FROM_1, feature, from, e); return null; } // CHECKSTYLE:ON @@ -159,8 +156,8 @@ public static INameFunction fromFeatureName(final String featureName) { @Override public QualifiedName apply(final EObject from) { final EStructuralFeature feature = from.eClass().getEStructuralFeature(featureName); - if (feature == null && LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format(UNKNOWN_FEATURE_0_FROM_1, featureName, from)); + if (feature == null) { + LOGGER.debug(UNKNOWN_FEATURE_0_FROM_1, featureName, from); } Object value; try { @@ -168,9 +165,7 @@ public QualifiedName apply(final EObject from) { // CHECKSTYLE:OFF } catch (final RuntimeException e) { // CHECKSTYLE:ON - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(MessageFormat.format(COULD_NOT_READ_FEATURE_0_FROM_1, featureName, from), e); - } + LOGGER.debug(COULD_NOT_READ_FEATURE_0_FROM_1, featureName, from, e); return null; } return value != null ? QualifiedNames.safeQualifiedName(value.toString()) : null; From 4c52696b96dd9027a0c07dbcb402c741251be85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 16:01:44 +0100 Subject: [PATCH 5/8] fix: suppress PMD GuardLogStatement false positives Add NOPMD suppression for SWTBot's SLF4J logger (no Supplier support), ITraceSet.trace() misidentified as a log call, and Log4j2 method-ref Suppliers not recognized by PMD. Co-Authored-By: Claude Opus 4.6 --- .../src/com/avaloq/tools/ddk/test/ui/swtbot/SwtBotButton.java | 4 ++-- .../ddk/xtext/builder/MonitoredClusteringBuilderState.java | 2 +- .../tools/ddk/xtext/builder/RebuildingXtextBuilder.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/SwtBotButton.java b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/SwtBotButton.java index bfb454b349..567613d5de 100644 --- a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/SwtBotButton.java +++ b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/SwtBotButton.java @@ -39,7 +39,7 @@ public SwtBotButton(final Button button, final SelfDescribing description) { */ @Override public SwtBotButton click() { - log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ + log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ // NOPMD GuardLogStatement waitForEnabled(); notify(SWT.MouseEnter); notify(SWT.MouseMove); @@ -48,7 +48,7 @@ public SwtBotButton click() { notify(SWT.MouseDown); notify(SWT.MouseUp); notify(SWT.Selection); - log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ + log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ // NOPMD GuardLogStatement return this; } } diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java index 219aa1987f..c6134ccba7 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java @@ -642,7 +642,7 @@ public boolean isCanceled() { final long memoryDelta = Runtime.getRuntime().freeMemory() - initialMemory; final int resourceSetSizeDelta = resourceSet.getResources().size() - initialResourceSetSize; final long timeDelta = System.nanoTime() - initialTime; - traceSet.trace(ResourceLinkingMemoryEvent.class, changedURI, memoryDelta, resourceSetSizeDelta, timeDelta); + traceSet.trace(ResourceLinkingMemoryEvent.class, changedURI, memoryDelta, resourceSetSizeDelta, timeDelta); // NOPMD GuardLogStatement - not a logger call } watchdog.reportWorkEnded(index, index + queue.size()); } diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java index 1b9ddbea62..5b22d10730 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/RebuildingXtextBuilder.java @@ -161,7 +161,7 @@ protected IProject[] build(final int kind, final Map args, final IProgressMonito @Override protected void doBuild(final ToBeBuilt toBeBuilt, final IProgressMonitor monitor, final BuildType type) throws CoreException { if (!toBeBuilt.getToBeDeleted().isEmpty() || !toBeBuilt.getToBeUpdated().isEmpty()) { - LOGGER.debug("Starting {} build:\ndeleted({})={}\nupdated({})={}", type::name, + LOGGER.debug("Starting {} build:\ndeleted({})={}\nupdated({})={}", type::name, // NOPMD GuardLogStatement - all args are Suppliers toBeBuilt.getToBeDeleted()::size, toBeBuilt.getToBeDeleted()::toString, toBeBuilt.getToBeUpdated()::size, toBeBuilt.getToBeUpdated()::toString); From b22655d2aa6a441a6d39ecce092fd9136c8a8a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 17:12:52 +0100 Subject: [PATCH 6/8] fix: extract duplicate log format strings to constants Checkstyle MultipleStringLiteralsCheck flagged parameterized log messages that appeared more than once in the same file. Co-Authored-By: Claude Opus 4.6 --- .../tools/ddk/check/ui/builder/util/CheckProjectHelper.java | 5 +++-- .../test/ui/swtbot/util/WaitForDynamicContextMenuItem.java | 5 +++-- .../ddk/xtext/builder/MonitoredClusteringBuilderState.java | 6 +++--- .../resource/AbstractCachingResourceDescriptionManager.java | 6 ++++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java index 2307bda5f4..16f5799ccb 100644 --- a/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java +++ b/com.avaloq.tools.ddk.check.ui/src/com/avaloq/tools/ddk/check/ui/builder/util/CheckProjectHelper.java @@ -52,6 +52,7 @@ public class CheckProjectHelper { private static final Logger LOGGER = LogManager.getLogger(CheckProjectHelper.class); + private static final String LOG_PLUGIN_PATH_ERROR = "Could not determine plugin path for catalog {}"; @Inject private IStorage2UriMapper mapper; @@ -90,7 +91,7 @@ public String getCatalogPluginPath(final CheckCatalog catalog) { String result = packageFragment.getElementName().replace('.', '/'); return result + '/' + file.getName(); } catch (JavaModelException e) { - LOGGER.error("Could not determine plugin path for catalog {}", catalog.getName(), e); + LOGGER.error(LOG_PLUGIN_PATH_ERROR, catalog.getName(), e); } return null; } @@ -114,7 +115,7 @@ public String getCatalogQualifiedName(final CheckCatalog catalog) { final String fileNameWithoutExtension = file.getName().substring(0, file.getName().length() - (file.getFileExtension().length() + 1)); return packageFragment.getElementName() + '.' + fileNameWithoutExtension; } catch (JavaModelException e) { - LOGGER.error("Could not determine plugin path for catalog {}", catalog.getName(), e); + LOGGER.error(LOG_PLUGIN_PATH_ERROR, catalog.getName(), e); } return null; } diff --git a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java index a2c4ec6780..e8acbe4a16 100644 --- a/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java +++ b/com.avaloq.tools.ddk.test.ui/src/com/avaloq/tools/ddk/test/ui/swtbot/util/WaitForDynamicContextMenuItem.java @@ -34,6 +34,7 @@ */ public class WaitForDynamicContextMenuItem extends WaitForMenuItem { private static final Logger LOGGER = LogManager.getLogger(WaitForDynamicContextMenuItem.class); + private static final String LOG_MENU_ITEM_FINDER = "MenuItem finder matching {}"; //$NON-NLS-1$ /** * Custom wrapper around a given {@link Matcher} that collects data about waiting dynamic menu items as @@ -78,14 +79,14 @@ public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenuItem menu, fi super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index); itemMatcher = (DynamicContextMenuItemMatcher) this.matcher; this.widget = menu.widget; - LOGGER.debug("MenuItem finder matching {}", itemMatcher); //$NON-NLS-1$ + LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher); } public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenu menu, final Matcher matcher, final boolean recursive, final int index) { super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index); itemMatcher = (DynamicContextMenuItemMatcher) this.matcher; this.widget = menu.widget; - LOGGER.debug("MenuItem finder matching {}", itemMatcher); //$NON-NLS-1$ + LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher); } @Override diff --git a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java index c6134ccba7..7d1be1eb78 100644 --- a/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java +++ b/com.avaloq.tools.ddk.xtext.builder/src/com/avaloq/tools/ddk/xtext/builder/MonitoredClusteringBuilderState.java @@ -132,7 +132,7 @@ public class MonitoredClusteringBuilderState extends ClusteringBuilderState private static final int COMMIT_WARN_WAIT_SEC = 30; - private static final String FAILED_TO_SAVE_BINARY = "Failed to save binary for "; //$NON-NLS-1$ + private static final String FAILED_TO_SAVE_BINARY_LOG = "Failed to save binary for {}"; //$NON-NLS-1$ /** Class-wide logger. */ private static final Logger LOGGER = LogManager.getLogger(MonitoredClusteringBuilderState.class); @@ -751,12 +751,12 @@ protected void doStoreBinaryResource(final Resource resource, final BuildData bu LOGGER.info("saving binary taking longer than expected ({} ms): {}", elapsedMillis, resource.getURI()); //$NON-NLS-1$ } } catch (WrappedException ex) { - LOGGER.error("{}{}", FAILED_TO_SAVE_BINARY, resource.getURI(), ex.exception()); + LOGGER.error(FAILED_TO_SAVE_BINARY_LOG, resource.getURI(), ex.exception()); // CHECKSTYLE:OFF } catch (Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("{}{}", FAILED_TO_SAVE_BINARY, resource.getURI(), ex); + LOGGER.error(FAILED_TO_SAVE_BINARY_LOG, resource.getURI(), ex); } } diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java index 8e24329748..f7536c8f69 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/AbstractCachingResourceDescriptionManager.java @@ -61,6 +61,8 @@ public abstract class AbstractCachingResourceDescriptionManager extends DerivedS /** Class-wide logger. */ private static final Logger LOGGER = LogManager.getLogger(AbstractCachingResourceDescriptionManager.class); + private static final String LOG_AFFECTED_BY = "{} is affected by {}"; //$NON-NLS-1$ + /** Cache key for the resource description of a resource. */ public static final String CACHE_KEY = DefaultResourceDescriptionManager.class.getName() + "#getResourceDescription"; //$NON-NLS-1$ @@ -154,7 +156,7 @@ public boolean isAffected(final Collection deltas, final IResourceDescrip final URI deltaURI = delta.getUri();// NOPMD - potentially could be lost due to call on getNew() after // deleted resources are no longer visible resources so we test them, too. if (delta.getNew() == null && isReferencedBy(delta, candidate, context)) { - LOGGER.debug("{} is affected by {}", candidate::getURI, delta::getUri); //$NON-NLS-1$ + LOGGER.debug(LOG_AFFECTED_BY, candidate::getURI, delta::getUri); return true; } @@ -163,7 +165,7 @@ public boolean isAffected(final Collection deltas, final IResourceDescrip for (IContainer container : containers) { if (container.getResourceDescription(deltaURI) != null) { if (isReferencedBy(delta, candidate, context)) { - LOGGER.debug("{} is affected by {}", candidate::getURI, delta::getUri); //$NON-NLS-1$ + LOGGER.debug(LOG_AFFECTED_BY, candidate::getURI, delta::getUri); return true; } break; From 318edc2f7cd6329b964393569c3a9cff6ce80cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 18:16:00 +0100 Subject: [PATCH 7/8] fix: avoid log4j Supplier lambda in OSGi runtime The log4j util.Supplier package is not available in the OSGi test runtime. Use direct parameterized logging instead of lambdas for info-level messages that are almost always evaluated. Co-Authored-By: Claude Opus 4.6 --- .../src/com/avaloq/tools/ddk/test/core/LoggingRule.java | 8 ++++---- .../avaloq/tools/ddk/test/core/jupiter/LoggingRule.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java index 1f77b4b00f..eb6f5da0a6 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java @@ -63,21 +63,21 @@ private String getDescriptionName(final Description description) { @Override public void starting(final Description description) { - LOGGER.info("STARTING: {}", () -> getDescriptionName(description)); + LOGGER.info("STARTING: {}", getDescriptionName(description)); } @Override protected void finished(final Description description) { - LOGGER.info("FINISHED: {}", () -> getDescriptionName(description)); + LOGGER.info("FINISHED: {}", getDescriptionName(description)); } @Override protected void succeeded(final Description description) { - LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(description)); + LOGGER.info("SUCCEEDED: {}", getDescriptionName(description)); } @Override protected void failed(final Throwable e, final Description description) { - LOGGER.info("FAILED: {}", () -> getDescriptionName(description)); + LOGGER.info("FAILED: {}", getDescriptionName(description)); } } diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java index b960424c44..d506fa055a 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java @@ -54,7 +54,7 @@ public static LoggingRule getInstance() { @Override public void beforeEach(final ExtensionContext context) throws Exception { - LOGGER.info("STARTING: {}", () -> getDescriptionName(context)); + LOGGER.info("STARTING: {}", getDescriptionName(context)); } /** @@ -70,16 +70,16 @@ private String getDescriptionName(final ExtensionContext context) { @Override public void testSuccessful(final ExtensionContext context) { - LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(context)); + LOGGER.info("SUCCEEDED: {}", getDescriptionName(context)); } @Override public void testFailed(final ExtensionContext context, final Throwable cause) { - LOGGER.info("FAILED: {}", () -> getDescriptionName(context)); + LOGGER.info("FAILED: {}", getDescriptionName(context)); } @Override public void afterEach(final ExtensionContext context) throws Exception { - LOGGER.info("FINISHED: {}", () -> getDescriptionName(context)); + LOGGER.info("FINISHED: {}", getDescriptionName(context)); } } From ec952badc0432c74065c3135ab0d2be328d07b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 7 Mar 2026 18:34:37 +0100 Subject: [PATCH 8/8] fix: add log4j.util import for Supplier-based log lambdas Add org.apache.logging.log4j.util to Import-Package in OSGi manifests so that Supplier lambdas in log calls resolve at runtime. This reverts the de-lambda workaround (318edc2f7) and fixes the root cause instead. Co-Authored-By: Claude Opus 4.6 --- .../META-INF/MANIFEST.MF | 3 ++- com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF | 3 ++- .../src/com/avaloq/tools/ddk/test/core/LoggingRule.java | 8 ++++---- .../avaloq/tools/ddk/test/core/jupiter/LoggingRule.java | 8 ++++---- com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF | 2 +- com.avaloq.tools.ddk.xtext.builder/META-INF/MANIFEST.MF | 3 ++- com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF | 3 ++- com.avaloq.tools.ddk.xtext.ui/META-INF/MANIFEST.MF | 3 ++- com.avaloq.tools.ddk.xtext/META-INF/MANIFEST.MF | 4 +++- 9 files changed, 22 insertions(+), 15 deletions(-) diff --git a/com.avaloq.tools.ddk.check.runtime.ui/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.check.runtime.ui/META-INF/MANIFEST.MF index 61c2242640..28b08ca1c7 100644 --- a/com.avaloq.tools.ddk.check.runtime.ui/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.check.runtime.ui/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-ActivationPolicy: lazy -Import-Package: org.apache.logging.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util Export-Package: com.avaloq.tools.ddk.check.runtime.ui.editor, com.avaloq.tools.ddk.check.runtime.ui.editor.model, com.avaloq.tools.ddk.check.runtime.ui.quickfix, diff --git a/com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF index 3acdf2e74e..9faf8e04ec 100644 --- a/com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF @@ -22,5 +22,6 @@ Export-Package: com.avaloq.tools.ddk.test.core, com.avaloq.tools.ddk.test.core.jupiter, com.avaloq.tools.ddk.test.core.mock, com.avaloq.tools.ddk.test.core.util -Import-Package: org.apache.logging.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util Automatic-Module-Name: com.avaloq.tools.ddk.test.core diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java index eb6f5da0a6..1f77b4b00f 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/LoggingRule.java @@ -63,21 +63,21 @@ private String getDescriptionName(final Description description) { @Override public void starting(final Description description) { - LOGGER.info("STARTING: {}", getDescriptionName(description)); + LOGGER.info("STARTING: {}", () -> getDescriptionName(description)); } @Override protected void finished(final Description description) { - LOGGER.info("FINISHED: {}", getDescriptionName(description)); + LOGGER.info("FINISHED: {}", () -> getDescriptionName(description)); } @Override protected void succeeded(final Description description) { - LOGGER.info("SUCCEEDED: {}", getDescriptionName(description)); + LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(description)); } @Override protected void failed(final Throwable e, final Description description) { - LOGGER.info("FAILED: {}", getDescriptionName(description)); + LOGGER.info("FAILED: {}", () -> getDescriptionName(description)); } } diff --git a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java index d506fa055a..b960424c44 100644 --- a/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java +++ b/com.avaloq.tools.ddk.test.core/src/com/avaloq/tools/ddk/test/core/jupiter/LoggingRule.java @@ -54,7 +54,7 @@ public static LoggingRule getInstance() { @Override public void beforeEach(final ExtensionContext context) throws Exception { - LOGGER.info("STARTING: {}", getDescriptionName(context)); + LOGGER.info("STARTING: {}", () -> getDescriptionName(context)); } /** @@ -70,16 +70,16 @@ private String getDescriptionName(final ExtensionContext context) { @Override public void testSuccessful(final ExtensionContext context) { - LOGGER.info("SUCCEEDED: {}", getDescriptionName(context)); + LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(context)); } @Override public void testFailed(final ExtensionContext context, final Throwable cause) { - LOGGER.info("FAILED: {}", getDescriptionName(context)); + LOGGER.info("FAILED: {}", () -> getDescriptionName(context)); } @Override public void afterEach(final ExtensionContext context) throws Exception { - LOGGER.info("FINISHED: {}", getDescriptionName(context)); + LOGGER.info("FINISHED: {}", () -> getDescriptionName(context)); } } diff --git a/com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF index 97eed89ed2..24f6349095 100644 --- a/com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF @@ -28,6 +28,6 @@ Export-Package: com.avaloq.tools.ddk.test.ui, com.avaloq.tools.ddk.test.ui.swtbot, com.avaloq.tools.ddk.test.ui.swtbot.condition, com.avaloq.tools.ddk.test.ui.swtbot.util -Import-Package: org.slf4j, org.apache.logging.log4j,org.apache.log4j +Import-Package: org.slf4j, org.apache.logging.log4j,org.apache.logging.log4j.util,org.apache.log4j Eclipse-RegisterBuddy: org.eclipse.swtbot.swt.finder Automatic-Module-Name: com.avaloq.tools.ddk.test.ui diff --git a/com.avaloq.tools.ddk.xtext.builder/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.xtext.builder/META-INF/MANIFEST.MF index 1466c53f12..c752a7ab7a 100644 --- a/com.avaloq.tools.ddk.xtext.builder/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.xtext.builder/META-INF/MANIFEST.MF @@ -15,5 +15,6 @@ Export-Package: com.avaloq.tools.ddk.xtext.builder, com.avaloq.tools.ddk.xtext.builder.resourceloader, com.avaloq.tools.ddk.xtext.builder.tracing, com.avaloq.tools.ddk.xtext.extensions -Import-Package: org.apache.logging.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util Automatic-Module-Name: com.avaloq.tools.ddk.xtext.builder diff --git a/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF index c2c26684f7..ee7172edf7 100644 --- a/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF @@ -34,6 +34,7 @@ Export-Package: com.avaloq.tools.ddk.xtext.generator.builder, com.avaloq.tools.ddk.xtext.generator.resourceFactory, com.avaloq.tools.ddk.xtext.generator.ide.contentAssist, com.avaloq.tools.ddk.xtext.generator.parser.common -Import-Package: org.apache.logging.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util Eclipse-ExtensibleAPI: true Automatic-Module-Name: com.avaloq.tools.ddk.xtext.generator diff --git a/com.avaloq.tools.ddk.xtext.ui/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.xtext.ui/META-INF/MANIFEST.MF index a4597edbb1..2206601ab9 100644 --- a/com.avaloq.tools.ddk.xtext.ui/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.xtext.ui/META-INF/MANIFEST.MF @@ -32,5 +32,6 @@ Export-Package: com.avaloq.tools.ddk.xtext.ui, com.avaloq.tools.ddk.xtext.ui.templates, com.avaloq.tools.ddk.xtext.ui.util, com.avaloq.tools.ddk.xtext.ui.validation -Import-Package: org.apache.logging.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util Automatic-Module-Name: com.avaloq.tools.ddk.xtext.ui diff --git a/com.avaloq.tools.ddk.xtext/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.xtext/META-INF/MANIFEST.MF index 5dd3390a4e..44fabf066a 100644 --- a/com.avaloq.tools.ddk.xtext/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.xtext/META-INF/MANIFEST.MF @@ -44,6 +44,8 @@ Export-Package: com.avaloq.tools.ddk.xtext.build, com.avaloq.tools.ddk.xtext.tracing, com.avaloq.tools.ddk.xtext.util, com.avaloq.tools.ddk.xtext.validation -Import-Package: org.apache.logging.log4j,org.apache.log4j +Import-Package: org.apache.logging.log4j, + org.apache.logging.log4j.util, + org.apache.log4j Automatic-Module-Name: com.avaloq.tools.ddk.xtext