Skip to content

fix: Deprecation warning in PluginManager for using Class.newInstance#1823

Merged
erisu merged 1 commit intoapache:masterfrom
GitToTheHub:pr-fix-deprecation-warning-pluginmanager-newinstance-2
Sep 26, 2025
Merged

fix: Deprecation warning in PluginManager for using Class.newInstance#1823
erisu merged 1 commit intoapache:masterfrom
GitToTheHub:pr-fix-deprecation-warning-pluginmanager-newinstance-2

Conversation

@GitToTheHub
Copy link
Contributor

In instantiatePlugin, Class.getInstance was called, but is deprecated since Java 9. Instead Class.getDeclaredConstructor().newInstance() should be called.

Platforms affected

Android

Motivation and Context

Resolving deprecation warnings for cordova-android

Description

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

- Calling Class.newInstance is deprecated. Instead Class.getDeclaredConstructor().newInstance() should be called
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.24%. Comparing base (cab5c5b) to head (53c66e9).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1823      +/-   ##
==========================================
+ Coverage   72.12%   72.24%   +0.11%     
==========================================
  Files          23       23              
  Lines        1844     1841       -3     
==========================================
  Hits         1330     1330              
+ Misses        514      511       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erisu erisu merged commit eb5fe4f into apache:master Sep 26, 2025
11 checks passed
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.

4 participants