KickJava   Java API By Example, From Geeks To Geeks.

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


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 public class JavadocSingleNameReference extends SingleNameReference {
17
18     public int tagSourceStart, tagSourceEnd;
19
20     public JavadocSingleNameReference(char[] source, long pos, int tagStart, int tagEnd) {
21         super(source, pos);
22         this.tagSourceStart = tagStart;
23         this.tagSourceEnd = tagEnd;
24         this.bits |= InsideJavadoc;
25     }
26
27     public void resolve(BlockScope scope) {
28         resolve(scope, true, scope.compilerOptions().reportUnusedParameterIncludeDocCommentReference);
29     }
30
31     /**
32      * Resolve without warnings
33      */

34     public void resolve(BlockScope scope, boolean warn, boolean considerParamRefAsUsage) {
35         
36         LocalVariableBinding variableBinding = scope.findVariable(this.token);
37         if (variableBinding != null && variableBinding.isValidBinding() && ((variableBinding.tagBits & TagBits.IsArgument) != 0)) {
38             this.binding = variableBinding;
39             if (considerParamRefAsUsage) {
40                 variableBinding.useFlag = LocalVariableBinding.USED;
41             }
42             return;
43         }
44         if (warn) {
45             try {
46                 MethodScope methScope = (MethodScope) scope;
47                 scope.problemReporter().javadocUndeclaredParamTagName(this.token, this.sourceStart, this.sourceEnd, methScope.referenceMethod().modifiers);
48             }
49             catch (Exception JavaDoc e) {
50                 scope.problemReporter().javadocUndeclaredParamTagName(this.token, this.sourceStart, this.sourceEnd, -1);
51             }
52         }
53     }
54
55     /* (non-Javadoc)
56      * Redefine to capture javadoc specific signatures
57      * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
58      */

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

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