Class FieldExpression

  • All Implemented Interfaces:
    java.lang.Cloneable, Constants, RuntimeConstants

    public class FieldExpression
    extends UnaryExpression
    WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Method Detail

      • getImplementation

        public Expression getImplementation()
        Description copied from class: Expression
        Type checking may assign a more complex implementation to an innocuous-looking expression (like an identifier). Return that implementation, or the original expression itself if there is no special implementation.

        This appears at present to be dead code, and is not called from within javac. Access to the implementation generally occurs within the same class, and thus uses the underlying field directly.

        Overrides:
        getImplementation in class Expression
      • isQualSuper

        private boolean isQualSuper()
        Return true if the field is being selected from a qualified 'super'.
      • toIdentifier

        public static Identifier toIdentifier​(Expression e)
        Convert an '.' expression to a qualified identifier
      • reportFailedPackagePrefix

        static void reportFailedPackagePrefix​(Environment env,
                                              Expression right)
        If 'checkAmbiguousName' returns 'Package.tPackage', then it was unable to resolve any prefix of the qualified name. This method attempts to diagnose the problem.
      • reportFailedPackagePrefix

        static void reportFailedPackagePrefix​(Environment env,
                                              Expression right,
                                              boolean mustBeType)
      • accessBase

        private ClassDefinition accessBase​(Environment env,
                                           Context ctx)
        Determine if an access method is required, and, if so, return the class in which it should appear, else return null.
      • isTypeAccessible

        static boolean isTypeAccessible​(long where,
                                        Environment env,
                                        Type t,
                                        ClassDefinition c)
        Determine if a type is accessible from a given class.
      • checkCommon

        private Vset checkCommon​(Environment env,
                                 Context ctx,
                                 Vset vset,
                                 java.util.Hashtable<java.lang.Object,​java.lang.Object> exp,
                                 UnaryExpression loc,
                                 boolean isLHS)
        Common code for checkValue and checkAmbigName
      • getAssigner

        public FieldUpdater getAssigner​(Environment env,
                                        Context ctx)
        Return a FieldUpdater object to be used in updating the value of the location denoted by this, which must be an expression suitable for the left-hand side of an assignment. This is used for implementing assignments to private fields for which an access method is required. Returns null if no access method is needed, in which case the assignment is handled in the usual way, by direct access. Only simple assignment expressions are handled here Assignment operators and pre/post increment/decrement operators are are handled by 'getUpdater' below.

        Must be called after 'checkValue', else 'right' will be invalid.

        Overrides:
        getAssigner in class Expression
      • getUpdater

        public FieldUpdater getUpdater​(Environment env,
                                       Context ctx)
        Return a FieldUpdater object to be used in updating the value of the location denoted by this, which must be an expression suitable for the left-hand side of an assignment. This is used for implementing the assignment operators and the increment and decrement operators on private fields that are accessed from another class, e.g, uplevel from an inner class. Returns null if no access method is needed.

        Must be called after 'checkValue', else 'right' will be invalid.

        Overrides:
        getUpdater in class Expression
      • checkInnerClass

        private Vset checkInnerClass​(Environment env,
                                     Context ctx,
                                     Vset vset,
                                     java.util.Hashtable<java.lang.Object,​java.lang.Object> exp,
                                     UnaryExpression loc)
        This field expression is an inner class reference. Finish checking it.
      • checkLHS

        public Vset checkLHS​(Environment env,
                             Context ctx,
                             Vset vset,
                             java.util.Hashtable<java.lang.Object,​java.lang.Object> exp)
        Check the expression if it appears on the LHS of an assignment
        Overrides:
        checkLHS in class Expression
      • checkFinalAssign

        public static Vset checkFinalAssign​(Environment env,
                                            Context ctx,
                                            Vset vset,
                                            long where,
                                            MemberDefinition field)
        There is a simple assignment being made to the given final field. The field was named either by a simple name or by an almost-simple expression of the form "this.v". Check if this is a legal assignment.

        Blank final variables can be set in initializers or constructor bodies. In all cases there must be definite single assignment. (All instance and instance variable initializers and each constructor body are treated as if concatenated for the purposes of this check. Assignment to "this.x" is treated as a definite assignment to the simple name "x" which names the instance variable.)

      • isConstant

        public boolean isConstant()
        Check if constant: Will it inline away?
        Overrides:
        isConstant in class UnaryExpression
      • print

        public void print​(java.io.PrintStream out)
        Print
        Overrides:
        print in class UnaryExpression