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

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

Introduction

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

Prototype

public FieldBinding original() 

Source Link

Document

Returns the original field (as opposed to parameterized instances)

Usage

From source file:com.google.gwt.dev.jjs.impl.GwtAstBuilder.java

License:Apache License

private void createField(FieldDeclaration x) {
    if (x instanceof Initializer) {
        return;//from  w  ww . ja v a 2 s  .c o m
    }
    SourceInfo info = makeSourceInfo(x);
    FieldBinding binding = x.binding;
    JType type = typeMap.get(binding.type);
    JDeclaredType enclosingType = (JDeclaredType) typeMap.get(binding.declaringClass);

    JField field;
    if (x.initialization != null && x.initialization instanceof AllocationExpression
            && ((AllocationExpression) x.initialization).enumConstant != null) {
        field = new JEnumField(info, intern(binding.name), binding.original().id, (JEnumType) enclosingType,
                (JClassType) type, AccessModifier.fromFieldBinding(binding));
    } else {
        field = new JField(info, intern(binding.name), enclosingType, type, binding.isStatic(),
                getFieldDisposition(binding), AccessModifier.fromFieldBinding(binding));
    }
    enclosingType.addField(field);
    JsInteropUtil.maybeSetExportedField(x, field);
    typeMap.setField(binding, field);
}

From source file:com.google.gwt.dev.jjs.impl.ReferenceMapper.java

License:Apache License

public JField get(FieldBinding binding) {
    binding = binding.original();
    String key = JdtUtil.signature(binding);
    JField sourceField = sourceFields.get(key);
    if (sourceField != null) {
        assert !sourceField.isExternal();
        return sourceField;
    }//from  ww  w  .  j ava2s  . c o  m
    JField field = fields.get(key);
    if (field == null) {
        field = createField(binding);
        assert field.isExternal();
        fields.put(key, field);
    }
    return field;
}