org.eclipse.jdt.core.dom.Type Java Examples
The following examples show how to use
org.eclipse.jdt.core.dom.Type.
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: ImplementInterfaceProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override protected ASTRewrite getRewrite() throws CoreException { ASTNode boundNode= fAstRoot.findDeclaringNode(fBinding); ASTNode declNode= null; CompilationUnit newRoot= fAstRoot; if (boundNode != null) { declNode= boundNode; // is same CU } else { newRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null); declNode= newRoot.findDeclaringNode(fBinding.getKey()); } ImportRewrite imports= createImportRewrite(newRoot); if (declNode instanceof TypeDeclaration) { AST ast= declNode.getAST(); ASTRewrite rewrite= ASTRewrite.create(ast); ImportRewriteContext importRewriteContext= new ContextSensitiveImportRewriteContext(declNode, imports); Type newInterface= imports.addImport(fNewInterface, ast, importRewriteContext, TypeLocation.OTHER); ListRewrite listRewrite= rewrite.getListRewrite(declNode, TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY); listRewrite.insertLast(newInterface, null); return rewrite; } return null; }
Example #2
Source File: ASTNodes.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static int getDimensions(VariableDeclaration declaration) { int dim= declaration.getExtraDimensions(); if (declaration instanceof VariableDeclarationFragment && declaration.getParent() instanceof LambdaExpression) { LambdaExpression lambda= (LambdaExpression) declaration.getParent(); IMethodBinding methodBinding= lambda.resolveMethodBinding(); if (methodBinding != null) { ITypeBinding[] parameterTypes= methodBinding.getParameterTypes(); int index= lambda.parameters().indexOf(declaration); ITypeBinding typeBinding= parameterTypes[index]; return typeBinding.getDimensions(); } } else { Type type= getType(declaration); if (type instanceof ArrayType) { dim+= ((ArrayType) type).getDimensions(); } } return dim; }
Example #3
Source File: StyledStringVisitor.java From JDeodorant with MIT License | 6 votes |
public boolean visit(ParameterizedType type) { /* * ParameterizedType: Type < Type { , Type } > */ activateDiffStyle(type); handleType(type.getType()); appendOpenBrace(); for (int i = 0; i < type.typeArguments().size(); i++) { handleType((Type) type.typeArguments().get(i)); if (i < type.typeArguments().size() - 1) { appendComma(); } } appendClosedBrace(); deactivateDiffStyle(type); return false; }
Example #4
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 6 votes |
private SuperFieldAcc visit(SuperFieldAccess node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); SuperFieldAcc superFieldAcc = new SuperFieldAcc(startLine, endLine, node); SName identifier = (SName) process(node.getName()); identifier.setParent(superFieldAcc); superFieldAcc.setIdentifier(identifier); if(node.getQualifier() != null){ Label name = (Label) process(node.getQualifier()); name.setParent(superFieldAcc); superFieldAcc.setName(name); } Pair<String, String> pair = NodeUtils.getTypeDecAndMethodDec(node); Type exprType = ProjectInfo.getVariableType(pair.getFirst(), pair.getSecond(), node.getName().getFullyQualifiedName()); superFieldAcc.setType(exprType); return superFieldAcc; }
Example #5
Source File: TypeResolver.java From KodeBeagle with Apache License 2.0 | 6 votes |
/** * @param type * @return */ private String getParametrizedType(final ParameterizedType type, final Boolean innerTypes) { final StringBuilder sb = new StringBuilder(getFullyQualifiedNameFor(type .getType().toString())); if(innerTypes) { sb.append("<"); for (final Object typeArg : type.typeArguments()) { final Type arg = (Type) typeArg; final String argString = getNameOfType(arg); sb.append(argString); sb.append(","); } sb.deleteCharAt(sb.length() - 1); sb.append(">"); } return sb.toString(); }
Example #6
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 6 votes |
private PostfixExpr visit(PostfixExpression node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); PostfixExpr postfixExpr = new PostfixExpr(startLine, endLine, node); Expr expression = (Expr) process(node.getOperand()); expression.setParent(postfixExpr); postfixExpr.setExpression(expression); postfixExpr.setOperator(node.getOperator()); Type exprType = NodeUtils.parseExprType(expression, node.getOperator().toString(), null); postfixExpr.setType(exprType); return postfixExpr; }
Example #7
Source File: CPlusPlusASTNodeWriter.java From juniversal with MIT License | 6 votes |
/** * Write out a type, when it's used (as opposed to defined). * * @param type type to write */ public void writeType(Type type, boolean useRawPointer) { boolean referenceType = !type.isPrimitiveType(); if (!referenceType) writeNode(type); else { if (useRawPointer) { writeNode(type); write("*"); } else { write("ptr< "); writeNode(type); write(" >"); } } }
Example #8
Source File: NodeUtils.java From SimFix with GNU General Public License v2.0 | 6 votes |
private static Type parsePreExprType(Expr expr, String operator){ AST ast = AST.newAST(AST.JLS8); switch(operator){ case "++": case "--": return ast.newPrimitiveType(PrimitiveType.INT); case "+": case "-": return expr.getType(); case "~": case "!": return ast.newPrimitiveType(PrimitiveType.BOOLEAN); default : return null; } }
Example #9
Source File: MoveInstanceMethodProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final boolean visit(final QualifiedName node) { Assert.isNotNull(node); IBinding binding= node.resolveBinding(); if (binding instanceof ITypeBinding) { final ITypeBinding type= (ITypeBinding) binding; if (type.isClass() && type.getDeclaringClass() != null) { final Type newType= fTargetRewrite.getImportRewrite().addImport(type, node.getAST()); fRewrite.replace(node, newType, null); return false; } } binding= node.getQualifier().resolveBinding(); if (Bindings.equals(fTarget, binding)) { fRewrite.replace(node, getFieldReference(node.getName(), fRewrite), null); return false; } node.getQualifier().accept(this); return false; }
Example #10
Source File: NodeUtils.java From SimFix with GNU General Public License v2.0 | 6 votes |
public boolean visit(VariableDeclarationStatement node) { ASTNode parent = node.getParent(); while(parent != null){ if(parent instanceof Block){ break; } parent = parent.getParent(); } if(parent != null) { int start = _unit.getLineNumber(node.getStartPosition()); int end = _unit.getLineNumber(parent.getStartPosition() + parent.getLength()); for (Object o : node.fragments()) { VariableDeclarationFragment vdf = (VariableDeclarationFragment) o; Pair<String, Type> pair = new Pair<String, Type>(vdf.getName().getFullyQualifiedName(), node.getType()); Pair<Integer, Integer> range = new Pair<Integer, Integer>(start, end); _tmpVars.put(pair, range); } } return true; }
Example #11
Source File: RefactoringUtility.java From JDeodorant with MIT License | 6 votes |
private static Type extractType(VariableDeclaration variableDeclaration) { Type returnedVariableType = null; if(variableDeclaration instanceof SingleVariableDeclaration) { SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration)variableDeclaration; returnedVariableType = singleVariableDeclaration.getType(); } else if(variableDeclaration instanceof VariableDeclarationFragment) { VariableDeclarationFragment fragment = (VariableDeclarationFragment)variableDeclaration; if(fragment.getParent() instanceof VariableDeclarationStatement) { VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)fragment.getParent(); returnedVariableType = variableDeclarationStatement.getType(); } else if(fragment.getParent() instanceof VariableDeclarationExpression) { VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression)fragment.getParent(); returnedVariableType = variableDeclarationExpression.getType(); } else if(fragment.getParent() instanceof FieldDeclaration) { FieldDeclaration fieldDeclaration = (FieldDeclaration)fragment.getParent(); returnedVariableType = fieldDeclaration.getType(); } } return returnedVariableType; }
Example #12
Source File: ImplementOccurrencesFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public String initialize(CompilationUnit root, ASTNode node) { if (!(node instanceof Name)) return SearchMessages.ImplementOccurrencesFinder_invalidTarget; fSelectedNode= ASTNodes.getNormalizedNode(node); if (!(fSelectedNode instanceof Type)) return SearchMessages.ImplementOccurrencesFinder_invalidTarget; StructuralPropertyDescriptor location= fSelectedNode.getLocationInParent(); if (location != TypeDeclaration.SUPERCLASS_TYPE_PROPERTY && location != TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY && location != EnumDeclaration.SUPER_INTERFACE_TYPES_PROPERTY) return SearchMessages.ImplementOccurrencesFinder_invalidTarget; fSelectedType= ((Type)fSelectedNode).resolveBinding(); if (fSelectedType == null) return SearchMessages.ImplementOccurrencesFinder_invalidTarget; fStart= fSelectedNode.getParent(); // type declaration fASTRoot= root; fDescription= Messages.format(SearchMessages.ImplementOccurrencesFinder_occurrence_description, BasicElementLabels.getJavaElementName(fSelectedType.getName())); return null; }
Example #13
Source File: ReferenceResolvingVisitor.java From windup with Eclipse Public License 1.0 | 6 votes |
/** * The method determines if the type can be resolved and if not, will try to guess the qualified name using the information from the imports. */ private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length, String line) { if (type == null) return null; ITypeBinding resolveBinding = type.resolveBinding(); if (resolveBinding == null) { ResolveClassnameResult resolvedResult = resolveClassname(type.toString()); ResolutionStatus status = resolvedResult.found ? ResolutionStatus.RECOVERED : ResolutionStatus.UNRESOLVED; PackageAndClassName packageAndClassName = PackageAndClassName.parseFromQualifiedName(resolvedResult.result); return processTypeAsString(resolvedResult.result, packageAndClassName.packageName, packageAndClassName.className, status, typeReferenceLocation, lineNumber, columnNumber, length, line); } else { return processTypeBinding(type.resolveBinding(), ResolutionStatus.RESOLVED, typeReferenceLocation, lineNumber, columnNumber, length, line); } }
Example #14
Source File: ReferenceFinderUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static Set<ITypeBinding> getTypesUsedInDeclaration(MethodDeclaration methodDeclaration) { if (methodDeclaration == null) return new HashSet<ITypeBinding>(0); Set<ITypeBinding> result= new HashSet<ITypeBinding>(); ITypeBinding binding= null; Type returnType= methodDeclaration.getReturnType2(); if (returnType != null) { binding = returnType.resolveBinding(); if (binding != null) result.add(binding); } for (Iterator<SingleVariableDeclaration> iter= methodDeclaration.parameters().iterator(); iter.hasNext();) { binding = iter.next().getType().resolveBinding(); if (binding != null) result.add(binding); } for (Iterator<Type> iter= methodDeclaration.thrownExceptionTypes().iterator(); iter.hasNext();) { binding= iter.next().resolveBinding(); if (binding != null) result.add(binding); } return result; }
Example #15
Source File: VariableDeclaration.java From RefactoringMiner with MIT License | 6 votes |
public VariableDeclaration(CompilationUnit cu, String filePath, SingleVariableDeclaration fragment) { this.annotations = new ArrayList<UMLAnnotation>(); List<IExtendedModifier> extendedModifiers = fragment.modifiers(); for(IExtendedModifier extendedModifier : extendedModifiers) { if(extendedModifier.isAnnotation()) { Annotation annotation = (Annotation)extendedModifier; this.annotations.add(new UMLAnnotation(cu, filePath, annotation)); } } this.locationInfo = new LocationInfo(cu, filePath, fragment, extractVariableDeclarationType(fragment)); this.variableName = fragment.getName().getIdentifier(); this.initializer = fragment.getInitializer() != null ? new AbstractExpression(cu, filePath, fragment.getInitializer(), CodeElementType.VARIABLE_DECLARATION_INITIALIZER) : null; Type astType = extractType(fragment); this.type = UMLType.extractTypeObject(cu, filePath, astType, fragment.getExtraDimensions()); int startOffset = fragment.getStartPosition(); ASTNode scopeNode = getScopeNode(fragment); int endOffset = scopeNode.getStartPosition() + scopeNode.getLength(); this.scope = new VariableScope(cu, filePath, startOffset, endOffset); }
Example #16
Source File: InferTypeArgumentsRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static boolean unboundedWildcardAllowed(Type originalType) { ASTNode parent= originalType.getParent(); while (parent instanceof Type) parent= parent.getParent(); if (parent instanceof ClassInstanceCreation) { return false; } else if (parent instanceof AbstractTypeDeclaration) { return false; } else if (parent instanceof TypeLiteral) { return false; } return true; }
Example #17
Source File: ProjectInfo.java From SimFix with GNU General Public License v2.0 | 5 votes |
public static Type getVariableType(String className, String methodName, String varName) { if(className == null){ return null; } ClassInfo classInfo = _classMap.get(className); if (classInfo == null) { // System.out.println(__name__ + "#getVariableType Parse variable type failed : " + className + "::" // + methodName + "::" + varName); return null; } return classInfo.getVariableType(methodName, varName); }
Example #18
Source File: BindingSignatureVisitor.java From JDeodorant with MIT License | 5 votes |
public boolean visit(SuperMethodInvocation expr) { if (expr.getQualifier() != null) { handleExpression(expr.getQualifier()); } List typeArguments = expr.typeArguments(); for (int i = 0; i < typeArguments.size(); i++) { handleType((Type) typeArguments.get(i)); } handleExpression(expr.getName()); handleParameters(expr.arguments()); return false; }
Example #19
Source File: ProjectInfo.java From SimFix with GNU General Public License v2.0 | 5 votes |
public static Class<?> convert2Class(Type type) { System.out.println("type : " + type); switch (type.toString()) { case "void": return void.class; case "int": return int.class; case "char": return char.class; case "short": return short.class; case "long": return long.class; case "float": return float.class; case "double": return double.class; case "byte": return byte.class; default: } if (type.toString().contains("[")) { return Arrays.class; } return null; }
Example #20
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private Label visit(Name node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); Label expr = null; if(node instanceof SimpleName){ SName sName = new SName(startLine, endLine, node); String name = node.getFullyQualifiedName(); sName.setName(name); Pair<String, String> classAndMethodName = NodeUtils.getTypeDecAndMethodDec(node); Type type = ProjectInfo.getVariableType(classAndMethodName.getFirst(), classAndMethodName.getSecond(), node.toString()); sName.setType(type); expr = sName; } else if(node instanceof QualifiedName){ QualifiedName qualifiedName = (QualifiedName) node; // System.out.println(qualifiedName.toString()); QName qName = new QName(startLine, endLine, node); SName sname = (SName) process(qualifiedName.getName()); sname.setParent(qName); Label label = (Label) process(qualifiedName.getQualifier()); label.setParent(qName); qName.setName(label, sname); qName.setType(sname.getType()); expr = qName; } return expr; }
Example #21
Source File: AbstractExceptionAnalyzer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public boolean visit(VariableDeclarationExpression node) { if (node.getLocationInParent() == TryStatement.RESOURCES_PROPERTY) { Type type = node.getType(); ITypeBinding resourceTypeBinding = type.resolveBinding(); if (resourceTypeBinding != null) { IMethodBinding methodBinding = Bindings.findMethodInHierarchy(resourceTypeBinding, "close", new ITypeBinding[0]); //$NON-NLS-1$ if (methodBinding != null) { addExceptions(methodBinding.getExceptionTypes(), node.getAST()); } } } return super.visit(node); }
Example #22
Source File: SuperFieldAcc.java From SimFix with GNU General Public License v2.0 | 5 votes |
@Override public String simplify(Map<String, String> varTrans, Map<String, Type> allUsableVariables) { Map<SName, Pair<String, String>> record = NodeUtils.tryReplaceAllVariables(this, varTrans, allUsableVariables); if(record == null){ return null; } NodeUtils.replaceVariable(record); String string = toSrcString().toString(); NodeUtils.restoreVariables(record); return string; }
Example #23
Source File: JavadocTagsSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static Set<String> getPreviousExceptionNames(List<Type> list, ASTNode missingNode) { Set<String> previousNames= new HashSet<String>(); for (int i= 0; i < list.size() && missingNode != list.get(i); i++) { Type curr= list.get(i); previousNames.add(ASTNodes.getTypeName(curr)); } return previousNames; }
Example #24
Source File: UnusedCodeFix.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void splitUpDeclarations(ASTRewrite rewrite, TextEditGroup group, VariableDeclarationFragment frag, VariableDeclarationStatement originalStatement, List<Expression> sideEffects) { if (sideEffects.size() > 0) { ListRewrite statementRewrite= rewrite.getListRewrite(originalStatement.getParent(), (ChildListPropertyDescriptor) originalStatement.getLocationInParent()); Statement previousStatement= originalStatement; for (int i= 0; i < sideEffects.size(); i++) { Expression sideEffect= sideEffects.get(i); Expression movedInit= (Expression) rewrite.createMoveTarget(sideEffect); ExpressionStatement wrapped= rewrite.getAST().newExpressionStatement(movedInit); statementRewrite.insertAfter(wrapped, previousStatement, group); previousStatement= wrapped; } VariableDeclarationStatement newDeclaration= null; List<VariableDeclarationFragment> fragments= originalStatement.fragments(); int fragIndex= fragments.indexOf(frag); ListIterator<VariableDeclarationFragment> fragmentIterator= fragments.listIterator(fragIndex+1); while (fragmentIterator.hasNext()) { VariableDeclarationFragment currentFragment= fragmentIterator.next(); VariableDeclarationFragment movedFragment= (VariableDeclarationFragment) rewrite.createMoveTarget(currentFragment); if (newDeclaration == null) { newDeclaration= rewrite.getAST().newVariableDeclarationStatement(movedFragment); Type copiedType= (Type) rewrite.createCopyTarget(originalStatement.getType()); newDeclaration.setType(copiedType); } else { newDeclaration.fragments().add(movedFragment); } } if (newDeclaration != null){ statementRewrite.insertAfter(newDeclaration, previousStatement, group); if (originalStatement.fragments().size() == newDeclaration.fragments().size() + 1){ rewrite.remove(originalStatement, group); } } } }
Example #25
Source File: ChangeMethodSignatureProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private TagElement insertThrowsTag(ListRewrite tagRewriter, List<Type> exceptions, int currentIndex, TagElement newTagElement) { HashSet<String> previousNames= new HashSet<String>(); for (int n = 0; n < currentIndex; n++) { Type curr= exceptions.get(n); previousNames.add(ASTNodes.getTypeName(curr)); } JavadocTagsSubProcessor.insertTag(tagRewriter, newTagElement, previousNames); return newTagElement; }
Example #26
Source File: ExtractConstantRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private Type getConstantType() throws JavaModelException { if (fConstantTypeCache == null) { IExpressionFragment fragment = getSelectedExpression(); ITypeBinding typeBinding = guessBindingForReference(fragment.getAssociatedExpression()); AST ast = fCuRewrite.getAST(); typeBinding = Bindings.normalizeForDeclarationUse(typeBinding, ast); ImportRewrite importRewrite = fCuRewrite.getImportRewrite(); ImportRewriteContext context = new ContextSensitiveImportRewriteContext(fCuRewrite.getRoot(), fSelectionStart, importRewrite); fConstantTypeCache = importRewrite.addImport(typeBinding, ast, context, TypeLocation.FIELD); } return fConstantTypeCache; }
Example #27
Source File: ExpressionStmt.java From SimFix with GNU General Public License v2.0 | 5 votes |
@Override public String simplify(Map<String, String> varTrans, Map<String, Type> allUsableVariables) { String expression = _expression.simplify(varTrans, allUsableVariables); if(expression == null){ return null; } return expression + ";"; }
Example #28
Source File: MethodExitsFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void performSearch() { fResult= new ArrayList<OccurrenceLocation>(); markReferences(); if (!fResult.isEmpty()) { Type returnType= fMethodDeclaration.getReturnType2(); if (returnType != null) { String desc= Messages.format(SearchMessages.MethodExitsFinder_occurrence_return_description, BasicElementLabels.getJavaElementName(fMethodDeclaration.getName().toString())); fResult.add(new OccurrenceLocation(returnType.getStartPosition(), returnType.getLength(), 0, desc)); } } }
Example #29
Source File: TreedUtils.java From compiler with Apache License 2.0 | 5 votes |
public static String buildASTLabel(ASTNode node) { String label = node.getClass().getSimpleName(); if (node instanceof Expression) { if (node.getClass().getSimpleName().endsWith("Literal")) { return label + "(" + node.toString() + ")"; } int type = node.getNodeType(); switch (type) { case ASTNode.INFIX_EXPRESSION: return label + "(" + ((InfixExpression) node).getOperator().toString() + ")"; case ASTNode.SIMPLE_NAME: return label + "(" + node.toString() + ")"; case ASTNode.POSTFIX_EXPRESSION: return label + "(" + ((PostfixExpression) node).getOperator().toString() + ")"; case ASTNode.PREFIX_EXPRESSION: return label + "(" + ((PrefixExpression) node).getOperator().toString() + ")"; default: break; } } else if (node instanceof Modifier) { return label + "(" + node.toString() + ")"; } else if (node instanceof Type) { if (node instanceof PrimitiveType) return label + "(" + node.toString() + ")"; } else if (node instanceof TextElement) { return label + "(" + node.toString() + ")"; } else if (node instanceof TagElement) { String tag = ((TagElement) node).getTagName(); if (tag == null) return label; return label + "(" + tag + ")"; } return label; }
Example #30
Source File: PushDownRefactoringProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private FieldDeclaration createNewFieldDeclarationNode(MemberActionInfo info, CompilationUnit declaringCuNode, TypeVariableMaplet[] mapping, ASTRewrite rewrite, VariableDeclarationFragment oldFieldFragment) throws JavaModelException { Assert.isTrue(info.isFieldInfo()); IField field= (IField) info.getMember(); AST ast= rewrite.getAST(); VariableDeclarationFragment newFragment= ast.newVariableDeclarationFragment(); copyExtraDimensions(oldFieldFragment, newFragment); Expression initializer= oldFieldFragment.getInitializer(); if (initializer != null) { Expression newInitializer= null; if (mapping.length > 0) newInitializer= createPlaceholderForExpression(initializer, field.getCompilationUnit(), mapping, rewrite); else newInitializer= createPlaceholderForExpression(initializer, field.getCompilationUnit(), rewrite); newFragment.setInitializer(newInitializer); } newFragment.setName(ast.newSimpleName(oldFieldFragment.getName().getIdentifier())); FieldDeclaration newField= ast.newFieldDeclaration(newFragment); FieldDeclaration oldField= ASTNodeSearchUtil.getFieldDeclarationNode(field, declaringCuNode); if (info.copyJavadocToCopiesInSubclasses()) copyJavadocNode(rewrite, oldField, newField); copyAnnotations(oldField, newField); newField.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldField.getModifiers()))); Type oldType= oldField.getType(); ICompilationUnit cu= field.getCompilationUnit(); Type newType= null; if (mapping.length > 0) { newType= createPlaceholderForType(oldType, cu, mapping, rewrite); } else newType= createPlaceholderForType(oldType, cu, rewrite); newField.setType(newType); return newField; }