Home | History | Annotate | Download | only in system
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package dalvik.system;
     18 
     19 /**
     20  * Holder class for extraneous Class data.
     21  *
     22  * This class holds data for Class objects that is either rarely useful, only necessary for
     23  * debugging purposes or both. This allows us to extend the Class class without impacting memory
     24  * use.
     25  *
     26  * @hide For internal runtime use only.
     27  */
     28 public final class ClassExt {
     29     /**
     30      * An array of all obsolete DexCache objects that are needed for obsolete methods.
     31      *
     32      * These entries are associated with the obsolete ArtMethod pointers at the same indexes in the
     33      * obsoleteMethods array.
     34      *
     35      * This field has native components and is a logical part of the 'Class' type.
     36      */
     37     private Object[] obsoleteDexCaches;
     38 
     39     /**
     40      * An array of all native obsolete ArtMethod pointers.
     41      *
     42      * These are associated with their DexCaches at the same index in the obsoleteDexCaches array.
     43      *
     44      * This field is actually either an int[] or a long[] depending on size of a pointer.
     45      *
     46      * This field contains native pointers and is a logical part of the 'Class' type.
     47      */
     48     private Object obsoleteMethods;
     49 
     50     /**
     51      * If set, the bytes, native pointer (as a java.lang.Long), or DexCache of the original dex-file
     52      * associated with the related class.
     53      *
     54      * In this instance 'original' means either (1) the dex-file loaded for this class when it was
     55      * first loaded after all non-retransformation capable transformations had been performed but
     56      * before any retransformation capable ones had been done or (2) the most recent dex-file bytes
     57      * given for a class redefinition.
     58      *
     59      * Needed in order to implement retransformation of classes.
     60      *
     61      * This field is a logical part of the 'Class' type.
     62      */
     63     private Object originalDexFile;
     64 
     65     /**
     66      * If class verify fails, we must return same error on subsequent tries. We may store either
     67      * the class of the error, or an actual instance of Throwable here.
     68      *
     69      * This field is a logical part of the 'Class' type.
     70      */
     71     private Object verifyError;
     72 
     73     /**
     74     * Private constructor.
     75     *
     76     * Only created by the runtime.
     77     */
     78     private ClassExt() {}
     79 }
     80