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 if (!this.resolvedType.isValidBinding()) {
40 return null; // already reported error
44 if (this.argument != null) {
45 TypeReference typeRef = this.argument.type;
46 if (typeRef != null) {
47 this.resolvedType = typeRef.getTypeBinding(scope);
48 typeRef.resolvedType = this.resolvedType;
49 if (!this.resolvedType.isValidBinding()) {
50 scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers());
53 if (isTypeUseDeprecated(this.resolvedType, scope)) {
54 scope.problemReporter().javadocDeprecatedType(this.resolvedType, typeRef, scope.getDeclarationModifiers());
57 return this.resolvedType;
64 public StringBuffer printExpression(int indent, StringBuffer output) {
65 if (this.argument == null) {
66 if (this.token != null) {
67 output.append(this.token);
71 this.argument.print(indent, output);
76 public void resolve(BlockScope scope) {
77 if (this.argument != null) {
78 this.argument.resolve(scope);
82 public TypeBinding resolveType(BlockScope scope) {
83 return internalResolveType(scope);
86 public TypeBinding resolveType(ClassScope scope) {
87 return internalResolveType(scope);
91 * Redefine to capture javadoc specific signatures
92 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
94 public void traverse(ASTVisitor visitor, BlockScope blockScope) {
95 if (visitor.visit(this, blockScope)) {
96 if (this.argument != null) {
97 this.argument.traverse(visitor, blockScope);
100 visitor.endVisit(this, blockScope);