KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > ast > JavadocReturnStatement


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16
17 public class JavadocReturnStatement extends ReturnStatement {
18
19     public JavadocReturnStatement(int s, int e) {
20         super(null, s, e);
21         this.bits |= (ASTNode.InsideJavadoc | ASTNode.Empty);
22     }
23
24     /* (non-Javadoc)
25      * @see org.eclipse.jdt.internal.compiler.ast.Statement#resolve(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
26      */

27     public void resolve(BlockScope scope) {
28         MethodScope methodScope = scope.methodScope();
29         MethodBinding methodBinding = null;
30         TypeBinding methodType =
31             (methodScope.referenceContext instanceof AbstractMethodDeclaration)
32                 ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
33                     ? null
34                     : methodBinding.returnType)
35                 : TypeBinding.VOID;
36         if (methodType == null || methodType == TypeBinding.VOID) {
37             scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd);
38         } else if ((this.bits & ASTNode.Empty) != 0) {
39             scope.problemReporter().javadocEmptyReturnTag(this.sourceStart, this.sourceEnd, scope.getDeclarationModifiers());
40         }
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.jdt.internal.compiler.ast.Statement#printStatement(int, java.lang.StringBuffer)
45      */

46     public StringBuffer JavaDoc printStatement(int tab, StringBuffer JavaDoc output) {
47         printIndent(tab, output).append("return"); //$NON-NLS-1$
48
if ((this.bits & ASTNode.Empty) == 0)
49             output.append(' ').append(" <not empty>"); //$NON-NLS-1$
50
return output;
51     }
52
53     /* (non-Javadoc)
54      * Redefine to capture javadoc specific signatures
55      * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
56      */

57     public void traverse(ASTVisitor visitor, BlockScope scope) {
58         visitor.visit(this, scope);
59         visitor.endVisit(this, scope);
60     }
61     /* (non-Javadoc)
62      * Redefine to capture javadoc specific signatures
63      * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
64      */

65     public void traverse(ASTVisitor visitor, ClassScope scope) {
66         visitor.visit(this, scope);
67         visitor.endVisit(this, scope);
68     }
69 }
70
Popular Tags