Skip to content

Replace Plugin.getLog() with static ILog.of(Class)#2627

Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:replace-getlog-with-ilog-of
Open

Replace Plugin.getLog() with static ILog.of(Class)#2627
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:replace-getlog-with-ilog-of

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 21, 2026

Summary

  • Switch six single-call-site static log(IStatus) helpers to ILog.of(SomeClass.class) instead of routing through the plugin singleton.
  • Removes the last logging-only reason these bundles rely on getDefault() / getPlugin(), and logging now works even before the activator has stored the singleton.
  • No MANIFEST changes required — all affected bundles already require org.eclipse.core.runtime >= 3.29, which is when ILog.of(Class) was introduced.

Affected bundles:

  • org.eclipse.compare.win32
  • org.eclipse.unittest.ui
  • org.eclipse.ui.console
  • org.eclipse.core.variables
  • org.eclipse.ant.core
  • org.eclipse.ant.ui

Part of an effort to identify activators / getDefault() usages that can be simplified or replaced. These six are the lowest-risk starting point — each bundle has exactly one getDefault().getLog() call site.

Test plan

  • CI build succeeds
  • No API baseline warnings for the six bundles
  • Logging still functions (spot-check: trigger a logged error in one of the affected plug-ins)

Switch the six single-call-site static log(IStatus) helpers to use
ILog.of(SomeClass.class) instead of routing through the plugin singleton.
This removes the last logging-only reason these bundles rely on
getDefault()/getPlugin() and works even before the activator has stored
the singleton.

Affected bundles:
- org.eclipse.compare.win32
- org.eclipse.unittest.ui
- org.eclipse.ui.console
- org.eclipse.core.variables
- org.eclipse.ant.core
- org.eclipse.ant.ui

All of these already require org.eclipse.core.runtime >= 3.29, which is
when ILog.of(Class) was introduced, so no MANIFEST changes are needed.
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 21, 2026

Build failure also looks unrelated to this change:

Error: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:5.0.3-SNAPSHOT:test (default-test) on project org.eclipse.core.tests.resources.saveparticipant1: No tests found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:5.0.3-SNAPSHOT:test (default-test) on project org.eclipse.core.tests.resources.saveparticipant1: No tests found
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)

Again I would guess that eclipse-platform/eclipse.platform.releng.aggregator#3784 might be related.

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

   34 files   -    17     34 suites   - 17   22m 1s ⏱️ - 15m 5s
4 555 tests ±    0  4 508 ✅  -    21   47 💤 +25  0 ❌  - 4 
8 174 runs   - 4 087  8 067 ✅  - 4 034  107 💤  - 49  0 ❌  - 4 

Results for commit d9f0d77. ± Comparison against base commit 9e8a07f.

This pull request skips 25 tests.
org.eclipse.core.tests.filesystem.SymlinkTest ‑ testSymlinkPutHidden
org.eclipse.core.tests.internal.alias.BasicAliasTest ‑ testBug198571
org.eclipse.core.tests.internal.localstore.MoveTest ‑ testMoveFileAcrossVolumes
org.eclipse.core.tests.internal.localstore.MoveTest ‑ testMoveFolderAcrossVolumes
org.eclipse.core.tests.resources.IProjectTest ‑ testProjectCreationLocationExistsWithDifferentCase
org.eclipse.core.tests.resources.IWorkspaceRootTest ‑ testFindFilesNonCanonicalPath
org.eclipse.core.tests.resources.LinkedResourceTest ‑ testFindFilesForLocationCaseVariant
org.eclipse.core.tests.resources.LinkedResourceWithPathVariableTest ‑ testFindFilesForLocationCaseVariant
org.eclipse.core.tests.resources.ResourceAttributeTest ‑ testAttributeArchive
org.eclipse.core.tests.resources.ResourceAttributeTest ‑ testAttributeHidden
…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant