pub struct DexCtx<'a> {
pub pool: &'a DexPool,
pub class: &'a PoolClass,
/* private fields */
}Expand description
Front-end context handed to the core’s structurer and printer.
Fields§
§pool: &'a DexPool§class: &'a PoolClassImplementations§
Trait Implementations§
Source§impl<'a> Ctx for DexCtx<'a>
impl<'a> Ctx for DexCtx<'a>
Source§fn pool_id(&self) -> u64
fn pool_id(&self) -> u64
Identity of the backing container (pool), for caches keyed on
pool-dependent pure queries (
Printer::shorten memoization).
Default 0 is safe only for single-pool processes; multi-pool
front-ends (ddc/jcdc) override with the pool pointer so a second
pool never reads the first pool’s cached shortenings.fn obscured_simple(&self, internal: &str) -> Option<String>
Source§fn obscured_member_escape(&self, owner: &str, member: &str) -> bool
fn obscured_member_escape(&self, owner: &str, member: &str) -> bool
The front-end’s render-time import map: when a referenced
internal name is OBSCURED in the current compilation unit (its
qualified form’s first segment binds to an in-scope class name
— JLS 6.4.2), the front-end emits a single-type import for it
and the render must use the SIMPLE name. Returns the simple
name when so;
None renders normally. Default None (no import
machinery).
静态成员引用的遮蔽逃逸:owner 点分渲染的首段被作用域内的
名字(字段/继承成员)遮蔽、且类型导入的简单名同样会被捕获时,
成员引用改走单静态导入(渲染为裸成员名,前端记录
import static owner.member;)。JLS 6.4.2:表达式名解析优先
绑定变量——d.j.v 的 d 绑定到继承字段 d 后成员链断裂
(找不到符号 变量 j)。默认 false(无该机制的前端)。Source§fn class_name(&self) -> &str
fn class_name(&self) -> &str
Internal name of the class currently being emitted
(e.g.
java/util/ArrayList).Source§fn source_level(&self) -> u16
fn source_level(&self) -> u16
Source level gate for version-dependent rendering: the JVM front-end
returns the class-file major version; a DEX front-end returns the
equivalent language level it decided to target.
52 means “Java 8
features available” (lambdas, diamond, …).Source§fn find_outer(&self, internal: &str) -> Option<String>
fn find_outer(&self, internal: &str) -> Option<String>
The class that
internal is nested in, when the container records the
nesting (JVM InnerClasses/NestHost; DEX inner-class annotations).
None for a top-level class — including literal-$ names that only
look nested.Source§fn family(&self, root: &str) -> Family
fn family(&self, root: &str) -> Family
Nested-class family of
root, as far as the container records it.Source§fn nested_is_static(&self, internal: &str) -> bool
fn nested_is_static(&self, internal: &str) -> bool
True when a nested class is static (
Outer$Inner with ACC_STATIC), so
it is not constructed with an enclosing instance.Source§fn class_has_this0(&self, internal: &str) -> bool
fn class_has_this0(&self, internal: &str) -> bool
True when the class carries a synthetic
this$0 field (an inner class
with an enclosing instance parameter).Source§fn is_subtype_of(&self, sub: &JavaType, sup: &str) -> bool
fn is_subtype_of(&self, sub: &JavaType, sup: &str) -> bool
True when
sub is assignable to sup (both internal names).Source§fn is_interface(&self, internal: &str) -> bool
fn is_interface(&self, internal: &str) -> bool
True when
internal is an interface.Source§fn is_sealed(&self, _internal: &str) -> bool
fn is_sealed(&self, _internal: &str) -> bool
True when
internal is sealed (its permitted subclasses are recorded).Source§fn super_name(&self, internal: &str) -> Option<String>
fn super_name(&self, internal: &str) -> Option<String>
Superclass of
internal (internal name); None at Object/unknown.Source§fn has_class(&self, internal: &str) -> bool
fn has_class(&self, internal: &str) -> bool
True when the container holds this class at all (naming probes use
it to test
Outer$1Local-style candidates).Source§fn class_supers_args(
&self,
internal: &str,
_args: &[GenericType],
) -> Vec<(String, Vec<GenericType>)>
fn class_supers_args( &self, internal: &str, _args: &[GenericType], ) -> Vec<(String, Vec<GenericType>)>
Superclasses/interfaces of
internal with the given type arguments
applied: [(java/lang/Object, []), ...], most-derived first.Source§fn class_bases(&self, internal: &str) -> Option<(Vec<String>, Option<String>)>
fn class_bases(&self, internal: &str) -> Option<(Vec<String>, Option<String>)>
Interfaces and superclass of
internal (internal names, declaration
order). None when the class is unknown to the front-end.Source§fn field_flags(&self, internal: &str, name: &str) -> Option<FieldAccessFlags>
fn field_flags(&self, internal: &str, name: &str) -> Option<FieldAccessFlags>
Access flags of the field
internal.name; None when absent.Source§fn method_flags(
&self,
internal: &str,
name: &str,
desc: &str,
) -> Option<MethodAccessFlags>
fn method_flags( &self, internal: &str, name: &str, desc: &str, ) -> Option<MethodAccessFlags>
Access flags of the method
internal.name(desc); None when absent.Source§fn declares_field(&self, internal: &str, name: &str) -> bool
fn declares_field(&self, internal: &str, name: &str) -> bool
True when
internal declares any field named name.Source§fn is_fw_shadow(&self, internal: &str) -> bool
fn is_fw_shadow(&self, internal: &str) -> bool
True when
internal is a framework-shadow stub class (the
front-end relocates its FILE identity; references render the raw
framework FQN — the platform class is what the bytecode means).Source§fn declares_field_display(&self, internal: &str, display: &str) -> bool
fn declares_field_display(&self, internal: &str, display: &str) -> bool
True when
internal declares any field whose RENDERED display
equals display (the registry’s rename applied; the raw name
when no entry exists). Field references carry the DISPLAY name
at emit time, so shadow checks must compare in display space —
a raw-named field can render exactly the name another class’s
field displays.Source§fn declares_method_named(&self, internal: &str, name: &str) -> bool
fn declares_method_named(&self, internal: &str, name: &str) -> bool
True when
internal declares a method named name (any descriptor).Source§fn is_generic_call(&self, _e: &Expr) -> bool
fn is_generic_call(&self, _e: &Expr) -> bool
True when the call carries inferred type arguments that the source
must spell out.
Source§fn generic_call_formals(
&self,
_e: &Expr,
) -> Option<(Vec<GenericType>, Vec<String>)>
fn generic_call_formals( &self, _e: &Expr, ) -> Option<(Vec<GenericType>, Vec<String>)>
Instantiated formal parameter types of a generic call plus the callee’s
own method type variables (for witness casts).
None when the call has
no inferred type arguments to spell out.Source§fn polymorphic_ret_cast(
&self,
_cls: &str,
_name: &str,
_desc: &MethodDescriptor,
) -> Option<JavaType>
fn polymorphic_ret_cast( &self, _cls: &str, _name: &str, _desc: &MethodDescriptor, ) -> Option<JavaType>
The instantiated return type of a call whose methodref owner redeclares
the method with a self-covariant return (Stream over BaseStream).
Source§fn ctor_formals_by_arity(
&self,
internal: &str,
arity: usize,
) -> Option<Vec<GenericType>>
fn ctor_formals_by_arity( &self, internal: &str, arity: usize, ) -> Option<Vec<GenericType>>
Constructor parameter types of
internal matching arity, for
rendering new arguments against the right overload.Source§fn ctor_param_types(
&self,
internal: &str,
skip: usize,
n: usize,
args: &[Expr],
) -> Option<Vec<JavaType>>
fn ctor_param_types( &self, internal: &str, skip: usize, n: usize, args: &[Expr], ) -> Option<Vec<JavaType>>
Parameter types of the
<init> of internal matching skip + n
descriptor args, with skip leading synthetic parameters removed.
Used to print new arguments with boolean/char constant adjustment.Source§fn outer_param_via_super(&self, _internal: &str) -> bool
fn outer_param_via_super(&self, _internal: &str) -> bool
True when
internal is an inner class whose constructor forwards its
enclosing instance straight to super (javac 21+ drops this$0 in
that case, but call sites still need the qualified-new form).Source§fn nested_method(
&self,
_l: &LambdaExpr,
_outer_vt: &VarTable,
) -> Option<MethodBody>
fn nested_method( &self, _l: &LambdaExpr, _outer_vt: &VarTable, ) -> Option<MethodBody>
Decompile the nested method a lambda site refers to — a lambda body,
an anonymous-class method, or a local-class method — and run the
front-end’s own idiom recovery on it. Read more
Source§fn local_class_internal(&self, simple: &str) -> Option<String>
fn local_class_internal(&self, simple: &str) -> Option<String>
Local-class name recorded for a
$-style synthetic marker, when the
container records one (Outer$1Local -> Local).Source§fn class_type_params(&self, internal: &str) -> Vec<TypeParam>
fn class_type_params(&self, internal: &str) -> Vec<TypeParam>
Generic type parameters declared by
internal (from its class
signature); empty when the container records none.Source§fn generic_call_mt_typevars(&self, e: &Expr) -> Vec<String>
fn generic_call_mt_typevars(&self, e: &Expr) -> Vec<String>
Type variables of the method the call refers to (used to decide
whether a formal still carries the callee’s own typevars).
Source§fn sam_ret_cast(&self, g: &GenericType, sam_name: &str) -> Option<TypeRef>
fn sam_ret_cast(&self, g: &GenericType, sam_name: &str) -> Option<TypeRef>
Instantiated SAM return of a functional interface’s method, resolved
against a cast’s type arguments (
(Function<I,R>) lambda needs
(R) value witnesses on the impl body’s returns).Source§fn class_declares_generics(&self, internal: &str) -> bool
fn class_declares_generics(&self, internal: &str) -> bool
True when
internal declares class-level type parameters (so
new internal<>(...) should carry a diamond).Auto Trait Implementations§
impl<'a> Freeze for DexCtx<'a>
impl<'a> RefUnwindSafe for DexCtx<'a>
impl<'a> Send for DexCtx<'a>
impl<'a> Sync for DexCtx<'a>
impl<'a> Unpin for DexCtx<'a>
impl<'a> UnsafeUnpin for DexCtx<'a>
impl<'a> UnwindSafe for DexCtx<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more