You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2025/09/26 17:23:28 UTC

(cordova-android) branch master updated: fix: Deprecation warning in PluginManager for using Class.newInstance (#1823)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git


The following commit(s) were added to refs/heads/master by this push:
     new eb5fe4fb fix: Deprecation warning in PluginManager for using Class.newInstance (#1823)
eb5fe4fb is described below

commit eb5fe4fbda980b88cf2114960f3f14b11efc57e1
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Fri Sep 26 19:23:24 2025 +0200

    fix: Deprecation warning in PluginManager for using Class.newInstance (#1823)
    
    - Calling Class.newInstance is deprecated. Instead Class.getDeclaredConstructor().newInstance() should be called
---
 framework/src/org/apache/cordova/PluginManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index 24560c2f..e6c13c26 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -564,7 +564,7 @@ public class PluginManager {
                 c = Class.forName(className);
             }
             if (c != null & CordovaPlugin.class.isAssignableFrom(c)) {
-                ret = (CordovaPlugin) c.newInstance();
+                ret = (CordovaPlugin) c.getDeclaredConstructor().newInstance();
             }
         } catch (Exception e) {
             e.printStackTrace();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org