[
https://issues.apache.org/jira/browse/HIVE-28643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17946485#comment-17946485
]
Kokila N commented on HIVE-28643:
---------------------------------
In JDK8
{code:java}
Field.class.getDeclaredField("slot");{code}
** returns the slot attribute which is present Field.java .
In JDK 17, we get
{code:java}
Exception in thread "main" java.lang.NoSuchFieldException: slot{code}
even though the attribute slot is present in Field.java .
The reason is that the Reflection.java class has *fieldFilterMap* which
consists *Field.class, ALL_MEMBERS* meaning they are filtered. For this reason,
none of the attributes of {{Field}} are accessible via reflection!
{code:java}
static {
fieldFilterMap = Map.of(
Reflection.class, ALL_MEMBERS,
AccessibleObject.class, ALL_MEMBERS,
Class.class, Set.of("classLoader", "classData"),
ClassLoader.class, ALL_MEMBERS,
Constructor.class, ALL_MEMBERS,
Field.class, ALL_MEMBERS,
Method.class, ALL_MEMBERS,
Module.class, ALL_MEMBERS,
System.class, Set.of("security")
);
methodFilterMap = Map.of();
}{code}
ref:
[https://github.com/openjdk/jdk/blob/0438cea65b927bcf3d039b290de7fd7c60a06922/src/java.base/share/classes/jdk/internal/reflect/Reflection.java#L51]
> Test failures with "Error getting slot value"
> ---------------------------------------------
>
> Key: HIVE-28643
> URL: https://issues.apache.org/jira/browse/HIVE-28643
> Project: Hive
> Issue Type: Sub-task
> Reporter: Kokila N
> Assignee: Kokila N
> Priority: Major
>
> The solution utilizes the *slot* variable in the *Field* object to maintain
> the order, which helps prevent flaky tests in serde module. However, with JDK
> 17, all tests that rely on this slot are failing with the error:
> "java.lang.RuntimeException: Error getting a slot value".
> Debugging reveals a NoSuchFieldException, despite the fact that JDK 17
> includes the slot variable. This issue is likely related to reflection, even
> though the --add-opens flag is used to allow access to private fields.
> Currently reverting the commit to move forward , need to address this issue
> later.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)