pub struct NullCtx {
pub class_name: String,
pub level: u16,
}Expand description
A Ctx with no metadata: every query answers “unknown”.
Useful for tests and for front-ends that have not implemented a query yet — the core degrades gracefully (no nesting assumptions, no generic casts).
Fields§
§class_name: String§level: u16Trait Implementations§
Source§impl Ctx for NullCtx
impl Ctx for NullCtx
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 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 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 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 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_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 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 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.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 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 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 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 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 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 Freeze for NullCtx
impl RefUnwindSafe for NullCtx
impl Send for NullCtx
impl Sync for NullCtx
impl Unpin for NullCtx
impl UnsafeUnpin for NullCtx
impl UnwindSafe for NullCtx
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