Example usage for org.eclipse.jdt.internal.compiler.lookup FieldBinding isSynthetic

List of usage examples for org.eclipse.jdt.internal.compiler.lookup FieldBinding isSynthetic

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup FieldBinding isSynthetic.

Prototype

public final boolean isSynthetic() 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.codeassist.SelectionEngine.java

License:Open Source License

private void selectStaticFieldFromStaticImport(CompilationUnitDeclaration parsedUnit, char[] lastToken,
        ReferenceBinding ref) {// ww w . j av a 2s .c  om
    int fieldLength = lastToken.length;
    FieldBinding[] fields = ref.availableFields();
    next: for (int j = 0; j < fields.length; j++) {
        FieldBinding field = fields[j];

        if (fieldLength > field.name.length)
            continue next;

        if (field.isSynthetic())
            continue next;

        if (!field.isStatic())
            continue next;

        if (!CharOperation.equals(lastToken, field.name, true))
            continue next;

        selectFrom(field, parsedUnit, false);
    }
}

From source file:com.redhat.ceylon.eclipse.core.model.mirror.UnknownClassMirror.java

License:Open Source License

@Override
public List<FieldMirror> getDirectFields() {
    if (fields == null) {
        doWithBindings(new ActionOnClassBinding() {
            @Override//from w  w  w  .  j  av  a2s  . co m
            public void doWithBinding(IType classModel, ReferenceBinding klass) {
                FieldBinding[] directFields = klass.fields();
                fields = new ArrayList<FieldMirror>(directFields.length);
                for (FieldBinding field : directFields) {
                    if (!field.isSynthetic() && !field.isPrivate()) {
                        fields.add(new JDTField(field));
                    }
                }
            }
        });
    }
    return fields;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.ConstantPoolObjectMapper.java

License:Open Source License

/**
 * This method realizes the logic of the mapping for fields.
 * @param srcMethod        where to copy from
 * @param refFieldBinding  what to copy/remap
 * @param dstTeam          where to copy to
 * @return destination field//from w  w  w  .j  a va2 s . c  o  m
 */
public static FieldBinding mapField(MethodBinding srcMethod, FieldBinding refFieldBinding,
        ReferenceBinding dstTeam) {
    // if Binding points at Role-Field of Superteamclass, then mapping must be done
    if (dstTeam != null) {
        if (isMappableField(refFieldBinding)) {
            if (refFieldBinding.isSynthetic()) {
                RoleModel role = ((ReferenceBinding) mapClass(srcMethod, refFieldBinding.declaringClass,
                        dstTeam)).roleModel;
                if (role != null) {
                    FieldBinding dstField = role.mapSyntheticField(refFieldBinding);
                    if (dstField != null)
                        return dstField;
                }
            }
            ReferenceBinding refTeamBinding = getTeam(refFieldBinding);
            if (refTeamBinding != null) {
                ReferenceBinding srcTeamBinding = getTeam(srcMethod);
                if (srcTeamBinding != null) {
                    if (TypeBinding.equalsEquals(refTeamBinding, srcTeamBinding)) {
                        FieldBinding newBinding = searchRoleField(refFieldBinding, dstTeam);
                        if (newBinding != null && TypeBinding.notEquals(newBinding.declaringClass, dstTeam)
                                && !TeamModel.isTeamContainingRole(dstTeam, newBinding.declaringClass)) {
                            // field is declared neither in dstTeam nor one of its roles.
                            // find the class, that corresponds to the field's declaring class:
                            ReferenceBinding updatedClass = (ReferenceBinding) mapClass(srcMethod,
                                    newBinding.declaringClass, dstTeam);
                            // update field binding to new declaring class?
                            if (TypeBinding.notEquals(newBinding.declaringClass, updatedClass))
                                newBinding = new FieldBinding(newBinding, updatedClass);
                        }
                        return newBinding;
                    }
                }
            }
        }
    }
    return refFieldBinding;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.SyntheticRoleFieldAccess.java

License:Open Source License

/**
 * Is given field a role field requiring a synthetic accessor?
 * If so answer the enclosing team class.
 *
 * @param targetField the field/*from   w w  w  . j ava  2  s .co  m*/
 *
 * @return the enclosing team type where the accessor should reside, or null.
 */
public static ReferenceBinding getTeamOfRoleField(FieldBinding targetField) {
    if (!targetField.declaringClass.isRole())
        return null; // not a role
    if (targetField.isSynthetic())
        return null; // synthetics shouldn't be accessed across scopes
    return targetField.declaringClass.enclosingType();
}