List of usage examples for org.eclipse.jdt.internal.compiler.lookup SyntheticMethodBinding SyntheticMethodBinding
public SyntheticMethodBinding(int purpose, ArrayBinding arrayType, char[] selector, SourceTypeBinding declaringClass)
From source file:org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.java
License:Open Source License
public SyntheticMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess, boolean isSuperAccess) { 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; SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL] .get(targetField);//ww w . j a v a 2 s . co m if (accessors == null) { accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, isSuperAccess, this); this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetField, accessors = new SyntheticMethodBinding[2]); accessors[isReadAccess ? 0 : 1] = accessMethod; } else { if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) { accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, isSuperAccess, this); accessors[isReadAccess ? 0 : 1] = accessMethod; } } return accessMethod; }
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);//from www . j a v a 2 s . c o m // 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; }