public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
@Override public String getKey() { StringBuffer buffer = new StringBuffer(); buffer.append("Recovered#"); //$NON-NLS-1$ if (this.variableDeclaration != null) { buffer .append("variableDeclaration") //$NON-NLS-1$ .append(this.variableDeclaration.getClass()) .append(this.variableDeclaration.getName().getIdentifier()) .append(this.variableDeclaration.getExtraDimensions()); } return String.valueOf(buffer); }
public static int getDimensions(VariableDeclaration declaration) { int dim= declaration.getExtraDimensions(); Type type= getType(declaration); if (type instanceof ArrayType) { dim += ((ArrayType) type).getDimensions(); } return dim; }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
RecoveredTypeBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) { this.variableDeclaration = variableDeclaration; this.resolver = resolver; this.currentType = getType(); this.dimensions = variableDeclaration.getExtraDimensions(); if (this.currentType.isArrayType()) { this.dimensions += ((ArrayType) this.currentType).getDimensions(); } }
/** * Returns the new type node corresponding to the type of the given declaration * including the extra dimensions. * @param ast The AST to create the resulting type with. * @param declaration The variable declaration to get the type from * @return A new type node created with the given AST. */ public static Type newType(AST ast, VariableDeclaration declaration) { Type type= ASTNodes.getType(declaration); int extraDim= declaration.getExtraDimensions(); type= (Type) ASTNode.copySubtree(ast, type); for (int i= 0; i < extraDim; i++) { type= ast.newArrayType(type); } return type; }
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; }
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; }
public ITypeBinding getElementType() { if (this.binding != null) { if (this.binding.isArrayType()) { ArrayBinding arrayBinding = (ArrayBinding) this.binding; return new RecoveredTypeBinding(this.resolver, arrayBinding.leafComponentType); } else { return new RecoveredTypeBinding(this.resolver, this.binding); } } if (this.innerTypeBinding != null) { return this.innerTypeBinding.getElementType(); } if (this.currentType!= null && this.currentType.isArrayType()) { return this.resolver.getTypeBinding(((ArrayType) this.currentType).getElementType()); } if (this.variableDeclaration != null && this.variableDeclaration.getExtraDimensions() != 0) { return this.resolver.getTypeBinding(getType()); } return null; }
public ITypeBinding getElementType() { if (this.binding != null) { if (this.binding.isArrayType()) { ArrayBinding arrayBinding = (ArrayBinding) this.binding; return new RecoveredTypeBinding(this.resolver, arrayBinding.leafComponentType); } else { return new RecoveredTypeBinding(this.resolver, this.binding); } } if (this.innerTypeBinding != null) { return this.innerTypeBinding.getElementType(); } if (this.currentType!= null && this.currentType.isArrayType()) { return this.resolver.getTypeBinding(((ArrayType) this.currentType).getElementType()); } if (this.variableDeclaration != null && this.variableDeclaration.getExtraDimensions() != 0) { return this.resolver.getTypeBinding(getType()); } return null; }
public ITypeBinding getElementType() { if (this.binding != null) { if (this.binding.isArrayType()) { ArrayBinding arrayBinding = (ArrayBinding) this.binding; return new RecoveredTypeBinding(this.resolver, arrayBinding.leafComponentType); } else { return new RecoveredTypeBinding(this.resolver, this.binding); } } if (this.innerTypeBinding != null) { return this.innerTypeBinding.getElementType(); } if (this.currentType!= null && this.currentType.isArrayType()) { return this.resolver.getTypeBinding(((ArrayType) this.currentType).getElementType()); } if (this.variableDeclaration != null && this.variableDeclaration.getExtraDimensions() != 0) { return this.resolver.getTypeBinding(getType()); } return null; }
private FieldDeclaration createNewFieldDeclaration(ASTRewrite rewrite) { AST ast= getAST(); VariableDeclarationFragment fragment= ast.newVariableDeclarationFragment(); SimpleName variableName= ast.newSimpleName(fFieldName); fragment.setName(variableName); addLinkedName(rewrite, variableName, false); fragment.setExtraDimensions(fTempDeclarationNode.getExtraDimensions()); if (fInitializeIn == INITIALIZE_IN_FIELD && tempHasInitializer()){ Expression initializer= (Expression)rewrite.createCopyTarget(getTempInitializer()); fragment.setInitializer(initializer); } FieldDeclaration fieldDeclaration= ast.newFieldDeclaration(fragment); VariableDeclarationStatement vds= getTempDeclarationStatement(); Type type= (Type)rewrite.createCopyTarget(vds.getType()); fieldDeclaration.setType(type); fieldDeclaration.modifiers().addAll(ASTNodeFactory.newModifiers(ast, getModifiers())); return fieldDeclaration; }