Example usage for org.eclipse.jdt.internal.compiler.ast JavadocImplicitTypeReference JavadocImplicitTypeReference

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

Introduction

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

Prototype

public JavadocImplicitTypeReference(char[] name, int pos) 

Source Link

Usage

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

License:Open Source License

/**
 * Recursively converts from an aj type reference to a JDT type reference.
 * This class is not involved with Content assist and code select, so the CompletionOn* and SelectionOn* variants of
 * type references should not make it here.
 * @param ajRef/*from  w  ww .j a v a 2 s .com*/
 * @return jdtRef
 */
private TypeReference convertToJDTTypeReference(
        org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference ajRef) {
    if (ajRef == null) {
        return null;
    }
    TypeReference jdtRef = null;
    if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference) {
        org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference) ajRef;
        jdtRef = new JavadocImplicitTypeReference(castedAJ.token, castedAJ.sourceStart);
    } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) {
        if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference) {
            if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArrayQualifiedTypeReference) {
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArrayQualifiedTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArrayQualifiedTypeReference) ajRef;
                jdtRef = new JavadocArrayQualifiedTypeReference(
                        new JavadocQualifiedTypeReference(castedAJ.tokens, castedAJ.sourcePositions,
                                castedAJ.tagSourceStart, castedAJ.tagSourceEnd),
                        castedAJ.dimensions());
            } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference) {
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference) ajRef;
                jdtRef = new ParameterizedQualifiedTypeReference(castedAJ.tokens,
                        convertDoubleArray(castedAJ.typeArguments), castedAJ.dimensions(),
                        castedAJ.sourcePositions);
            } else { // assume vanilla ArrayQualifiedTypeReference
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference) ajRef;
                jdtRef = new ArrayQualifiedTypeReference(castedAJ.tokens, castedAJ.dimensions(),
                        castedAJ.sourcePositions);
            }
        } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference) {
            org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference) ajRef;
            jdtRef = new JavadocQualifiedTypeReference(castedAJ.tokens, castedAJ.sourcePositions,
                    castedAJ.tagSourceStart, castedAJ.tagSourceEnd);
        } else { // assume vanilla QualifiedTypeReference
            org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) ajRef;
            jdtRef = new QualifiedTypeReference(castedAJ.tokens, castedAJ.sourcePositions);
        }
    } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) {
        if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference) {
            if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference) {
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference) ajRef;
                jdtRef = new JavadocArraySingleTypeReference(castedAJ.token, castedAJ.dimensions,
                        toPos(castedAJ.sourceStart, castedAJ.sourceEnd));
            } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference) {
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference) ajRef;
                jdtRef = new ParameterizedSingleTypeReference(castedAJ.token,
                        convertSingleArray(castedAJ.typeArguments), castedAJ.dimensions,
                        toPos(castedAJ.sourceStart, castedAJ.sourceEnd));
            } else { // assume vanilla ArrayTypeReference
                org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference) ajRef;
                jdtRef = new ArrayTypeReference(castedAJ.token, castedAJ.dimensions,
                        toPos(castedAJ.sourceStart, castedAJ.sourceEnd));
            }
        } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference) {
            org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference) ajRef;
            jdtRef = new JavadocSingleTypeReference(castedAJ.token,
                    toPos(castedAJ.sourceStart, castedAJ.sourceEnd), castedAJ.tagSourceStart,
                    castedAJ.tagSourceEnd);
        } else { // assume vanilla SingleTypeReference
            org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) ajRef;
            jdtRef = new SingleTypeReference(castedAJ.token, toPos(castedAJ.sourceStart, castedAJ.sourceEnd));
        }
    } else if (ajRef instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.Wildcard) {
        org.aspectj.org.eclipse.jdt.internal.compiler.ast.Wildcard castedAJ = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.Wildcard) ajRef;
        Wildcard castedJDT = new Wildcard(castedAJ.kind);
        castedJDT.bound = convertToJDTTypeReference(castedAJ.bound);
        jdtRef = castedJDT;
    }

    Assert.isNotNull(jdtRef, "Conversion to JDT type reference failed.  Original AJ type reference is: '"
            + ajRef + "' and class '" + ajRef.getClass() + "'");

    // now fill in the rest of the shared fields.  Not all of them will be applicable in all cases
    jdtRef.bits = ajRef.bits;
    jdtRef.implicitConversion = ajRef.implicitConversion;
    jdtRef.statementEnd = ajRef.statementEnd;

    return jdtRef;
}