Java Code Examples for org.eclipse.jdt.core.dom.AST#newSimpleType()
The following examples show how to use
org.eclipse.jdt.core.dom.AST#newSimpleType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RefactoringUtility.java From JDeodorant with MIT License | 6 votes |
public static Type generateWrapperTypeForPrimitiveTypeBinding(ITypeBinding typeBinding, AST ast) { Type type = null; if(typeBinding.isPrimitive()) { String primitiveType = typeBinding.getName(); if(primitiveType.equals("int")) type = ast.newSimpleType(ast.newSimpleName("Integer")); else if(primitiveType.equals("double")) type = ast.newSimpleType(ast.newSimpleName("Double")); else if(primitiveType.equals("byte")) type = ast.newSimpleType(ast.newSimpleName("Byte")); else if(primitiveType.equals("short")) type = ast.newSimpleType(ast.newSimpleName("Short")); else if(primitiveType.equals("char")) type = ast.newSimpleType(ast.newSimpleName("Character")); else if(primitiveType.equals("long")) type = ast.newSimpleType(ast.newSimpleName("Long")); else if(primitiveType.equals("float")) type = ast.newSimpleType(ast.newSimpleName("Float")); else if(primitiveType.equals("boolean")) type = ast.newSimpleType(ast.newSimpleName("Boolean")); } return type; }
Example 2
Source File: ChangeTypeRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Creates the appropriate ParameterizedType node. Recursion is needed to * handle the nested case (e.g., Vector<Vector<String>>). * @param ast * @param typeBinding * @return the created type */ private Type createParameterizedType(AST ast, ITypeBinding typeBinding){ if (typeBinding.isParameterizedType() && !typeBinding.isRawType()){ Type baseType= ast.newSimpleType(ASTNodeFactory.newName(ast, typeBinding.getErasure().getName())); ParameterizedType newType= ast.newParameterizedType(baseType); for (int i=0; i < typeBinding.getTypeArguments().length; i++){ ITypeBinding typeArg= typeBinding.getTypeArguments()[i]; Type argType= createParameterizedType(ast, typeArg); // recursive call newType.typeArguments().add(argType); } return newType; } else { if (!typeBinding.isTypeVariable()){ return ast.newSimpleType(ASTNodeFactory.newName(ast, typeBinding.getErasure().getName())); } else { return ast.newSimpleType(ast.newSimpleName(typeBinding.getName())); } } }
Example 3
Source File: IntroduceFactoryRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Sets the return type of the factory method, including any necessary type * arguments. E.g., for constructor <code>Foo()</code> in <code>Foo<T></code>, * the factory method defines a method type parameter <code><T></code> and * returns a <code>Foo<T></code>. * @param newMethod the method whose return type is to be set * @param retTypeName the simple name of the return type (without type parameters) * @param ctorOwnerTypeParameters the formal type parameters of the type that the * factory method instantiates (whose constructor is being encapsulated) * @param ast utility object used to create AST nodes */ private void setMethodReturnType(MethodDeclaration newMethod, String retTypeName, ITypeBinding[] ctorOwnerTypeParameters, AST ast) { if (ctorOwnerTypeParameters.length == 0) newMethod.setReturnType2(ast.newSimpleType(ast.newSimpleName(retTypeName))); else { Type baseType= ast.newSimpleType(ast.newSimpleName(retTypeName)); ParameterizedType newRetType= ast.newParameterizedType(baseType); List<Type> newRetTypeArgs= newRetType.typeArguments(); for(int i= 0; i < ctorOwnerTypeParameters.length; i++) { Type retTypeArg= ASTNodeFactory.newType(ast, ctorOwnerTypeParameters[i].getName()); newRetTypeArgs.add(retTypeArg); } newMethod.setReturnType2(newRetType); } }
Example 4
Source File: NewAnnotationMemberProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private Type getNewType(ASTRewrite rewrite) { AST ast= rewrite.getAST(); Type newTypeNode= null; ITypeBinding binding= null; if (fInvocationNode.getLocationInParent() == MemberValuePair.NAME_PROPERTY) { Expression value= ((MemberValuePair) fInvocationNode.getParent()).getValue(); binding= value.resolveTypeBinding(); } else if (fInvocationNode instanceof Expression) { binding= ((Expression) fInvocationNode).resolveTypeBinding(); } if (binding != null) { ImportRewriteContext importRewriteContext= new ContextSensitiveImportRewriteContext(fInvocationNode, getImportRewrite()); newTypeNode= getImportRewrite().addImport(binding, ast, importRewriteContext); } if (newTypeNode == null) { newTypeNode= ast.newSimpleType(ast.newSimpleName("String")); //$NON-NLS-1$ } return newTypeNode; }
Example 5
Source File: MoveMethodRefactoring.java From JDeodorant with MIT License | 6 votes |
private SimpleName addSourceClassParameterToMovedMethod(MethodDeclaration newMethodDeclaration, ASTRewrite targetRewriter) { AST ast = newMethodDeclaration.getAST(); SingleVariableDeclaration parameter = ast.newSingleVariableDeclaration(); SimpleName typeName = ast.newSimpleName(sourceTypeDeclaration.getName().getIdentifier()); Type parameterType = ast.newSimpleType(typeName); targetRewriter.set(parameter, SingleVariableDeclaration.TYPE_PROPERTY, parameterType, null); String sourceTypeName = sourceTypeDeclaration.getName().getIdentifier(); SimpleName parameterName = ast.newSimpleName(sourceTypeName.replaceFirst(Character.toString(sourceTypeName.charAt(0)), Character.toString(Character.toLowerCase(sourceTypeName.charAt(0))))); targetRewriter.set(parameter, SingleVariableDeclaration.NAME_PROPERTY, parameterName, null); ListRewrite parametersRewrite = targetRewriter.getListRewrite(newMethodDeclaration, MethodDeclaration.PARAMETERS_PROPERTY); parametersRewrite.insertLast(parameter, null); this.additionalArgumentsAddedToMovedMethod.add("this"); this.additionalTypeBindingsToBeImportedInTargetClass.add(sourceTypeDeclaration.resolveBinding()); addParamTagElementToJavadoc(newMethodDeclaration, targetRewriter, parameterName.getIdentifier()); setPublicModifierToSourceTypeDeclaration(); return parameterName; }
Example 6
Source File: ASTNodeFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Returns the new type node representing the return type of <code>lambdaExpression</code> * including the extra dimensions. * * @param lambdaExpression the lambda expression * @param ast the AST to create the return type with * @param importRewrite the import rewrite to use, or <code>null</code> * @param context the import rewrite context, or <code>null</code> * @return a new type node created with the given AST representing the return type of * <code>lambdaExpression</code> * * @since 3.10 */ public static Type newReturnType(LambdaExpression lambdaExpression, AST ast, ImportRewrite importRewrite, ImportRewriteContext context) { IMethodBinding method= lambdaExpression.resolveMethodBinding(); if (method != null) { ITypeBinding returnTypeBinding= method.getReturnType(); if (importRewrite != null) { return importRewrite.addImport(returnTypeBinding, ast); } else { String qualifiedName= returnTypeBinding.getQualifiedName(); if (qualifiedName.length() > 0) { return newType(ast, qualifiedName); } } } // fall-back return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
Example 7
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private StrLiteral visit(StringLiteral node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); StrLiteral literal = new StrLiteral(startLine, endLine, node); literal.setValue(node.getLiteralValue()); AST ast = AST.newAST(AST.JLS8); Type type = ast.newSimpleType(ast.newSimpleName("String")); literal.setType(type); return literal; }
Example 8
Source File: CastCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Type getNewCastTypeNode(ASTRewrite rewrite, ImportRewrite importRewrite) { AST ast= rewrite.getAST(); ImportRewriteContext context= new ContextSensitiveImportRewriteContext((CompilationUnit) fNodeToCast.getRoot(), fNodeToCast.getStartPosition(), importRewrite); if (fCastType != null) { return importRewrite.addImport(fCastType, ast,context); } ASTNode node= fNodeToCast; ASTNode parent= node.getParent(); if (parent instanceof CastExpression) { node= parent; parent= parent.getParent(); } while (parent instanceof ParenthesizedExpression) { node= parent; parent= parent.getParent(); } if (parent instanceof MethodInvocation) { MethodInvocation invocation= (MethodInvocation) node.getParent(); if (invocation.getExpression() == node) { IBinding targetContext= ASTResolving.getParentMethodOrTypeBinding(node); ITypeBinding[] bindings= ASTResolving.getQualifierGuess(node.getRoot(), invocation.getName().getIdentifier(), invocation.arguments(), targetContext); if (bindings.length > 0) { ITypeBinding first= getCastFavorite(bindings, fNodeToCast.resolveTypeBinding()); Type newTypeNode= importRewrite.addImport(first, ast, context); addLinkedPosition(rewrite.track(newTypeNode), true, "casttype"); //$NON-NLS-1$ for (int i= 0; i < bindings.length; i++) { addLinkedPositionProposal("casttype", bindings[i]); //$NON-NLS-1$ } return newTypeNode; } } } Type newCastType= ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ addLinkedPosition(rewrite.track(newCastType), true, "casttype"); //$NON-NLS-1$ return newCastType; }
Example 9
Source File: ChangeTypeRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void updateType(CompilationUnit cu, Type oldType, CompilationUnitChange unitChange, ASTRewrite unitRewriter, String typeName) { String oldName= fSelectionTypeBinding.getName(); String[] keys= { BasicElementLabels.getJavaElementName(oldName), BasicElementLabels.getJavaElementName(typeName)}; String description= Messages.format(RefactoringCoreMessages.ChangeTypeRefactoring_typeChange, keys); TextEditGroup gd= new TextEditGroup(description); AST ast= cu.getAST(); ASTNode nodeToReplace= oldType; if (fSelectionTypeBinding.isParameterizedType() && !fSelectionTypeBinding.isRawType()){ if (oldType.isSimpleType()){ nodeToReplace= oldType.getParent(); } } //TODO handle types other than simple & parameterized (e.g., arrays) Assert.isTrue(fSelectedType.isClass() || fSelectedType.isInterface()); Type newType= null; if (!fSelectedType.isParameterizedType()){ newType= ast.newSimpleType(ASTNodeFactory.newName(ast, typeName)); } else { newType= createParameterizedType(ast, fSelectedType); } unitRewriter.replace(nodeToReplace, newType, gd); unitChange.addTextEditGroup(gd); }
Example 10
Source File: ExtractInterfaceProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates the new signature of the source type. * * @param rewrite * the source compilation unit rewrite * @param declaration * the type declaration * @param status * the refactoring status * @param monitor * the progress monitor to use * @throws JavaModelException * if the type parameters cannot be retrieved */ protected final void createTypeSignature(final CompilationUnitRewrite rewrite, final AbstractTypeDeclaration declaration, final RefactoringStatus status, final IProgressMonitor monitor) throws JavaModelException { Assert.isNotNull(rewrite); Assert.isNotNull(declaration); Assert.isNotNull(status); Assert.isNotNull(monitor); try { monitor.beginTask("", 1); //$NON-NLS-1$ monitor.setTaskName(RefactoringCoreMessages.ExtractInterfaceProcessor_creating); final AST ast= declaration.getAST(); final ITypeParameter[] parameters= fSubType.getTypeParameters(); Type type= ast.newSimpleType(ast.newSimpleName(fSuperName)); if (parameters.length > 0) { final ParameterizedType parameterized= ast.newParameterizedType(type); for (int index= 0; index < parameters.length; index++) parameterized.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getElementName()))); type= parameterized; } final ASTRewrite rewriter= rewrite.getASTRewrite(); if (declaration instanceof TypeDeclaration) rewriter.getListRewrite(declaration, TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY).insertLast(type, rewrite.createCategorizedGroupDescription(RefactoringCoreMessages.ExtractInterfaceProcessor_add_super_interface, SET_EXTRACT_INTERFACE)); else if (declaration instanceof EnumDeclaration) rewriter.getListRewrite(declaration, EnumDeclaration.SUPER_INTERFACE_TYPES_PROPERTY).insertLast(type, rewrite.createCategorizedGroupDescription(RefactoringCoreMessages.ExtractInterfaceProcessor_add_super_interface, SET_EXTRACT_INTERFACE)); monitor.worked(1); } finally { monitor.done(); } }
Example 11
Source File: ParameterObjectFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Type createType(boolean asTopLevelClass, CompilationUnitRewrite cuRewrite, int position) { String qualifier= asTopLevelClass ? fPackage : fEnclosingType; String concatenateName= JavaModelUtil.concatenateName(qualifier, fClassName); ImportRewrite importRewrite= cuRewrite.getImportRewrite(); ContextSensitiveImportRewriteContext context= createParameterClassAwareContext(asTopLevelClass, cuRewrite, position); String addedImport= importRewrite.addImport(concatenateName, context); cuRewrite.getImportRemover().registerAddedImport(addedImport); AST ast= cuRewrite.getAST(); return ast.newSimpleType(ast.newName(addedImport)); }
Example 12
Source File: ParameterObjectFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static Type importBinding(ITypeBinding typeBinding, CompilationUnitRewrite cuRewrite) { int declaredModifiers= typeBinding.getModifiers(); AST ast= cuRewrite.getAST(); if (Modifier.isPrivate(declaredModifiers) || Modifier.isProtected(declaredModifiers)) { return ast.newSimpleType(ast.newSimpleName(typeBinding.getName())); } Type type= cuRewrite.getImportRewrite().addImport(typeBinding, cuRewrite.getAST()); cuRewrite.getImportRemover().registerAddedImports(type); return type; }
Example 13
Source File: MoveInnerToTopRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private ASTNode getNewUnqualifiedTypeNode(ITypeBinding[] parameters, Name name) { final AST ast= name.getAST(); boolean raw= false; final ITypeBinding binding= name.resolveTypeBinding(); if (binding != null && binding.isRawType()) raw= true; if (parameters != null && parameters.length > 0 && !raw) { final ParameterizedType type= ast.newParameterizedType(ast.newSimpleType(ast.newSimpleName(fType.getElementName()))); for (int index= 0; index < parameters.length; index++) type.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getName()))); return type; } return ast.newSimpleType(ast.newSimpleName(fType.getElementName())); }
Example 14
Source File: NewMethodCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Type evaluateParameterType(AST ast, Expression elem, String key, ImportRewriteContext context) { ITypeBinding binding= Bindings.normalizeTypeBinding(elem.resolveTypeBinding()); if (binding != null && binding.isWildcardType()) { binding= ASTResolving.normalizeWildcardType(binding, true, ast); } if (binding != null) { ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(key, typeProposals[i]); } return getImportRewrite().addImport(binding, ast, context); } return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
Example 15
Source File: CastCorrectionProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private Type getNewCastTypeNode(ASTRewrite rewrite, ImportRewrite importRewrite) { AST ast= rewrite.getAST(); ImportRewriteContext context= new ContextSensitiveImportRewriteContext((CompilationUnit) fNodeToCast.getRoot(), fNodeToCast.getStartPosition(), importRewrite); if (fCastType != null) { return importRewrite.addImport(fCastType, ast,context, TypeLocation.CAST); } ASTNode node= fNodeToCast; ASTNode parent= node.getParent(); if (parent instanceof CastExpression) { node= parent; parent= parent.getParent(); } while (parent instanceof ParenthesizedExpression) { node= parent; parent= parent.getParent(); } if (parent instanceof MethodInvocation) { MethodInvocation invocation= (MethodInvocation) node.getParent(); if (invocation.getExpression() == node) { IBinding targetContext= ASTResolving.getParentMethodOrTypeBinding(node); ITypeBinding[] bindings= ASTResolving.getQualifierGuess(node.getRoot(), invocation.getName().getIdentifier(), invocation.arguments(), targetContext); if (bindings.length > 0) { ITypeBinding first= getCastFavorite(bindings, fNodeToCast.resolveTypeBinding()); Type newTypeNode= importRewrite.addImport(first, ast, context, TypeLocation.CAST); return newTypeNode; } } } Type newCastType= ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ return newCastType; }
Example 16
Source File: ExtractFieldRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private RefactoringStatus checkTempTypeForLocalTypeUsage() throws JavaModelException { Expression expression = getSelectedExpression().getAssociatedExpression(); Type resultingType = null; ITypeBinding typeBinding = expression.resolveTypeBinding(); AST ast = fCURewrite.getAST(); if (expression instanceof ClassInstanceCreation && (typeBinding == null || typeBinding.getTypeArguments().length == 0)) { resultingType = ((ClassInstanceCreation) expression).getType(); } else if (expression instanceof CastExpression) { resultingType = ((CastExpression) expression).getType(); } else { if (typeBinding == null) { typeBinding = ASTResolving.guessBindingForReference(expression); } if (typeBinding != null) { typeBinding = Bindings.normalizeForDeclarationUse(typeBinding, ast); ImportRewrite importRewrite = fCURewrite.getImportRewrite(); ImportRewriteContext context = new ContextSensitiveImportRewriteContext(expression, importRewrite); resultingType = importRewrite.addImport(typeBinding, ast, context, TypeLocation.LOCAL_VARIABLE); } else { resultingType = ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ } } IMethodBinding declaringMethodBinding = getMethodDeclaration().resolveBinding(); ITypeBinding[] methodTypeParameters = declaringMethodBinding == null ? new ITypeBinding[0] : declaringMethodBinding.getTypeParameters(); LocalTypeAndVariableUsageAnalyzer analyzer = new LocalTypeAndVariableUsageAnalyzer(methodTypeParameters); resultingType.accept(analyzer); boolean usesLocalTypes = !analyzer.getUsageOfEnclosingNodes().isEmpty(); if (usesLocalTypes) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractFieldRefactoring_uses_type_declared_locally); } return null; }
Example 17
Source File: NewVariableCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Type evaluateVariableType(AST ast, ImportRewrite imports, ImportRewriteContext importRewriteContext, IBinding targetContext) { if (fOriginalNode.getParent() instanceof MethodInvocation) { MethodInvocation parent= (MethodInvocation) fOriginalNode.getParent(); if (parent.getExpression() == fOriginalNode) { // _x_.foo() -> guess qualifier type by looking for a type with method 'foo' ITypeBinding[] bindings= ASTResolving.getQualifierGuess(fOriginalNode.getRoot(), parent.getName().getIdentifier(), parent.arguments(), targetContext); if (bindings.length > 0) { for (int i= 0; i < bindings.length; i++) { addLinkedPositionProposal(KEY_TYPE, bindings[i]); } return imports.addImport(bindings[0], ast, importRewriteContext); } } } ITypeBinding binding= ASTResolving.guessBindingForReference(fOriginalNode); if (binding != null) { if (binding.isWildcardType()) { binding= ASTResolving.normalizeWildcardType(binding, isVariableAssigned(), ast); if (binding == null) { // only null binding applies binding= ast.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ } } if (isVariableAssigned()) { ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, binding); for (int i= 0; i < typeProposals.length; i++) { addLinkedPositionProposal(KEY_TYPE, typeProposals[i]); } } return imports.addImport(binding, ast, importRewriteContext); } // no binding, find type AST node instead -> ABC a= x-> use 'ABC' as is Type type= ASTResolving.guessTypeForReference(ast, fOriginalNode); if (type != null) { return type; } if (fVariableKind == CONST_FIELD) { return ast.newSimpleType(ast.newSimpleName("String")); //$NON-NLS-1$ } return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
Example 18
Source File: InterfaceSetter.java From SparkBuilderGenerator with MIT License | 4 votes |
public void setInterface(AST ast, TypeDeclaration type, TypeDeclaration interfaceToAdd) { SimpleType interfaceType = ast.newSimpleType(ast.newSimpleName(interfaceToAdd.getName().getFullyQualifiedName())); type.superInterfaceTypes().add(interfaceType); }
Example 19
Source File: JavaStatementPostfixContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Type createType(String typeSig, AST ast) { int sigKind = Signature.getTypeSignatureKind(typeSig); switch (sigKind) { case Signature.BASE_TYPE_SIGNATURE: return ast.newPrimitiveType(PrimitiveType.toCode(Signature.toString(typeSig))); case Signature.ARRAY_TYPE_SIGNATURE: Type elementType = createType(Signature.getElementType(typeSig), ast); return ast.newArrayType(elementType, Signature.getArrayCount(typeSig)); case Signature.CLASS_TYPE_SIGNATURE: String erasureSig = Signature.getTypeErasure(typeSig); String erasureName = Signature.toString(erasureSig); if (erasureSig.charAt(0) == Signature.C_RESOLVED) { erasureName = addImport(erasureName); } Type baseType= ast.newSimpleType(ast.newName(erasureName)); String[] typeArguments = Signature.getTypeArguments(typeSig); if (typeArguments.length > 0) { ParameterizedType type = ast.newParameterizedType(baseType); List argNodes = type.typeArguments(); for (int i = 0; i < typeArguments.length; i++) { String curr = typeArguments[i]; if (containsNestedCapture(curr)) { argNodes.add(ast.newWildcardType()); } else { argNodes.add(createType(curr, ast)); } } return type; } return baseType; case Signature.TYPE_VARIABLE_SIGNATURE: return ast.newSimpleType(ast.newSimpleName(Signature.toString(typeSig))); case Signature.WILDCARD_TYPE_SIGNATURE: WildcardType wildcardType= ast.newWildcardType(); char ch = typeSig.charAt(0); if (ch != Signature.C_STAR) { Type bound= createType(typeSig.substring(1), ast); wildcardType.setBound(bound, ch == Signature.C_EXTENDS); } return wildcardType; case Signature.CAPTURE_TYPE_SIGNATURE: return createType(typeSig.substring(1), ast); } return ast.newSimpleType(ast.newName("java.lang.Object")); }
Example 20
Source File: EnsuresPredicateFix.java From CogniCrypt with Eclipse Public License 2.0 | 2 votes |
/** * This method build {@link Type} object * * @param type - class * @param ast - current ast * @return Type obj */ private Type createAstType(final String type, final AST ast) { return ast.newSimpleType(ast.newSimpleName(type)); }