Example usage for org.eclipse.jdt.internal.compiler.ast ASTNode IsUnionType

List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode IsUnionType

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ASTNode IsUnionType.

Prototype

int IsUnionType

To view the source code for org.eclipse.jdt.internal.compiler.ast ASTNode IsUnionType.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.util.Util.java

License:Open Source License

public static String typeSignature(TypeReference type) {
    String signature = null;/*from   ww w  .  ja  v a2s  . c  om*/
    if ((type.bits & ASTNode.IsUnionType) != 0) {
        // special treatment for union type reference
        UnionTypeReference unionTypeReference = (UnionTypeReference) type;
        TypeReference[] typeReferences = unionTypeReference.typeReferences;
        int length = typeReferences.length;
        String[] typeSignatures = new String[length];
        for (int i = 0; i < length; i++) {
            char[][] compoundName = typeReferences[i].getParameterizedTypeName();
            char[] typeName = CharOperation.concatWith(compoundName, '.');
            typeSignatures[i] = Signature.createTypeSignature(typeName, false/*
                                                                             * don 't resolve
                                                                             */);
        }
        signature = Signature.createIntersectionTypeSignature(typeSignatures);
    } else {
        char[][] compoundName = type.getParameterizedTypeName();
        char[] typeName = CharOperation.concatWith(compoundName, '.');
        signature = Signature.createTypeSignature(typeName, false/*
                                                                 * don't resolve
                                                                 */);
    }
    return signature;
}