/// <summary>
        /// The given type has been made reachable.
        /// </summary>
        /// <returns>True if the class was marked reachable, false otherwise</returns>
        internal bool IncludeIfNeeded(ReachableContext context, ClassFile javaClass)
        {
            if (javaClass.IsReachable)
            {
                return(true); // Already included
            }
            if (className == null)
            {
                return(false);
            }

            if (instanceOfCondition.IsInterface)
            {
                // Check implements
                if (Implements(context, javaClass))
                {
                    javaClass.MarkReachable(context);
                    return(true);
                }
            }
            else
            {
                // Check extends
                if (Extends(javaClass))
                {
                    javaClass.MarkReachable(context);
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
 /// <summary>
 /// Mark all elements of the given class reachable.
 /// </summary>
 internal void MarkAsRoot(ClassFile javaClass)
 {
     javaClass.MarkReachable(this);
     foreach (var m in javaClass.Methods)
     {
         m.MarkReachable(this);
     }
     foreach (var f in javaClass.Fields)
     {
         f.MarkReachable(this);
     }
 }