Skip to main content

DexCtx

Struct DexCtx 

Source
pub struct DexCtx<'a> {
    pub pool: &'a DexPool,
    pub class: &'a PoolClass,
}
Expand description

Front-end context handed to the core’s structurer and printer.

Fields§

§pool: &'a DexPool§class: &'a PoolClass

Implementations§

Source§

impl<'a> DexCtx<'a>

Source

pub fn new(pool: &'a DexPool, class: &'a PoolClass) -> Self

Trait Implementations§

Source§

impl<'a> Ctx for DexCtx<'a>

Source§

fn class_name(&self) -> &str

Internal name of the class currently being emitted (e.g. java/util/ArrayList).
Source§

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>

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

Nested-class family of root, as far as the container records it.
Source§

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

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

True when sub is assignable to sup (both internal names).
Source§

fn is_interface(&self, internal: &str) -> bool

True when internal is an interface.
Source§

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>

Superclass of internal (internal name); None at Object/unknown.
Source§

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>)>

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>)>

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>

Access flags of the field internal.name; None when absent.
Source§

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

True when internal declares any field named name.
Source§

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

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>)>

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>

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>>

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>>

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

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>

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>

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>

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>

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>

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

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.