You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Hudson (Jira)" <ji...@apache.org> on 2026/09/07 16:17:00 UTC

[jira] [Commented] (HBASE-30358) TestMetaTableForReplica fails on Java 21 rewriting a static final field

    [ https://issues.apache.org/jira/browse/HBASE-30358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112394#comment-18112394 ] 

Hudson commented on HBASE-30358:
--------------------------------

Results for branch master
	[build #1497 on builds.a.o|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1497/]: (x) *{color:red}-1 overall{color}*
----
details (if available):

(/) {color:green}+1 general checks{color}
-- For more information [see general report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1497/General_20Nightly_20Build_20Report/]








(x) {color:red}-1 jdk17 hadoop3 checks{color}
-- For more information [see jdk17 report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1497/JDK17_20Nightly_20Build_20Report_20_28Hadoop3_29/]


> TestMetaTableForReplica fails on Java 21 rewriting a static final field
> -----------------------------------------------------------------------
>
>                 Key: HBASE-30358
>                 URL: https://issues.apache.org/jira/browse/HBASE-30358
>             Project: HBase
>          Issue Type: Bug
>          Components: test
>            Reporter: Junegunn Choi
>            Assignee: Junegunn Choi
>            Priority: Minor
>              Labels: jdk21, pull-request-available
>
> h2. Problem
> {{TestMetaTableForReplica.testMetaTableNameForReplicaWithSuffix}} fails on Java 21:
> {noformat}
> java.lang.UnsupportedOperationException: set
>   at org.apache.hadoop.hbase.TestMetaTableForReplica.setStaticFinalField(TestMetaTableForReplica.java:164)
> {noformat}
> The test rewrites the static final {{TableName.META_TABLE_NAME}} by clearing its {{FINAL}} bit through a VarHandle on the private {{{}Field.modifiers{}}}. On Java 21 that VarHandle is read-only, so the write throws before {{Field.set}} is reached.
> Same family as HBASE-29547 and HBASE-29605, both closed as duplicates of HBASE-29614. Found by the JDK 21 nightly axis added in HBASE-30354.
> h2. No need for the reflection
> {code:java}
> TableName expected = TableName.initializeHbaseMetaTableName(conf);   // compute
> setStaticFinalField(metaTableName, expected);                        // write the static
> TableName current = TableName.META_TABLE_NAME;                       // read it back
> assertNotEquals(TableName.getDefaultNameOfMetaForReplica(), current);
> assertEquals(expected, current);
> {code}
> {{current}} holds the value the line above just wrote, so {{assertEquals(expected, current)}} can only fail if reflection itself is broken.
> h2. Fix
> Assert on the return value directly and delete the reflection.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)