Example usage for org.eclipse.jdt.internal.compiler.lookup MemberTypeBinding MemberTypeBinding

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

Introduction

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

Prototype

public MemberTypeBinding(char[][] compoundName, ClassScope scope, SourceTypeBinding enclosingType) 

Source Link

Usage

From source file:org.eclipse.ajdt.core.parserbridge.ITDInserter.java

License:Open Source License

private TypeDeclaration createITIT(String name, TypeDeclaration enclosing) {
    TypeDeclaration decl = new TypeDeclaration(enclosing.compilationResult);
    decl.enclosingType = enclosing;//  w  w w .  jav  a 2  s  .  c  om
    decl.name = name.toCharArray();
    ClassScope innerClassScope = new ClassScope(enclosing.scope, decl);
    decl.binding = new MemberTypeBinding(new char[][] { enclosing.name, name.toCharArray() }, innerClassScope,
            enclosing.binding);
    decl.staticInitializerScope = enclosing.staticInitializerScope;
    decl.initializerScope = enclosing.initializerScope;
    decl.scope = innerClassScope;
    decl.binding.superInterfaces = new ReferenceBinding[0];
    decl.binding.typeVariables = new TypeVariableBinding[0];
    decl.binding.memberTypes = new ReferenceBinding[0];
    decl.modifiers = Flags.AccPublic | Flags.AccStatic;
    decl.binding.modifiers = decl.modifiers;

    // also set the bindings, but may have to unset them as well.
    ReferenceBinding[] newBindings = new ReferenceBinding[enclosing.binding.memberTypes.length + 1];
    System.arraycopy(enclosing.binding.memberTypes, 0, newBindings, 0, enclosing.binding.memberTypes.length);
    newBindings[enclosing.binding.memberTypes.length] = decl.binding;
    enclosing.binding.memberTypes = newBindings;
    return decl;
}