Example usage for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding superInterfaces

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

Introduction

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

Prototype

ReferenceBinding[] superInterfaces

To view the source code for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding superInterfaces.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.TypeBindingConvector.java

License:Open Source License

public static String toJsonBinaryType(SourceTypeBinding binding) {
    JsonObject object = new JsonObject();
    if (!binding.isAnnotationType()) {
        object.add("annotations", toJsonAnnotations(binding.getAnnotations()));
    } else {/*from w ww.j a  v  a2  s.  c o m*/
        object.add("annotations", JsonNull.INSTANCE);

    }
    object.add("enclosingMethod", null);
    object.add("enclosingTypeName", binding.enclosingType() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.enclosingType().constantPoolName())));

    object.add("fields", toJsonFields(binding.fields()));
    object.add("genericSignature", binding.genericSignature() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.genericSignature())));
    object.add("interfaceNames", toJsonInterfaces(binding.superInterfaces()));
    object.add("memberTypes", toJsonMemberTypes(binding.memberTypes()));
    object.add("methods", toJsonMethods(binding.methods()));
    object.add("missingTypeNames", null);
    object.add("name", binding.constantPoolName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.constantPoolName())));
    object.add("sourceName", binding.sourceName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.sourceName())));
    object.add("superclassName", binding.superclass() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.superclass().constantPoolName())));
    long annotationTagBits = binding.getAnnotationTagBits();
    //remove AreMethodsComplete bit tag from type
    annotationTagBits &= ~TagBits.AreMethodsComplete;

    object.add("tagBits", new JsonPrimitive(String.valueOf(annotationTagBits)));
    object.add("anonymous", new JsonPrimitive(binding.isAnonymousType()));
    object.add("local", new JsonPrimitive(binding.isLocalType()));
    object.add("member", new JsonPrimitive(binding.isMemberType()));
    object.add("sourceFileName", binding.sourceName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(binding.sourceName())));
    object.add("modifiers", new JsonPrimitive(binding.modifiers));
    object.add("binaryType", new JsonPrimitive(true));
    object.add("fileName", null);
    return gson.toJson(object);
}

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

License:Apache License

private void resolveTypeRefs(TypeDeclaration x) {
    SourceTypeBinding binding = x.binding;
    JDeclaredType type = (JDeclaredType) typeMap.get(binding);
    try {// ww w. ja v  a  2 s. com
        ReferenceBinding superClassBinding = binding.superclass();
        if (type instanceof JClassType && superClassBinding != null) {
            assert (binding.superclass().isClass() || binding.superclass().isEnum());
            JClassType superClass = (JClassType) typeMap.get(superClassBinding);
            ((JClassType) type).setSuperClass(superClass);
        }

        ReferenceBinding[] superInterfaces = binding.superInterfaces();
        for (ReferenceBinding superInterfaceBinding : superInterfaces) {
            assert (superInterfaceBinding.isInterface());
            JInterfaceType superInterface = (JInterfaceType) typeMap.get(superInterfaceBinding);
            type.addImplements(superInterface);
        }

        ReferenceBinding enclosingBinding = binding.enclosingType();
        if (enclosingBinding != null) {
            type.setEnclosingType((JDeclaredType) typeMap.get(enclosingBinding));
        }
        if (x.memberTypes != null) {
            for (TypeDeclaration memberType : x.memberTypes) {
                resolveTypeRefs(memberType);
            }
        }
    } catch (Throwable e) {
        InternalCompilerException ice = translateException(null, e);
        StringBuffer sb = new StringBuffer();
        x.printHeader(0, sb);
        ice.addNode(x.getClass().getName(), sb.toString(), type.getSourceInfo());
        throw ice;
    }
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.TypeLevel.java

License:Open Source License

/**
 * When bindings for superinterfaces are created (ClassScope.connectSuperinterfaces()),
 * they might falsely be resolved to some role of a super team.
 * Now is the time to adjust this reference to the copied role in this team.
 * @param superTeam//  w  w w  .  j av a  2 s  . c o  m
 * @param destRole
 * @param obligations
 */
private static void adjustSuperinterfaces(ReferenceBinding superTeam, SourceTypeBinding destRole,
        ArrayList<SupertypeObligation> obligations) {
    if (destRole == null)
        return; // no hope;
    ReferenceBinding[] superinterfaces = destRole.superInterfaces();
    if (superinterfaces != null) {
        for (int i = 0; i < superinterfaces.length; i++) {
            // TODO(SH): enclosingType could be a tsuper of superTeam.
            if (TypeBinding.equalsEquals(superinterfaces[i].enclosingType(), superTeam)) {
                ReferenceBinding teamType = destRole.enclosingType();
                ReferenceBinding superinterface = teamType.getMemberType(superinterfaces[i].internalName());
                if (TypeBinding.notEquals(superinterface, destRole)) // not for the tsuper link.
                {
                    obligations.add(new SupertypeObligation(superinterface, superinterfaces[i], null, null));
                    superinterfaces[i] = superinterfaces[i].transferTypeArguments(superinterface);
                    destRole.scope.compilationUnitScope().recordSuperTypeReference(superinterface);
                }
            }
        }
    }
}