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

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

Introduction

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

Prototype

ReferenceBinding superclass

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

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 {//w ww .jav  a 2s . 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 {/*from  ww  w  .  j a v a  2 s .  c o  m*/
        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.CopyInheritance.java

License:Open Source License

public static TypeDeclaration internalCheckCopyLateRoleFile(SourceTypeBinding teamBinding, char[] name) {
    ReferenceBinding superTeam = (ReferenceBinding) teamBinding.superclass().original(); // FIXME(SH): tsuper teams
    if (superTeam != null && superTeam.isTeam() && !TypeAnalyzer.isOrgObjectteamsTeam(superTeam)
            && !teamBinding._teamModel._isCopyingLateRole && !OTNameUtils.isTSuperMarkerInterface(name)) {
        ReferenceBinding tsuperRole = superTeam.getMemberType(name);
        if ((tsuperRole == null
                || (!tsuperRole.isValidBinding() && tsuperRole.problemId() == ProblemReasons.NotFound))
                && superTeam instanceof SourceTypeBinding) {
            TypeDeclaration tsuperDecl = internalCheckCopyLateRoleFile(((SourceTypeBinding) superTeam), name);
            if (tsuperDecl != null)
                tsuperRole = tsuperDecl.binding;
        }/*from   w ww  .  ja v a2 s . c  o  m*/
        if (tsuperRole != null && tsuperRole.isRole() && tsuperRole.isValidBinding()
                && !tsuperRole.isLocalType()) {
            if ((teamBinding.tagBits & TagBits.BeginHierarchyCheck) != 0)
                return copyLateRole(teamBinding._teamModel.getAst(), tsuperRole);
            else
                return copyLateRolePart(teamBinding._teamModel.getAst(), tsuperRole);
        }
    }
    return null;
}