added -J option to preserve unmodified files in preexisting jarfile
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / JavadocSingleNameReference.java
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
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);
29         }
30
31         /**
32          * Resolve without warnings
33          */
34         public void resolve(BlockScope scope, boolean warn) {
35                 
36                 LocalVariableBinding variableBinding = scope.findVariable(this.token);
37                 if (variableBinding != null && variableBinding.isValidBinding() && variableBinding.isArgument) {
38                         this.binding = variableBinding;
39                         return;
40                 }
41                 if (warn) {
42                         try {
43                                 MethodScope methScope = (MethodScope) scope;
44                                 scope.problemReporter().javadocUndeclaredParamTagName(this.token, this.sourceStart, this.sourceEnd, methScope.referenceMethod().modifiers);
45                         }
46                         catch (Exception e) {
47                                 scope.problemReporter().javadocUndeclaredParamTagName(this.token, this.sourceStart, this.sourceEnd, -1);
48                         }
49                 }
50         }
51
52         /* (non-Javadoc)
53          * Redefine to capture javadoc specific signatures
54          * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
55          */
56         public void traverse(ASTVisitor visitor, BlockScope scope) {
57                 visitor.visit(this, scope);
58                 visitor.endVisit(this, scope);
59         }
60 }