Lines Matching defs:Class
62 class StringPiece;
66 class ArtField;
67 class ClassLoader;
68 class DexCache;
69 class IfTable;
71 // Type for the InitializedStaticStorage table. Currently the Class
75 class MANAGED StaticStorageBase : public Object {
78 // C++ mirror of java.lang.Class
79 class MANAGED Class : public StaticStorageBase {
81 // Class Status
83 // kStatusNotReady: If a Class cannot be found in the class table by
86 // class, it may not be kStatusResolved and it will try to push it
89 // kStatusIdx: LoadClass populates with Class with information from
91 // Class value in super_class_ has not been populated. The new Class
94 // kStatusLoaded: After taking a lock on Class, the ClassLinker will
95 // attempt to move a kStatusIdx class forward to kStatusLoaded by
99 // kStatusResolved: Still holding the lock on Class, the ClassLinker
100 // shows linking is complete and fields of the Class populated by making
102 // class has a field that is of the type of the sub class. We need to be able
105 // kStatusRetryVerificationAtRuntime: The verifier sets a class to
108 // files, and this status marks a class as needing to be verified
122 kStatusInitializing = 8, // Class init in progress.
128 return static_cast<Status>(GetField32(OFFSET_OF_OBJECT_MEMBER(Class, status_), true));
133 // Returns true if the class has failed to link.
138 // Returns true if the class has been loaded.
143 // Returns true if the class has been loaded.
148 // Returns true if the class has been linked.
153 // Returns true if the class was compile-time verified.
158 // Returns true if the class has been verified.
163 // Returns true if the class is initializing.
168 // Returns true if the class is initialized.
176 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), new_access_flags, false);
179 // Returns true if the class is an interface.
184 // Returns true if the class is declared public.
189 // Returns true if the class is declared final.
199 uint32_t flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
203 // Returns true if the class is abstract.
208 // Returns true if the class is an annotation.
213 // Returns true if the class is synthetic.
247 Class* component = GetComponentType();
264 // TODO: switch to a check if the super class is java.lang.reflect.Proxy?
265 uint32_t access_flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
272 GetField32(OFFSET_OF_OBJECT_MEMBER(Class, primitive_type_), false));
277 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, primitive_type_), new_type, false);
280 // Returns true if the class is a primitive type.
325 // Depth of class from java.lang.Object
328 for (Class* klass = this; klass->GetSuperClass() != NULL; klass = klass->GetSuperClass()) {
348 Class* GetComponentType() const {
349 return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), false);
352 void SetComponentType(Class* new_component_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
355 SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), new_component_type, false);
384 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), false);
389 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), false);
400 return SetField32(OFFSET_OF_OBJECT_MEMBER(Class, object_size_), new_object_size, false);
403 // Returns true if this class is in the same packages as that class.
404 bool IsInSamePackage(const Class* that) const
409 // Returns true if this class can access that class.
410 bool CanAccess(Class* that) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
414 // Can this class access a member in the provided class with the provided member access flags?
415 // Note that access to the class isn't checked in case the declaring class is protected and the
416 // method has been exposed by a public sub-class
417 bool CanAccessMember(Class* access_to, uint32_t member_flags) const
431 // Check for protected access from a sub-class, which may or may not be in the same package.
441 bool IsSubClass(const Class* klass) const
444 // Can src be assigned to this class? For example, String can be assigned to Object (by an
446 // downcast would be necessary. Similarly for interfaces, a class that implements (or an interface
449 inline bool IsAssignableFrom(const Class* src) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
466 Class* GetSuperClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
468 void SetSuperClass(Class *new_super_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
469 // super class is assigned once, except during class linker initialization
470 Class* old_super_class = GetFieldObject<Class*>(
471 OFFSET_OF_OBJECT_MEMBER(Class, super_class_), false);
474 SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, super_class_), new_super_class, false);
482 return MemberOffset(OFFSETOF_MEMBER(Class, super_class_));
490 return MemberOffset(OFFSETOF_MEMBER(Class, dex_cache_));
544 return OFFSET_OF_OBJECT_MEMBER(Class, vtable_);
547 // Given a method implemented by this class but potentially from a super class, return the
548 // specific implementation method for this class.
552 // Given a method implemented by this class' super class, return the specific implementation
553 // method for this class.
557 // Given a method implemented by this class, but potentially from a
558 // super class or interface, return the specific implementation
559 // method for this class.
602 // Get instance fields of the class (See also GetSFields).
619 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), false);
625 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), false);
630 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_instance_fields_), new_num, false);
635 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_instance_offsets_), false);
643 return OFFSET_OF_OBJECT_MEMBER(Class, fields_);
650 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), false);
656 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), false);
661 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, num_reference_static_fields_), new_num, false);
664 // Gets the static fields of the class.
676 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_static_offsets_), false);
685 // Finds the given instance field in this class or a superclass.
689 // Finds the given instance field in this class or a superclass, only searches classes that
700 // Finds the given static field in this class or a superclass.
704 // Finds the given static field in this class or superclass, only searches classes that
717 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, clinit_thread_id_), false);
721 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, clinit_thread_id_), new_clinit_thread_id, false);
724 Class* GetVerifyErrorClass() const {
726 return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, verify_error_class_), false);
730 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_class_def_idx_), false);
734 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_class_def_idx_), class_def_idx, false);
738 return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_type_idx_), false);
742 SetField32(OFFSET_OF_OBJECT_MEMBER(Class, dex_type_idx_), type_idx, false);
745 static Class* GetJavaLangClass() {
751 static void SetClassClass(Class* java_lang_Class);
754 // When class is verified, set the kAccPreverified flag on each method.
758 void SetVerifyErrorClass(Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
760 bool Implements(const Class* klass) const
762 bool IsArrayAssignableFromArray(const Class* klass) const
764 bool IsAssignableFromArray(const Class* klass) const
767 // defining class loader, or NULL for the "bootstrap" system loader
770 // For array classes, the component class object for instanceof/checkcast
772 Class* component_type_;
784 // Note that only the fields directly declared by this class are
786 // the superclass's Class.ifields.
793 // The interface table (iftable_) contains pairs of a interface class and an array of the
794 // interface methods. There is one pair per interface supported by this class. That means one
798 // Why we need this: given "class Foo implements Face", declare "Face faceObj = new Foo()".
802 // For every interface a concrete class implements, we create an array of the concrete vtable_
806 // descriptor for the class such as "java.lang.Class" or "[C". Lazily initialized by ComputeName
813 Class* super_class_;
815 // If class verify fails, we must return same error on subsequent tries.
816 Class* verify_error_class_;
818 // Virtual methods defined in this class; invoked through vtable.
822 // copied in, and virtual methods from our class either replace those from the super or are
830 // Total size of the Class instance; used when allocating storage on gc heap.
837 // ClassDef index in dex file, -1 if no class definition such as an array.
865 // State of class initialization.
869 // initiating class loader list
877 // java.lang.Class
878 static Class* java_lang_Class_;
881 DISALLOW_IMPLICIT_CONSTRUCTORS(Class);
884 std::ostream& operator<<(std::ostream& os, const Class::Status& rhs);
886 class MANAGED ClassClass : public Class {