Example usage for org.eclipse.jdt.core.dom SuperFieldAccess resolveFieldBinding

List of usage examples for org.eclipse.jdt.core.dom SuperFieldAccess resolveFieldBinding

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperFieldAccess resolveFieldBinding.

Prototype

public IVariableBinding resolveFieldBinding() 

Source Link

Document

Resolves and returns the binding for the field accessed by this expression.

Usage

From source file:com.architexa.diagrams.jdt.extractors.TypeRefExtractor.java

License:Open Source License

@Override
public boolean visit(SuperFieldAccess node) {
    addRefFromCaller(bindingToResource(node.resolveFieldBinding()));
    return true;
}

From source file:com.google.devtools.j2cpp.types.BindingMapBuilder.java

License:Open Source License

@Override
public boolean visit(SuperFieldAccess node) {
    put(node, node.resolveFieldBinding());
    return true;
}

From source file:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java

License:Open Source License

private CAstNode visit(SuperFieldAccess n, WalkContext context) {
    CAstNode targetNode;// w  ww  .j ava2  s . c o  m
    if (n.getQualifier() == null)
        targetNode = makeNode(context, fFactory, n, CAstNode.SUPER);
    else {
        TypeReference owningTypeRef = fIdentityMapper.getTypeRef(n.getQualifier().resolveTypeBinding());
        targetNode = makeNode(context, fFactory, n, CAstNode.SUPER, fFactory.makeConstant(owningTypeRef));
    }
    return createFieldAccess(targetNode, n.getName().getIdentifier(), n.resolveFieldBinding(), n, context);
}

From source file:edu.uci.ics.sourcerer.extractor.ast.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes:/*from  w w w . ja  v  a  2s.  co  m*/
 *<ul>
 *  <li>For super field access expressions:
 *  <ul>
 *    <li>Writes relation to <code>IRelationWriter</code>.</li>
 *    <li>Reads relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(SuperFieldAccess node) {
    // Get the fqn
    String fqn = null;
    IVariableBinding binding = node.resolveFieldBinding();
    if (binding == null) {
        fqn = getUnknownSuperFqn(node.getName().getIdentifier());
    } else {
        ITypeBinding declaringClass = binding.getDeclaringClass();
        if (declaringClass != null) {
            declaringClass = declaringClass.getErasure();
        }
        if (declaringClass == null) {
            fqn = getUnknownSuperFqn(binding.getName());
        } else {
            fqn = getTypeFqn(declaringClass) + "." + binding.getName();
        }
    }

    // Write the relation
    if (inLhsAssignment) {
        relationWriter.writeWrites(fqnStack.getFqn(), fqn, getLocation(node));
    } else {
        relationWriter.writeReads(fqnStack.getFqn(), fqn, getLocation(node));
    }

    return true;
}

From source file:edu.uci.ics.sourcerer.tools.java.extractor.eclipse.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes:/*from w  ww  .j a v  a2  s  .  c o m*/
 *<ul>
 *  <li>For super field access expressions:
 *  <ul>
 *    <li>Writes relation to <code>IRelationWriter</code>.</li>
 *    <li>Reads relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(SuperFieldAccess node) {
    // Get the fqn
    String fqn = null;
    IVariableBinding binding = node.resolveFieldBinding();
    if (binding == null) {
        fqn = createUnknownSuperFqn(node.getName().getIdentifier());
    } else {
        ITypeBinding declaringClass = binding.getDeclaringClass();
        if (declaringClass != null) {
            declaringClass = declaringClass.getErasure();
        }
        if (declaringClass == null) {
            fqn = createUnknownSuperFqn(binding.getName());
        } else {
            fqn = getTypeFqn(declaringClass) + "." + binding.getName();
        }
    }

    // Write the relation
    if (inLhsAssignment) {
        relationWriter.writeRelation(Relation.WRITES, fqnStack.getFqn(), fqn, createLocation(node));
    } else {
        relationWriter.writeRelation(Relation.READS, fqnStack.getFqn(), fqn, createLocation(node));
    }

    return true;
}

From source file:fr.labri.harmony.rta.junit.jdt.JDTVisitorRTA.java

License:Open Source License

public boolean visit(SuperFieldAccess a) {
    IVariableBinding b = a.resolveFieldBinding();

    if (b != null && currentJavaMethod != null) {
        if (b.getDeclaringClass() != null) {
            if (!(a.getParent() instanceof Assignment)) {

                String fieldId = getVariableBindingId(b);
                //System.err.println("Add "+fieldId);
                currentJavaMethod.getCallsSite().add(fieldId);
            } else {
                if (((Assignment) a.getParent()).getLeftHandSide() instanceof SuperFieldAccess) {
                    if (!((SuperFieldAccess) ((Assignment) a.getParent()).getLeftHandSide())
                            .resolveFieldBinding().getKey().equals(b.getKey())) {

                        String fieldId = getVariableBindingId(b);
                        //System.err.println("Add "+fieldId);
                        currentJavaMethod.getCallsSite().add(fieldId);
                    }//from  w  w  w .jav a  2s.  c o m
                }
            }
        }
    }

    return true;
}

From source file:lang.java.jdt.internal.BindingsResolver.java

License:Open Source License

public void resolveBindings(SuperFieldAccess node) {
    importBinding(node.resolveFieldBinding());
    importBinding(node.resolveTypeBinding());
}

From source file:org.eclipse.objectteams.otdt.debug.ui.internal.actions.OTValidBreakpointLocationLocator.java

License:Open Source License

private boolean isReplacedByConstantValue(SuperFieldAccess node) {
    if (!fBindingsResolved) {
        fNeedBindings = true;/*w  w  w  .ja  va  2s  .  c  o m*/
        return false;
    }
    // if the field is static final
    IVariableBinding binding = node.resolveFieldBinding();
    if (binding != null) {
        return binding.getConstantValue() != null;
    }
    return false;
}