Example usage for org.eclipse.jdt.internal.compiler.lookup TypeConstants SYNTHETIC_SWITCH_ENUM_TABLE

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeConstants SYNTHETIC_SWITCH_ENUM_TABLE

Introduction

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

Prototype

null SYNTHETIC_SWITCH_ENUM_TABLE

To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeConstants SYNTHETIC_SWITCH_ENUM_TABLE.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.java

License:Open Source License

public SyntheticMethodBinding addSyntheticMethodForSwitchEnum(TypeBinding enumBinding) {
    if (this.synthetics == null)
        this.synthetics = new HashMap[MAX_SYNTHETICS];
    if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
        this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap(5);

    SyntheticMethodBinding accessMethod = null;
    char[] selector = CharOperation.concat(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE,
            enumBinding.constantPoolName());
    CharOperation.replace(selector, '/', '$');
    final String key = new String(selector);
    SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL]
            .get(key);//  www. j a va  2s .c om
    // first add the corresponding synthetic field
    if (accessors == null) {
        // then create the synthetic method
        final SyntheticFieldBinding fieldBinding = addSyntheticFieldForSwitchEnum(selector, key);
        accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
        this.synthetics[SourceTypeBinding.METHOD_EMUL].put(key, accessors = new SyntheticMethodBinding[2]);
        accessors[0] = accessMethod;
    } else {
        if ((accessMethod = accessors[0]) == null) {
            final SyntheticFieldBinding fieldBinding = addSyntheticFieldForSwitchEnum(selector, key);
            accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
            accessors[0] = accessMethod;
        }
    }
    return accessMethod;
}

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

License:Open Source License

boolean isSynthMethodName(char[] name) {
    return CharOperation.prefixEquals(TypeConstants.SYNTHETIC_ACCESS_METHOD_PREFIX, name)
            || CharOperation.prefixEquals(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, name)
            || CharOperation.equals(CalloutImplementorDyn.OT_ACCESS, name)
            || CharOperation.equals(CalloutImplementorDyn.OT_ACCESS_STATIC, name);
}