Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114074

DiscouragedApi of QtLoader.java

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.7.0
    • 6.5.1
    • QPA: Android
    • None
    • Android
    • 2023wk44FOQtforAndroid

    Description

      We get some linter issues of QtLoader.java

      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:161: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                  int id = resources.getIdentifier("bundled_libs", "array", packageName);
                                     ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:197: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                  int id = resources.getIdentifier("fatal_error_msg", "string",
                                     ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:216: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                  int id = resources.getIdentifier("qt_libs", "array", packageName);
                                     ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:219: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                  id = resources.getIdentifier("use_local_qt_libs", "string", packageName);
                                 ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:227: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                      id = resources.getIdentifier("bundle_local_qt_libs", "string", packageName);
                                     ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:238: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                              id = resources.getIdentifier("system_libs_prefix","string",
                                             ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:286: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                      id = resources.getIdentifier("load_local_libs", "array", packageName);
                                     ~~~~~~~~~~~~~
      /.../src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java:304: Warning: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                      id = resources.getIdentifier("static_init_classes", "string", packageName);
                                     ~~~~~~~~~~~~~
      
         Explanation for issues of type "DiscouragedApi":
         Discouraged APIs are allowed and are not deprecated, but they may be unfit
         for common use (e.g. due to slow performance or subtle behavior).
      

      It should be refactored to use R.qt.bundled_libs or something like this.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              assam Assam Boudjelthia
              misery André Klitzing
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes