Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-26038 Support JDK17
  3. HBASE-25516

[JDK17] reflective access Field.class.getDeclaredField("modifiers") not supported

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.3
    • 3.0.0-alpha-2, 2.6.0, 2.4.16, 2.5.3
    • Filesystem Integration
    • Reviewed

    Description

      The reflective access

      Field.class.getDeclaredField("modifiers")
      

      in HFileSystem.java:334 leads to a warning (and probably error?):

       

      java.lang.NoSuchFieldException: modifiers
      	at java.base/java.lang.Class.getDeclaredField(Class.java:2417)
      	at org.apache.hadoop.hbase.fs.HFileSystem.addLocationsOrderInterceptor(HFileSystem.java:334)
      	at org.apache.hadoop.hbase.fs.HFileSystem.addLocationsOrderInterceptor(HFileSystem.java:291)
      	at org.apache.hadoop.hbase.fs.HFileSystem.<init>(HFileSystem.java:96)
      	at org.apache.hadoop.hbase.fs.HFileSystem.get(HFileSystem.java:465)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.getTestFileSystem(HBaseTestingUtility.java:3330)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.getNewDataTestDirOnTestFS(HBaseTestingUtility.java:565)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.setupDataTestDirOnTestFS(HBaseTestingUtility.java:554)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.getDataTestDirOnTestFS(HBaseTestingUtility.java:527)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.getDefaultRootDirPath(HBaseTestingUtility.java:1415)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.createRootDir(HBaseTestingUtility.java:1446)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniHBaseCluster(HBaseTestingUtility.java:1157)
      	at org.apache.hadoop.hbase.HBaseTestingUtility.startMiniCluster(HBaseTestingUtility.java:1144)
      	at foo.Main.main(Main.java:11)
      

      when running the following code:

       

      public static void main(String[] args) throws Exception {
          HBaseTestingUtility utility = new HBaseTestingUtility(HBaseConfiguration.create());
          utility.startMiniCluster(StartMiniClusterOption.builder().numRegionServers(3).build());
      }

      From my knowledge this results from the more restrictive reflection protection of java.base classes in the newer java versions.

       

      Related to HBASE-22972

       

      Attachments

        Issue Links

          Activity

            People

              weichiu Wei-Chiu Chuang
              leonbein Leon Bein
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: