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.lookup.*;
17 public class JavadocReturnStatement extends ReturnStatement {
18 public char[] description;
19 public boolean empty = true;
21 public JavadocReturnStatement(int s, int e, char[] descr) {
23 this.description = descr;
24 this.bits |= InsideJavadoc;
28 * @see org.eclipse.jdt.internal.compiler.ast.Statement#resolve(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
30 public void resolve(BlockScope scope) {
31 MethodScope methodScope = scope.methodScope();
32 MethodBinding methodBinding = null;
33 TypeBinding methodType =
34 (methodScope.referenceContext instanceof AbstractMethodDeclaration)
35 ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
37 : methodBinding.returnType)
39 if (methodType == null || methodType == VoidBinding) {
40 scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd);
41 } else if (this.empty) {
42 scope.problemReporter().javadocEmptyReturnTag(this.sourceStart, this.sourceEnd);
47 * @see org.eclipse.jdt.internal.compiler.ast.Statement#printStatement(int, java.lang.StringBuffer)
49 public StringBuffer printStatement(int tab, StringBuffer output) {
50 printIndent(tab, output).append("return"); //$NON-NLS-1$
51 if (description != null )
52 output.append(' ').append(description);
57 * Redefine to capture javadoc specific signatures
58 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
60 public void traverse(ASTVisitor visitor, BlockScope scope) {
61 visitor.visit(this, scope);
62 visitor.endVisit(this, scope);