1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.env.IConstants;
15 import org.eclipse.jdt.internal.compiler.lookup.*;
16 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
17 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
20 public class JavadocArgumentExpression extends Expression {
22 public Argument argument;
24 public JavadocArgumentExpression(char[] name, int startPos, int endPos, TypeReference typeRef) {
26 this.sourceStart = startPos;
27 this.sourceEnd = endPos;
28 long pos = (((long) startPos) << 32) + endPos;
29 this.argument = new Argument(name, pos, typeRef, IConstants.AccDefault);
30 this.bits |= InsideJavadoc;
34 * Resolves type on a Block or Class scope.
36 private TypeBinding internalResolveType(Scope scope) {
37 this.constant = NotAConstant;
38 if (this.resolvedType != null) // is a shared type reference which was already resolved
39 return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
41 if (this.argument != null) {
42 TypeReference typeRef = this.argument.type;
43 if (typeRef != null) {
44 this.resolvedType = typeRef.getTypeBinding(scope);
45 typeRef.resolvedType = this.resolvedType;
46 if (!this.resolvedType.isValidBinding()) {
47 scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers());
50 if (isTypeUseDeprecated(this.resolvedType, scope)) {
51 scope.problemReporter().javadocDeprecatedType(this.resolvedType, typeRef, scope.getDeclarationModifiers());
54 return this.resolvedType = scope.convertToRawType(this.resolvedType);
60 public StringBuffer printExpression(int indent, StringBuffer output) {
61 if (this.argument == null) {
62 if (this.token != null) {
63 output.append(this.token);
67 this.argument.print(indent, output);
72 public void resolve(BlockScope scope) {
73 if (this.argument != null) {
74 this.argument.resolve(scope);
78 public TypeBinding resolveType(BlockScope scope) {
79 return internalResolveType(scope);
82 public TypeBinding resolveType(ClassScope scope) {
83 return internalResolveType(scope);
87 * Redefine to capture javadoc specific signatures
88 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
90 public void traverse(ASTVisitor visitor, BlockScope blockScope) {
91 if (visitor.visit(this, blockScope)) {
92 if (this.argument != null) {
93 this.argument.traverse(visitor, blockScope);
96 visitor.endVisit(this, blockScope);