Package com.google.gwt.dev.jjs.ast

Examples of com.google.gwt.dev.jjs.ast.JField


      return true;
    }

    @Override
    public boolean visit(JClassLiteral x, Context ctx) {
      JField field = x.getField();
      rescue(field);
      return true;
    }
View Full Code Here


      return false;
    }

    @Override
    public boolean visit(JFieldRef ref, Context ctx) {
      JField target = ref.getField();

      // JLS 12.4.1: references to static, non-final, or
      // non-compile-time-constant fields rescue the enclosing class.
      // JDT already folds in compile-time constants as literals, so we must
      // rescue the enclosing types for any static fields that make it here.
      if (target.isStatic()) {
        rescue(target.getEnclosingType(), true, false);
      }
      rescue(target);
      return true;
    }
View Full Code Here

      return true;
    }

    private boolean isStaticFieldInitializedToLiteral(JVariable var) {
      if (var instanceof JField) {
        JField field = (JField) var;
        return field.isStatic() && field.getLiteralInitializer() != null;
      }
      return false;
    }
View Full Code Here

             *
             * TODO: Model ClassLiteral access a different way to avoid special
             * magic. See
             * Pruner.transformToNullFieldRef()/transformToNullMethodCall().
             */
            JField field = (JField) var;
            accept(field.getInitializer());
            referencedTypes.add(field.getEnclosingType());
            liveFieldsAndMethods.add(field.getEnclosingType().getMethods().get(
                0));
          }
        }
      }
    }
View Full Code Here

      assert (referencedTypes.contains(type));
      boolean isInstantiated = program.typeOracle.isInstantiatedType(type);

      for (Iterator it = type.fields.iterator(); it.hasNext();) {
        JField field = (JField) it.next();
        if (!referencedNonTypes.contains(field)
            || pruneViaNoninstantiability(isInstantiated, field)) {
          it.remove();
          didChange = true;
        }
View Full Code Here

    public boolean visit(JInterfaceType type, Context ctx) {
      boolean isReferenced = referencedTypes.contains(type);
      boolean isInstantiated = program.typeOracle.isInstantiatedType(type);

      for (Iterator it = type.fields.iterator(); it.hasNext();) {
        JField field = (JField) it.next();
        // all interface fields are static and final
        if (!isReferenced || !referencedNonTypes.contains(field)) {
          it.remove();
          didChange = true;
        }
View Full Code Here

      return false;
    }

    // @Override
    public boolean visit(JFieldRef ref, Context ctx) {
      JField target = ref.getField();

      // JLS 12.4.1: references to static, non-final, or
      // non-compile-time-constant fields rescue the enclosing class.
      // JDT already folds in compile-time constants as literals, so we must
      // rescue the enclosing types for any static fields that make it here.
      if (target.isStatic()) {
        rescue(target.getEnclosingType(), true, false);
      }
      rescue(target);
      return true;
    }
View Full Code Here

        }
      }

      // visit any field initializers
      for (int i = 0; i < type.fields.size(); ++i) {
        JField it = (JField) type.fields.get(i);
        accept(it);
      }

      return false;
    }
View Full Code Here

        assert (i >= 0);
        magicArg[0] = i;
        return (JExpression) args.get(i);
      } else if (targetExpr instanceof JFieldRef) {
        JFieldRef oldFieldRef = (JFieldRef) targetExpr;
        JField field = oldFieldRef.getField();
        JExpression instance = oldFieldRef.getInstance();
        if (instance != null) {
          // If an instance field, we have to be able to inline the qualifier
          instance = canInlineExpression(info, instance, params, args, magicArg);
          if (instance == null) {
View Full Code Here

      // resultExpression might be null, which behaves correctly here.
      if (!(resultExpression instanceof JFieldRef)) {
        return true;
      }
      JFieldRef fieldRefResult = (JFieldRef) resultExpression;
      JField fieldResult = fieldRefResult.getField();
      if (!fieldResult.isStatic()) {
        // A nonstatic field reference won't trigger the clinit we need.
        return true;
      }
      if (fieldResult.getEnclosingType() != targetEnclosingType) {
        // We have a static field reference, but it's to the wrong class (not
        // the class whose clinit we must trigger).
        return true;
      }
      // The correct cross-class static field reference will trigger the clinit.
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.