Files
KavaRef/en/config/migration.html
github-actions[bot] 29b7fb4ab9 Deploy to GitHub pages
2025-08-02 18:18:10 +00:00

99 lines
52 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="VuePress 2.0.0-rc.0">
<style>
:root {
--c-bg: #fff;
}
html.dark {
--c-bg: #22272e;
}
html, body {
background-color: var(--c-bg);
}
</style>
<script>
const userMode = localStorage.getItem('vuepress-color-scheme');
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
document.documentElement.classList.toggle('dark', true);
}
</script>
<link rel="icon" href="/KavaRef/images/logo.svg"><title>Migration to KavaRef | KavaRef</title><meta name="description" content="A modernizing Java Reflection with Kotlin">
<link rel="preload" href="/KavaRef/assets/style-_yWeWZ9-.css" as="style"><link rel="stylesheet" href="/KavaRef/assets/style-_yWeWZ9-.css">
<link rel="modulepreload" href="/KavaRef/assets/app-mh6GuRj9.js"><link rel="modulepreload" href="/KavaRef/assets/migration.html-MsUQmaeZ.js"><link rel="modulepreload" href="/KavaRef/assets/migration.html-Ye0WsuNZ.js">
<link rel="prefetch" href="/KavaRef/assets/index.html-Ov_ij_gv.js" as="script"><link rel="prefetch" href="/KavaRef/assets/index.html-CFZQ5XVF.js" as="script"><link rel="prefetch" href="/KavaRef/assets/index.html-W7aZ6bnM.js" as="script"><link rel="prefetch" href="/KavaRef/assets/processor-resolvers.html-YYDSqVfs.js" as="script"><link rel="prefetch" href="/KavaRef/assets/r8-proguard.html-oPUAmrol.js" as="script"><link rel="prefetch" href="/KavaRef/assets/about.html-9T1xc62o.js" as="script"><link rel="prefetch" href="/KavaRef/assets/changelog.html-tvXK8X7C.js" as="script"><link rel="prefetch" href="/KavaRef/assets/contacts.html-L9oNW9KK.js" as="script"><link rel="prefetch" href="/KavaRef/assets/future.html-8f4lJIja.js" as="script"><link rel="prefetch" href="/KavaRef/assets/home.html-nmYQl1IQ.js" as="script"><link rel="prefetch" href="/KavaRef/assets/quick-start.html-Qcmp4XDc.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-core.html-Dt130sIh.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-extension.html-T1UdfLZL.js" as="script"><link rel="prefetch" href="/KavaRef/assets/about.html-wsvWpCuP.js" as="script"><link rel="prefetch" href="/KavaRef/assets/changelog.html-rnn3UCr6.js" as="script"><link rel="prefetch" href="/KavaRef/assets/contacts.html-yC5Cjm9f.js" as="script"><link rel="prefetch" href="/KavaRef/assets/future.html-TYRCoFGP.js" as="script"><link rel="prefetch" href="/KavaRef/assets/migration.html-c2_NChU1.js" as="script"><link rel="prefetch" href="/KavaRef/assets/processor-resolvers.html-LDkOJBjK.js" as="script"><link rel="prefetch" href="/KavaRef/assets/r8-proguard.html-OS5OKrdo.js" as="script"><link rel="prefetch" href="/KavaRef/assets/home.html-6hAcbiCY.js" as="script"><link rel="prefetch" href="/KavaRef/assets/quick-start.html-XeqtvFBe.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-core.html-Ffv_VDo5.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-extension.html-fHAqKHa2.js" as="script"><link rel="prefetch" href="/KavaRef/assets/404.html-6Yl8cQE3.js" as="script"><link rel="prefetch" href="/KavaRef/assets/index.html-NhRLIkuI.js" as="script"><link rel="prefetch" href="/KavaRef/assets/index.html-8K8ZL9xM.js" as="script"><link rel="prefetch" href="/KavaRef/assets/index.html-5KLsgsb9.js" as="script"><link rel="prefetch" href="/KavaRef/assets/processor-resolvers.html-27WP0yfV.js" as="script"><link rel="prefetch" href="/KavaRef/assets/r8-proguard.html-dK3W_u38.js" as="script"><link rel="prefetch" href="/KavaRef/assets/about.html-GB22dzJZ.js" as="script"><link rel="prefetch" href="/KavaRef/assets/changelog.html-6g49VohJ.js" as="script"><link rel="prefetch" href="/KavaRef/assets/contacts.html-8ISTVPQY.js" as="script"><link rel="prefetch" href="/KavaRef/assets/future.html-3Px710os.js" as="script"><link rel="prefetch" href="/KavaRef/assets/home.html-Z0EW9e5o.js" as="script"><link rel="prefetch" href="/KavaRef/assets/quick-start.html-q_jDDuWq.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-core.html-tTFO-8Za.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-extension.html-IUNV997z.js" as="script"><link rel="prefetch" href="/KavaRef/assets/about.html-yDUNfYYH.js" as="script"><link rel="prefetch" href="/KavaRef/assets/changelog.html-vN7TJtDC.js" as="script"><link rel="prefetch" href="/KavaRef/assets/contacts.html-YmutBtVn.js" as="script"><link rel="prefetch" href="/KavaRef/assets/future.html-aZj72rRC.js" as="script"><link rel="prefetch" href="/KavaRef/assets/migration.html-GY17HjTz.js" as="script"><link rel="prefetch" href="/KavaRef/assets/processor-resolvers.html-9c-bJv94.js" as="script"><link rel="prefetch" href="/KavaRef/assets/r8-proguard.html-dGWuVyvG.js" as="script"><link rel="prefetch" href="/KavaRef/assets/home.html-ZBkLyAmP.js" as="script"><link rel="prefetch" href="/KavaRef/assets/quick-start.html-URixYC24.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-core.html-4qPYzqqN.js" as="script"><link rel="prefetch" href="/KavaRef/assets/kavaref-extension.html-Is97lgJ-.js" as="script"><link rel="prefetch" href="/KavaRef/assets/404.html-QklWHkM6.js" as="script">
</head>
<body>
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/KavaRef/en/" class=""><img class="logo" src="/KavaRef/images/logo.svg" alt="KavaRef"><span class="site-name can-hide">KavaRef</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Get Started</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/guide/home.html" class="" aria-label="Introduction"><!--[--><!--]--> Introduction <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/guide/quick-start.html" class="" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Libraries</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/library/kavaref-core.html" class="" aria-label="kavaref-core"><!--[--><!--]--> kavaref-core <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/library/kavaref-extension.html" class="" aria-label="kavaref-extension"><!--[--><!--]--> kavaref-extension <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Configs</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/config/r8-proguard.html" class="" aria-label="R8 &amp; ProGuard Obfuscation"><!--[--><!--]--> R8 &amp; ProGuard Obfuscation <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/config/processor-resolvers.html" class="" aria-label="Third-party Member Resolvers"><!--[--><!--]--> Third-party Member Resolvers <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a aria-current="page" href="/KavaRef/en/config/migration.html" class="router-link-active router-link-exact-active router-link-active" aria-label="Migration to KavaRef"><!--[--><!--]--> Migration to KavaRef <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>About</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/changelog.html" class="" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/future.html" class="" aria-label="Looking Toward the Future"><!--[--><!--]--> Looking Toward the Future <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/contacts.html" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/about.html" class="" aria-label="About This Document"><!--[--><!--]--> About This Document <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/KavaRef/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/KavaRef/en/config/migration.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/KavaRef/zh-cn/config/migration.html" class="" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/HighCapable/KavaRef" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-color-mode-button" title="toggle color mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" placeholder="Search" autocomplete="off" spellcheck="false" value><!----></form></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-items"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Get Started</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/guide/home.html" class="" aria-label="Introduction"><!--[--><!--]--> Introduction <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/guide/quick-start.html" class="" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Libraries</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/library/kavaref-core.html" class="" aria-label="kavaref-core"><!--[--><!--]--> kavaref-core <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/library/kavaref-extension.html" class="" aria-label="kavaref-extension"><!--[--><!--]--> kavaref-extension <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Configs</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/config/r8-proguard.html" class="" aria-label="R8 &amp; ProGuard Obfuscation"><!--[--><!--]--> R8 &amp; ProGuard Obfuscation <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/config/processor-resolvers.html" class="" aria-label="Third-party Member Resolvers"><!--[--><!--]--> Third-party Member Resolvers <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a aria-current="page" href="/KavaRef/en/config/migration.html" class="router-link-active router-link-exact-active router-link-active" aria-label="Migration to KavaRef"><!--[--><!--]--> Migration to KavaRef <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>About</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/changelog.html" class="" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/future.html" class="" aria-label="Looking Toward the Future"><!--[--><!--]--> Looking Toward the Future <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/contacts.html" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/KavaRef/en/about/about.html" class="" aria-label="About This Document"><!--[--><!--]--> About This Document <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/KavaRef/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/KavaRef/en/config/migration.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/KavaRef/zh-cn/config/migration.html" class="" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/HighCapable/KavaRef" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-items"><!--[--><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Get Started <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/KavaRef/en/guide/home.html" class="sidebar-item" aria-label="Introduction"><!--[--><!--]--> Introduction <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/guide/quick-start.html" class="sidebar-item" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Libraries <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/KavaRef/en/library/kavaref-core.html" class="sidebar-item" aria-label="kavaref-core"><!--[--><!--]--> kavaref-core <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/library/kavaref-extension.html" class="sidebar-item" aria-label="kavaref-extension"><!--[--><!--]--> kavaref-extension <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading active collapsible">Configs <span class="down arrow"></span></p><ul style="" class="sidebar-item-children"><!--[--><li><a href="/KavaRef/en/config/r8-proguard.html" class="sidebar-item" aria-label="R8 &amp; ProGuard Obfuscation"><!--[--><!--]--> R8 &amp; ProGuard Obfuscation <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/config/processor-resolvers.html" class="sidebar-item" aria-label="Third-party Member Resolvers"><!--[--><!--]--> Third-party Member Resolvers <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/KavaRef/en/config/migration.html" class="router-link-active router-link-exact-active router-link-active sidebar-item active" aria-label="Migration to KavaRef"><!--[--><!--]--> Migration to KavaRef <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/KavaRef/en/config/migration.html#basic-functions" class="router-link-active router-link-exact-active sidebar-item" aria-label="Basic Functions"><!--[--><!--]--> Basic Functions <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/KavaRef/en/config/migration.html#other-functions" class="router-link-active router-link-exact-active sidebar-item" aria-label="Other Functions"><!--[--><!--]--> Other Functions <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/KavaRef/en/config/migration.html#exception-handling" class="router-link-active router-link-exact-active sidebar-item" aria-label="Exception Handling"><!--[--><!--]--> Exception Handling <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/KavaRef/en/config/migration.html#new-to-kavaref" class="router-link-active router-link-exact-active sidebar-item" aria-label="New to KavaRef"><!--[--><!--]--> New to KavaRef <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">About <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/KavaRef/en/about/changelog.html" class="sidebar-item" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/about/future.html" class="sidebar-item" aria-label="Looking Toward the Future"><!--[--><!--]--> Looking Toward the Future <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/about/contacts.html" class="sidebar-item" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a><!----></li><li><a href="/KavaRef/en/about/about.html" class="sidebar-item" aria-label="About This Document"><!--[--><!--]--> About This Document <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><!--]--><div><h1 id="migration-to-kavaref" tabindex="-1"><a class="header-anchor" href="#migration-to-kavaref" aria-hidden="true">#</a> Migration to KavaRef</h1><p>If you are used to using the reflection API in <a href="https://github.com/HighCapable/YukiReflection" target="_blank" rel="noopener noreferrer">YukiReflection<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a> or <a href="https://github.com/HighCapable/YukiHookAPI" target="_blank" rel="noopener noreferrer">YukiHookAPI<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>, you can refer to the following to migrate to <code>KavaRef</code>.</p><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>For <code>YukiHookAPI</code>, you need to continue using its Hook API, and <code>KavaRef</code> only includes Java reflection-related APIs.</p></div><h2 id="basic-functions" tabindex="-1"><a class="header-anchor" href="#basic-functions" aria-hidden="true">#</a> Basic Functions</h2><p>The design concept of <code>KavaRef</code> is similar to <code>YukiReflection</code>, but not exactly the same. The following lists the differences between <code>YukiReflection</code> and <code>KavaRef</code> in basic reflection functions, which you can manually migrate based on.</p><p>For example, we have the following Java class.</p><blockquote><p>The following example</p></blockquote><div class="language-java" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">MyClass</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">myMethod</span><span style="color:#ADBAC7;">(String </span><span style="color:#F69D50;">content</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;"> System.out.</span><span style="color:#DCBDFB;">println</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello &quot;</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">+</span><span style="color:#ADBAC7;"> content </span><span style="color:#F47067;">+</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;!&quot;</span><span style="color:#ADBAC7;">);</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre></div><p>Here is a comparison of <code>KavaRef</code> with <code>YukiReflection</code> using examples.</p><blockquote><p>The following example</p></blockquote><div style="display:flex;gap:16px;"><div style="flex:1;"><h4>KavaRef</h4><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Assume that&#39;s your MyClass instance.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClass: </span><span style="color:#F69D50;">MyClass</span></span>
<span class="line"><span style="color:#768390;">// Call and execute using KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">().</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;myMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">}.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(myClass).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, KavaRef!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Direct reference to instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">myClass.</span><span style="color:#DCBDFB;">asResolver</span><span style="color:#ADBAC7;">().</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;myMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">}.</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, KavaRef!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div><div style="flex:1;"><h4>YukiReflection</h4><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Assume that&#39;s your MyClass instance.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClass: </span><span style="color:#F69D50;">MyClass</span></span>
<span class="line"><span style="color:#768390;">// Call and execute using YukiReflection.</span></span>
<span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.java.</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;myMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">param</span><span style="color:#ADBAC7;">(StringClass)</span></span>
<span class="line"><span style="color:#ADBAC7;">}.</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">(myClass).</span><span style="color:#DCBDFB;">call</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, YukiReflection!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Direct reference to instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">myClass.</span><span style="color:#DCBDFB;">current</span><span style="color:#ADBAC7;">().</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;myMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">param</span><span style="color:#ADBAC7;">(StringClass)</span></span>
<span class="line"><span style="color:#ADBAC7;">}.</span><span style="color:#DCBDFB;">call</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, YukiReflection!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div></div><p><code>KavaRef</code> starts reflection at any time; you need to use <code>resolve()</code> to create a reflection scope. You no longer directly extend the related <code>method</code> and <code>constructor</code> methods to avoid polluting their scope.</p><p><code>KavaRef</code> provides the <code>asResolver()</code> method to directly reference the reflection scope of the instance object, avoiding pollution caused by the creation of uncontrollable instance objects by the <code>current()</code> method in <code>YukiReflection</code>.</p><p><code>KavaRef</code> abandons the &quot;Finder&quot; design concept and uses the &quot;Filter&quot; design concept to obtain reflection results. &quot;Find&quot; is no longer finding, but &quot;filtering&quot;.</p><p><code>KavaRef</code> canceled the design scheme defined in <code>YukiReflection</code> for determining whether the <code>Member</code> obtained in the resulting instance is multiple or single, and directly returns the entire <code>List&lt;MemberResolver&gt;</code>. The example you see above uses <code>firstMethod</code> to get the first matching <code>MethodResolver</code>. If you need to get all matches, you can change to <code>method</code>.</p><p>The conditional method name in <code>MethodCondition</code> of <code>KavaRef</code> has been modified from abbreviations such as <code>param</code> used previously in <code>YukiReflection</code> to <code>parameters</code> to better align with the naming conventions of the Java reflection API.</p><p><code>KavaRef</code> no longer provides the <code>param(...).order()</code> function in conditions, because this function itself is unstable. <code>KavaRef</code> now uses an iterator for filtering, and the bytecode will no longer be in order, nor should bytecode be filtered by order. You can use <code>firstMethod</code>, <code>firstField</code>, or <code>lastMethod</code>, <code>lastField</code>, etc. to get the first or last matching result.</p><p><code>KavaRef</code> renames the <code>get(instance)</code> method to <code>of(instance)</code> because <code>get(...)</code> may be confused with the <code>get(...)</code> usage of <code>Field</code> and lacks semantic clarity. At the same time, <code>get(instance)</code> no longer gets the <code>MethodFinder.Result.Instance</code> instance from something like <code>MethodFinder.Result</code>, but uses <code>of(instance)</code> to consistently operate and set the instance object to <code>MemberResolver</code>.</p><p>Methods such as <code>string()</code>, <code>int()</code>, etc. in <code>MethodFinder.Result.Instance</code> have been removed in <code>KavaRef</code>. You can directly use <code>get&lt;String&gt;()</code>, <code>get&lt;Int&gt;()</code>, <code>invoke&lt;String&gt;(...)</code>, <code>invoke&lt;Int&gt;(...)</code>, etc. to get or call the corresponding type results.</p><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>If you are looking for (filtering) <code>Field</code>, you need to note that there may be semantic conflicts between <code>KavaRef</code> and <code>YukiReflection</code> in the acquisition method of <code>Field</code>. Please pay special attention when migrating this part.</p><p>For example, get the static field of <code>content</code> in <code>MyClass</code>, in <code>YukiReflection</code>, you would do this.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.java</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">field</span><span style="color:#ADBAC7;"> { name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;content&quot;</span><span style="color:#ADBAC7;"> } </span><span style="color:#768390;">// Return FieldFinder.Result</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// Cannot be omitted, return FieldFinder.Result.Instance</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">string</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// value</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>In <code>KavaRef</code> you need to do this.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstField</span><span style="color:#ADBAC7;"> { name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;content&quot;</span><span style="color:#ADBAC7;"> } </span><span style="color:#768390;">// Return FieldResolver&lt;MyClass&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">String</span><span style="color:#ADBAC7;">&gt;() </span><span style="color:#768390;">// value</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>As mentioned above, <code>get(...)</code> is used to get the <code>FieldFinder.Result.Instance</code> object in Y<code>ukiReflection</code>, not the value. To get the value and process it as a specified type, you need to call <code>string()</code> or <code>cast&lt;String&gt;()</code>, and in <code>KavaRef</code>, you use <code>get&lt;T&gt;()</code> directly in <code>MemberResolver</code> to get the value of the specified type. The usage of <code>get(...)</code> of <code>KavaRef</code> for <code>get(...)</code> to <code>of(...)</code>.</p><p>So the complete writing of the above example in <code>KavaRef</code> should be.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Since the call is a static instance, &quot;of(null)&quot; can be omitted.</span></span>
<span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstField</span><span style="color:#ADBAC7;"> { name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;content&quot;</span><span style="color:#ADBAC7;"> } </span><span style="color:#768390;">// It&#39;s already a call chain object FieldResolver&lt;MyClass&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(</span><span style="color:#6CB6FF;">null</span><span style="color:#ADBAC7;">) </span><span style="color:#768390;">// Can be omitted and return to the call chain object FieldResolver&lt;MyClass&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">String</span><span style="color:#ADBAC7;">&gt;() </span><span style="color:#768390;">// value</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div><p><code>KavaRef</code> no longer provides <code>call</code> methods for <code>Method</code>, and is now merged uniformly into <code>invoke</code> (with generic parameters). At the same time, <code>KavaRef</code> defines the <code>newInstance</code> method of <code>Constructor</code> as <code>create</code> (with generic parameters).</p><p>You may have noticed that the condition <code>superClass()</code> is gone, it is still there, in <code>KavaRef</code> it has been renamed to <code>superclass()</code>, docking with the standard Java reflection API.</p><p>At the same time, <code>KavaRef</code> extends <code>KClass</code>, and you no longer need to use <code>Some::class.java</code> to declare an instance of <code>Class</code> in most scenarios.</p><p>Another design idea of <code>KavaRef</code> is type safety. As long as you use <code>KClass&lt;T&gt;</code> and <code>Class&lt;T&gt;</code> that declare the generic type, it will be checked and converted to the corresponding type when <code>of(instance)</code> and <code>create(...)</code>, and type checking will be completed during coding to avoid runtime errors.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Assume that&#39;s your MyClass instance.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClass: </span><span style="color:#F69D50;">MyClass</span></span>
<span class="line"><span style="color:#768390;">// Using KavaRef to call and execute.</span></span>
<span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;myMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Only instances of type MyClass can be passed in.</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(myClass)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, KavaRef!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="other-functions" tabindex="-1"><a class="header-anchor" href="#other-functions" aria-hidden="true">#</a> Other Functions</h2><p><code>KavaRef</code> and <code>YukiReflection</code> are not much different in other functions and extended functions. <code>KavaRef</code> separates these functions into a separate module.</p><p>The following functionality is provided in <code>YukiReflection</code> but is not implemented and no longer provided in <code>KavaRef</code>:</p><ul><li><p>Preset reflection type constant classes, such as <code>StringClass</code>, <code>IntType</code>, etc</p><ul><li>You can use Kotlin class references such as <code>String::class</code>, <code>Int::class</code>, etc. to instead it. For primitive types and wrapper classes, <code>IntType</code> is equivalent to <code>Int::class</code>, and <code>IntClass</code> is equivalent to <code>JInteger::class</code></li></ul></li><li><p><code>DexClassFinder</code> function</p><ul><li>Due to its design flaws and possible performance issues when used on Android platforms, it is no longer available for now</li></ul></li><li><p><code>RemedyPlan</code> and <code>method { ... } .remedys { ... }</code> functions</p><ul><li>Due to possible black box problems, maintenance is relatively difficult. If you need to use similar functions, please implement them manually and will no longer be provided</li></ul></li><li><p><code>ClassLoader.listOfClasses()</code> function</p><ul><li>Due to the complex and unstable implementation solutions of each platform, it will no longer be provided</li></ul></li><li><p><code>ClassLoader.searchClass()</code> function</p><ul><li>Due to performance issues and design time is limited to Android platform, it is relatively difficult to maintain filter conditions and is no longer provided</li></ul></li><li><p><code>Class.hasExtends</code>, <code>Class.extends</code>, <code>Class.implements</code> functions</p><ul><li>You can replace them with <code>A::class isSubclassOf B::class</code></li></ul></li><li><p><code>Class.toJavaPrimitiveType()</code> function</p><ul><li>There is conceptual confusion in functional design and will no longer be provided</li></ul></li><li><p><code>&quot;com.some.clazz&quot;.hasClass(loader)</code> function</p><ul><li>You can use <code>loader.hasClass(&quot;com.some.clazz&quot;)</code> to instead it</li></ul></li><li><p><code>Class.hasField</code>, <code>Class.hasMethod</code>, <code>Class.hasConstructor</code> functions</p><ul><li>Due to design defects, no longer provided</li></ul></li><li><p><code>Class.hasModifiers(...)</code>, <code>Member.hasModifiers(...)</code> functions</p><ul><li>You can replace them directly with extension methods such as <code>Class.isPublic</code>, <code>Member.isPublic</code></li></ul></li><li><p><code>Class.generic()</code>, <code>GenericClass</code> functions</p><ul><li>If you just want to get generic parameters of the superclass, you can use <code>Class.genericSuperclassTypeArguments()</code>. Due to design defects, no longer provided</li></ul></li><li><p><code>Any.current()</code>, <code>CurrentClass</code> functions</p><ul><li>You can use <code>Any.asResolver()</code> to instead it</li></ul></li><li><p><code>Class.buildOf(...)</code> function</p><ul><li>You can use <code>Class.createInstance(...)</code> to instead it</li></ul></li><li><p><code>Class.allMethods()</code>, <code>Class.allFields()</code>, <code>Class.allConstructors()</code> functions</p><ul><li>Due to its pollution scope, no longer provided</li></ul></li><li><p><code>YLog</code> log function</p><ul><li><code>KavaRef</code> no longer takes over the logs, you can use the corresponding platform implementation method and no longer provided</li></ul></li></ul><h2 id="exception-handling" tabindex="-1"><a class="header-anchor" href="#exception-handling" aria-hidden="true">#</a> Exception Handling</h2><p><code>KavaRef</code> is completely different from <code>YukiReflection</code> in exception handling. The exception logic of <code>KavaRef</code> will remain transparent by default. <u><strong>It no longer actively intercepts exceptions and prints error logs or even provides <code>onNoSuchMethod</code> listener</strong></u>. When no valid members are filtered, <code>KavaRef</code> will throw an exception directly unless you <strong>explicitly declare the condition as optional (consistent with <code>YukiReflection</code> logic)</strong>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Assume that&#39;s your MyClass instance.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClass: </span><span style="color:#F69D50;">MyClass</span></span>
<span class="line"><span style="color:#768390;">// Using KavaRef to call and execute.</span></span>
<span class="line"><span style="color:#ADBAC7;">MyClass::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">optional</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// Declare as optional, do not throw exceptions.</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Use firstMethodOrNull instead of firstMethod,</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// because the NoSuchElementException of Kotlin itself will be thrown.</span></span>
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstMethodOrNull</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doNonExistentMethod&quot;</span><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Assume that this method does not exist.</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }?.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(myClass)?.</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Hello, KavaRef!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>For more information, please refer to the <a href="/KavaRef/en/library/kavaref-core.html#exception-handling" class="">Exception Handling</a> section in <a href="/KavaRef/en/library/kavaref-core.html" class="">kavaref-core</a>.</p><h2 id="new-to-kavaref" tabindex="-1"><a class="header-anchor" href="#new-to-kavaref" aria-hidden="true">#</a> New to KavaRef</h2><p>If you haven&#39;t used <code>YukiReflection</code> or <code>YukiHookAPI</code>, it doesn&#39;t matter, you can refer to the following content to get started quickly.</p><div class="custom-container tip"><p class="custom-container-title">What to Do Next</p><p>For more information, please continue reading <a href="/KavaRef/en/library/kavaref-core.html" class="">kavaref-core</a> and <a href="/KavaRef/en/library/kavaref-extension.html" class="">kavaref-extension</a>.</p><p>Get started using <code>KavaRef</code> now!</p></div></div><!--[--><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="external-link meta-item-label" href="https://github.com/HighCapable/KavaRef/edit/main/docs-source/src/en/config/migration.md" rel="noopener noreferrer" target="_blank" aria-label="Edit this page on GitHub"><!--[--><!--]--> Edit this page on GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: qzmmcn@163.com">fankesyooni</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"><a href="/KavaRef/en/config/processor-resolvers.html" class="" aria-label="Third-party Member Resolvers"><!--[--><!--]--> Third-party Member Resolvers <!--[--><!--]--></a></span><!----></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
<script type="module" src="/KavaRef/assets/app-mh6GuRj9.js" defer></script>
</body>
</html>