KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > dom > BindingResolver


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
12 package org.eclipse.jdt.core.dom;
13
14 import org.eclipse.jdt.core.WorkingCopyOwner;
15 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16 import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
17 import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair;
18 import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
19
20 /**
21  * A binding resolver is an internal mechanism for figuring out the binding
22  * for a major declaration, type, or name reference. This also handles
23  * the creation and mapping between annotations and the ast nodes that define them.
24  * <p>
25  * The default implementation serves as the default binding resolver
26  * that does no resolving whatsoever. Internal subclasses do all the real work.
27  * </p>
28  *
29  * @see AST#getBindingResolver
30  */

31 class BindingResolver {
32
33     /**
34      * Creates a binding resolver.
35      */

36     BindingResolver() {
37         // default implementation: do nothing
38
}
39
40     /**
41      * Finds the corresponding AST node from which the given binding originated.
42      * Returns <code>null</code> if the binding does not correspond to any node
43      * in the compilation unit.
44      * <p>
45      * The following table indicates the expected node type for the various
46      * different kinds of bindings:
47      * <ul>
48      * <li></li>
49      * <li>package - a <code>PackageDeclaration</code></li>
50      * <li>class or interface - a <code>TypeDeclaration</code> or a
51      * <code>ClassInstanceCreation</code> (for anonymous classes) </li>
52      * <li>primitive type - none</li>
53      * <li>array type - none</li>
54      * <li>field - a <code>VariableDeclarationFragment</code> in a
55      * <code>FieldDeclaration</code> </li>
56      * <li>local variable - a <code>SingleVariableDeclaration</code>, or
57      * a <code>VariableDeclarationFragment</code> in a
58      * <code>VariableDeclarationStatement</code> or
59      * <code>VariableDeclarationExpression</code></li>
60      * <li>method - a <code>MethodDeclaration</code> </li>
61      * <li>constructor - a <code>MethodDeclaration</code> </li>
62      * <li>annotation type - an <code>AnnotationTypeDeclaration</code>
63      * <li>annotation type member - an <code>AnnotationTypeMemberDeclaration</code>
64      * </ul>
65      * </p>
66      * <p>
67      * The implementation of <code>CompilationUnit.findDeclaringNode</code>
68      * forwards to this method.
69      * </p>
70      * <p>
71      * The default implementation of this method returns <code>null</code>.
72      * Subclasses may reimplement.
73      * </p>
74      *
75      * @param binding the binding
76      * @return the corresponding node where the bindings is declared,
77      * or <code>null</code> if none
78      */

79     ASTNode findDeclaringNode(IBinding binding) {
80         return null;
81     }
82
83     /**
84      * Finds the corresponding AST node from which the given binding key originated.
85      *
86      * The default implementation of this method returns <code>null</code>.
87      * Subclasses may reimplement.
88      * </p>
89      *
90      * @param bindingKey the binding key
91      * @return the corresponding node where the bindings is declared,
92      * or <code>null</code> if none
93      */

94     ASTNode findDeclaringNode(String JavaDoc bindingKey) {
95         return null;
96     }
97
98     /**
99      * Finds the corresponding AST node from which the given annotation instance originated.
100      *
101      * The default implementation of this method returns <code>null</code>.
102      * Subclasses may reimplement.
103      * </p>
104      *
105      * @param instance the dom annotation
106      * @return the corresponding node where the bindings is declared,
107      * or <code>null</code> if none
108      */

109     ASTNode findDeclaringNode(IAnnotationBinding instance) {
110         return null;
111     }
112
113     /**
114      * Allows the user to get information about the given old/new pair of
115      * AST nodes.
116      * <p>
117      * The default implementation of this method does nothing.
118      * Subclasses may reimplement.
119      * </p>
120      *
121      * @param currentNode the new node
122      * @return org.eclipse.jdt.internal.compiler.ast.ASTNode
123      */

124     org.eclipse.jdt.internal.compiler.ast.ASTNode getCorrespondingNode(ASTNode currentNode) {
125         return null;
126     }
127
128     /**
129      * Returns the new method binding corresponding to the given old method binding.
130      * <p>
131      * The default implementation of this method returns <code>null</code>.
132      * Subclasses may reimplement.
133      * </p>
134      *
135      * @param methodBinding the old method binding
136      * @return the new method binding
137      */

138     IMethodBinding getMethodBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding) {
139         return null;
140     }
141
142     /**
143      * Returns the new member value pair binding corresponding to the given old value pair binding.
144      * <p>
145      * The default implementation of this method returns <code>null</code>.
146      * Subclasses may reimplement.
147      * </p>
148      *
149      * @param valuePair the old value pair binding
150      * @return the new member value pair binding
151      */

152     IMemberValuePairBinding getMemberValuePairBinding(ElementValuePair valuePair) {
153         return null;
154     }
155
156     /**
157      * Returns the new package binding corresponding to the given old package binding.
158      * <p>
159      * The default implementation of this method returns <code>null</code>.
160      * Subclasses may reimplement.
161      * </p>
162      *
163      * @param packageBinding the old package binding
164      * @return the new package binding
165      */

166     IPackageBinding getPackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding packageBinding) {
167         return null;
168     }
169
170     /**
171      * Returns the new type binding corresponding to the given old type binding.
172      * <p>
173      * The default implementation of this method returns <code>null</code>.
174      * Subclasses may reimplement.
175      * </p>
176      *
177      * @param referenceBinding the old type binding
178      * @return the new type binding
179      */

180     ITypeBinding getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.TypeBinding referenceBinding) {
181         return null;
182     }
183
184
185     /**
186      * Returns the new type binding corresponding to the given variableDeclaration.
187      * This is used for recovered binding only.
188      * <p>
189      * The default implementation of this method returns <code>null</code>.
190      * Subclasses may reimplement.
191      * </p>
192      *
193      * @param variableDeclaration the given variable declaration
194      * @return the new type binding
195      */

196     ITypeBinding getTypeBinding(VariableDeclaration variableDeclaration) {
197         return null;
198     }
199
200     /**
201      * Returns the new type binding corresponding to the given type. This is used for recovered binding
202      * only.
203      * <p>
204      * The default implementation of this method returns <code>null</code>.
205      * Subclasses may reimplement.
206      * </p>
207      *
208      * @param type the given type
209      * @return the new type binding
210      */

211     ITypeBinding getTypeBinding(Type type) {
212         return null;
213     }
214
215     /**
216      * Returns the new type binding corresponding to the given recovered type binding.
217      * <p>
218      * The default implementation of this method returns <code>null</code>.
219      * Subclasses may reimplement.
220      * </p>
221      *
222      * @param recoveredTypeBinding the recovered type binding
223      * @param dimensions the dimensions to add the to given type binding dimensions
224      * @return the new type binding
225      */

226     ITypeBinding getTypeBinding(RecoveredTypeBinding recoveredTypeBinding, int dimensions) {
227         return null;
228     }
229
230     /**
231      * Returns the new variable binding corresponding to the given old variable binding.
232      * <p>
233      * The default implementation of this method returns <code>null</code>.
234      * Subclasses may reimplement.
235      * </p>
236      *
237      * @param binding the old variable binding
238      * @return the new variable binding
239      */

240     IVariableBinding getVariableBinding(org.eclipse.jdt.internal.compiler.lookup.VariableBinding binding) {
241         return null;
242     }
243
244     /**
245      * Return the working copy owner for the receiver.
246      * <p>
247      * The default implementation of this method returns <code>null</code>.
248      * Subclasses may reimplement.
249      * </p>
250      * @return the working copy owner for the receiver
251      */

252     public WorkingCopyOwner getWorkingCopyOwner() {
253         return null;
254     }
255
256     /**
257      * Return the new annotation corresponding to the given old annotation
258      * <p>
259      * The default implementation of this method returns <code>null</code>
260      * Subclasses may reimplement.
261      * </p>
262      *
263      * @param instance the old annotation
264      * @return the new DOM annotation
265      */

266     IAnnotationBinding getAnnotationInstance(org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding instance) {
267         return null;
268     }
269
270     boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
271         return false;
272     }
273
274     boolean isResolvedTypeInferredFromExpectedType(SuperMethodInvocation methodInvocation) {
275         return false;
276     }
277
278     /**
279      * Returns the compiler lookup environment used by this binding resolver.
280      * Returns <code>null</code> if none.
281      *
282      * @return the lookup environment used by this resolver, or <code>null</code> if none.
283      */

284     LookupEnvironment lookupEnvironment() {
285         return null;
286     }
287
288     /**
289      * This method is used to record the scope and its corresponding node.
290      * <p>
291      * The default implementation of this method does nothing.
292      * Subclasses may reimplement.
293      * </p>
294      * @param astNode
295      */

296     void recordScope(ASTNode astNode, BlockScope blockScope) {
297         // default implementation: do nothing
298
}
299
300     /**
301      * Returns whether this expression node is the site of a boxing
302      * conversion (JLS3 5.1.7). This information is available only
303      * when bindings are requested when the AST is being built.
304      *
305      * @return <code>true</code> if this expression is the site of a
306      * boxing conversion, or <code>false</code> if either no boxing conversion
307      * is involved or if bindings were not requested when the AST was created
308      * @since 3.1
309      */

310     boolean resolveBoxing(Expression expression) {
311         return false;
312     }
313
314     /**
315      * Returns whether this expression node is the site of an unboxing
316      * conversion (JLS3 5.1.8). This information is available only
317      * when bindings are requested when the AST is being built.
318      *
319      * @return <code>true</code> if this expression is the site of an
320      * unboxing conversion, or <code>false</code> if either no unboxing
321      * conversion is involved or if bindings were not requested when the
322      * AST was created
323      * @since 3.1
324      */

325     boolean resolveUnboxing(Expression expression) {
326         return false;
327     }
328
329     /**
330      * Resolves and returns the compile-time constant expression value as
331      * specified in JLS2 15.28, if this expression has one. Constant expression
332      * values are unavailable unless bindings are requested when the AST is
333      * being built. If the type of the value is a primitive type, the result
334      * is the boxed equivalent (i.e., int returned as an <code>Integer</code>);
335      * if the type of the value is <code>String</code>, the result is the string
336      * itself. If the expression does not have a compile-time constant expression
337      * value, the result is <code>null</code>.
338      * <p>
339      * Resolving constant expressions takes into account the value of simple
340      * and qualified names that refer to constant variables (JLS2 4.12.4).
341      * </p>
342      * <p>
343      * Note 1: enum constants are not considered constant expressions either.
344      * The result is always <code>null</code> for these.
345      * </p>
346      * <p>
347      * Note 2: Compile-time constant expressions cannot denote <code>null</code>.
348      * So technically {@link NullLiteral} nodes are not constant expressions.
349      * The result is <code>null</code> for these nonetheless.
350      * </p>
351      *
352      * @return the constant expression value, or <code>null</code> if this
353      * expression has no constant expression value or if bindings were not
354      * requested when the AST was created
355      * @since 3.1
356      */

357     Object JavaDoc resolveConstantExpressionValue(Expression expression) {
358         return null;
359     }
360
361     /**
362      * Resolves and returns the binding for the constructor being invoked.
363      * <p>
364      * The implementation of
365      * <code>ClassInstanceCreation.resolveConstructor</code>
366      * forwards to this method. Which constructor is invoked is often a function
367      * of the context in which the expression node is embedded as well as
368      * the expression subtree itself.
369      * </p>
370      * <p>
371      * The default implementation of this method returns <code>null</code>.
372      * Subclasses may reimplement.
373      * </p>
374      *
375      * @param expression the expression of interest
376      * @return the binding for the constructor being invoked, or
377      * <code>null</code> if no binding is available
378      */

379     IMethodBinding resolveConstructor(ClassInstanceCreation expression) {
380         return null;
381     }
382
383     /**
384      * Resolves and returns the binding for the constructor being invoked.
385      * <p>
386      * The implementation of
387      * <code>ConstructorInvocation.resolveConstructor</code>
388      * forwards to this method. Which constructor is invoked is often a function
389      * of the context in which the expression node is embedded as well as
390      * the expression subtree itself.
391      * </p>
392      * <p>
393      * The default implementation of this method returns <code>null</code>.
394      * Subclasses may reimplement.
395      * </p>
396      *
397      * @param expression the expression of interest
398      * @return the binding for the constructor being invoked, or
399      * <code>null</code> if no binding is available
400      */

401     IMethodBinding resolveConstructor(ConstructorInvocation expression) {
402         return null;
403     }
404     /**
405      * Resolves and returns the binding for the constructor being invoked.
406      * <p>
407      * The implementation of
408      * <code>ConstructorInvocation.resolveConstructor</code>
409      * forwards to this method. Which constructor is invoked is often a function
410      * of the context in which the expression node is embedded as well as
411      * the expression subtree itself.
412      * </p>
413      * <p>
414      * The default implementation of this method returns <code>null</code>.
415      * Subclasses may reimplement.
416      * </p>
417      *
418      * @param enumConstantDeclaration the enum constant declaration of interest
419      * @return the binding for the constructor being invoked, or
420      * <code>null</code> if no binding is available
421      */

422     IMethodBinding resolveConstructor(EnumConstantDeclaration enumConstantDeclaration) {
423         return null;
424     }
425     /**
426      * Resolves and returns the binding for the constructor being invoked.
427      * <p>
428      * The implementation of
429      * <code>SuperConstructorInvocation.resolveConstructor</code>
430      * forwards to this method. Which constructor is invoked is often a function
431      * of the context in which the expression node is embedded as well as
432      * the expression subtree itself.
433      * </p>
434      * <p>
435      * The default implementation of this method returns <code>null</code>.
436      * Subclasses may reimplement.
437      * </p>
438      *
439      * @param expression the expression of interest
440      * @return the binding for the constructor being invoked, or
441      * <code>null</code> if no binding is available
442      */

443     IMethodBinding resolveConstructor(SuperConstructorInvocation expression) {
444         return null;
445     }
446     /**
447      * Resolves the type of the given expression and returns the type binding
448      * for it.
449      * <p>
450      * The implementation of <code>Expression.resolveTypeBinding</code>
451      * forwards to this method. The result is often a function of the context
452      * in which the expression node is embedded as well as the expression
453      * subtree itself.
454      * </p>
455      * <p>
456      * The default implementation of this method returns <code>null</code>.
457      * Subclasses may reimplement.
458      * </p>
459      *
460      * @param expression the expression whose type is of interest
461      * @return the binding for the type of the given expression, or
462      * <code>null</code> if no binding is available
463      */

464     ITypeBinding resolveExpressionType(Expression expression) {
465         return null;
466     }
467
468     /**
469      * Resolves the given field access and returns the binding for it.
470      * <p>
471      * The implementation of <code>FieldAccess.resolveFieldBinding</code>
472      * forwards to this method. How the field resolves is often a function of
473      * the context in which the field access node is embedded as well as
474      * the field access subtree itself.
475      * </p>
476      * <p>
477      * The default implementation of this method returns <code>null</code>.
478      * Subclasses may reimplement.
479      * </p>
480      *
481      * @param fieldAccess the field access of interest
482      * @return the binding for the given field access, or
483      * <code>null</code> if no binding is available
484      */

485     IVariableBinding resolveField(FieldAccess fieldAccess) {
486         return null;
487     }
488
489     /**
490      * Resolves the given super field access and returns the binding for it.
491      * <p>
492      * The implementation of <code>SuperFieldAccess.resolveFieldBinding</code>
493      * forwards to this method. How the field resolves is often a function of
494      * the context in which the super field access node is embedded as well as
495      * the super field access subtree itself.
496      * </p>
497      * <p>
498      * The default implementation of this method returns <code>null</code>.
499      * Subclasses may reimplement.
500      * </p>
501      *
502      * @param fieldAccess the super field access of interest
503      * @return the binding for the given field access, or
504      * <code>null</code> if no binding is available
505      */

506     IVariableBinding resolveField(SuperFieldAccess fieldAccess) {
507         return null;
508     }
509
510     /**
511      * Resolves the given import declaration and returns the binding for it.
512      * <p>
513      * The implementation of <code>ImportDeclaration.resolveBinding</code>
514      * forwards to this method.
515      * </p>
516      * <p>
517      * The default implementation of this method returns <code>null</code>.
518      * Subclasses may reimplement.
519      * </p>
520      *
521      * @param importDeclaration the import declaration of interest
522      * @return the binding for the given package declaration, or
523      * the package binding (for on-demand imports) or type binding
524      * (for single-type imports), or <code>null</code> if no binding is
525      * available
526      */

527     IBinding resolveImport(ImportDeclaration importDeclaration) {
528         return null;
529     }
530
531     /**
532      * Resolves the given annotation type declaration and returns the binding
533      * for it.
534      * <p>
535      * The implementation of <code>AnnotationTypeMemberDeclaration.resolveBinding</code>
536      * forwards to this method. How the declaration resolves is often a
537      * function of the context in which the declaration node is embedded as well
538      * as the declaration subtree itself.
539      * </p>
540      * <p>
541      * The default implementation of this method returns <code>null</code>.
542      * Subclasses may reimplement.
543      * </p>
544      *
545      * @param member the annotation type member declaration of interest
546      * @return the binding for the given annotation type member declaration, or <code>null</code>
547      * if no binding is available
548      * @since 3.0
549      */

550     IMethodBinding resolveMember(AnnotationTypeMemberDeclaration member) {
551         return null;
552     }
553
554     /**
555      * Resolves the given method declaration and returns the binding for it.
556      * <p>
557      * The implementation of <code>MethodDeclaration.resolveBinding</code>
558      * forwards to this method. How the method resolves is often a function of
559      * the context in which the method declaration node is embedded as well as
560      * the method declaration subtree itself.
561      * </p>
562      * <p>
563      * The default implementation of this method returns <code>null</code>.
564      * Subclasses may reimplement.
565      * </p>
566      *
567      * @param method the method or constructor declaration of interest
568      * @return the binding for the given method declaration, or
569      * <code>null</code> if no binding is available
570      */

571     IMethodBinding resolveMethod(MethodDeclaration method) {
572         return null;
573     }
574
575     /**
576      * Resolves the given method invocation and returns the binding for it.
577      * <p>
578      * The implementation of <code>MethodInvocation.resolveMethodBinding</code>
579      * forwards to this method. How the method resolves is often a function of
580      * the context in which the method invocation node is embedded as well as
581      * the method invocation subtree itself.
582      * </p>
583      * <p>
584      * The default implementation of this method returns <code>null</code>.
585      * Subclasses may reimplement.
586      * </p>
587      *
588      * @param method the method invocation of interest
589      * @return the binding for the given method invocation, or
590      * <code>null</code> if no binding is available
591      */

592     IMethodBinding resolveMethod(MethodInvocation method) {
593         return null;
594     }
595
596     /**
597      * Resolves the given method invocation and returns the binding for it.
598      * <p>
599      * The implementation of <code>MethodInvocation.resolveMethodBinding</code>
600      * forwards to this method. How the method resolves is often a function of
601      * the context in which the method invocation node is embedded as well as
602      * the method invocation subtree itself.
603      * </p>
604      * <p>
605      * The default implementation of this method returns <code>null</code>.
606      * Subclasses may reimplement.
607      * </p>
608      *
609      * @param method the method invocation of interest
610      * @return the binding for the given method invocation, or
611      * <code>null</code> if no binding is available
612      */

613     IMethodBinding resolveMethod(SuperMethodInvocation method) {
614         return null;
615     }
616
617     /**
618      * Resolves the given name and returns the type binding for it.
619      * <p>
620      * The implementation of <code>Name.resolveBinding</code> forwards to
621      * this method. How the name resolves is often a function of the context
622      * in which the name node is embedded as well as the name itself.
623      * </p>
624      * <p>
625      * The default implementation of this method returns <code>null</code>.
626      * Subclasses may reimplement.
627      * </p>
628      *
629      * @param name the name of interest
630      * @return the binding for the name, or <code>null</code> if no binding is
631      * available
632      */

633     IBinding resolveName(Name name) {
634         return null;
635     }
636
637     /**
638      * Resolves the given package declaration and returns the binding for it.
639      * <p>
640      * The implementation of <code>PackageDeclaration.resolveBinding</code>
641      * forwards to this method.
642      * </p>
643      * <p>
644      * The default implementation of this method returns <code>null</code>.
645      * Subclasses may reimplement.
646      * </p>
647      *
648      * @param pkg the package declaration of interest
649      * @return the binding for the given package declaration, or
650      * <code>null</code> if no binding is available
651      */

652     IPackageBinding resolvePackage(PackageDeclaration pkg) {
653         return null;
654     }
655
656     /**
657      * Resolves the given reference and returns the binding for it.
658      * <p>
659      * The implementation of <code>MemberRef.resolveBinding</code> forwards to
660      * this method. How the name resolves is often a function of the context
661      * in which the name node is embedded as well as the name itself.
662      * </p>
663      * <p>
664      * The default implementation of this method returns <code>null</code>.
665      * Subclasses may reimplement.
666      * </p>
667      *
668      * @param ref the reference of interest
669      * @return the binding for the reference, or <code>null</code> if no binding is
670      * available
671      * @since 3.0
672      */

673     IBinding resolveReference(MemberRef ref) {
674         return null;
675     }
676
677     /**
678      * Resolves the given member value pair and returns the binding for it.
679      * <p>
680      * The implementation of <code>MemberValuePair.resolveMemberValuePairBinding</code> forwards to
681      * this method. How the name resolves is often a function of the context
682      * in which the name node is embedded as well as the name itself.
683      * </p>
684      * <p>
685      * The default implementation of this method returns <code>null</code>.
686      * Subclasses may reimplement.
687      * </p>
688      *
689      * @param memberValuePair the member value pair of interest
690      * @return the binding for the member value pair, or <code>null</code> if no binding is
691      * available
692      * @since 3.2
693      */

694     IMemberValuePairBinding resolveMemberValuePair(MemberValuePair memberValuePair) {
695         return null;
696     }
697
698     /**
699      * Resolves the given reference and returns the binding for it.
700      * <p>
701      * The implementation of <code>MethodRef.resolveBinding</code> forwards to
702      * this method. How the name resolves is often a function of the context
703      * in which the name node is embedded as well as the name itself.
704      * </p>
705      * <p>
706      * The default implementation of this method returns <code>null</code>.
707      * Subclasses may reimplement.
708      * </p>
709      *
710      * @param ref the reference of interest
711      * @return the binding for the reference, or <code>null</code> if no binding is
712      * available
713      * @since 3.0
714      */

715     IBinding resolveReference(MethodRef ref) {
716         return null;
717     }
718
719     /**
720      * Resolves the given annotation type declaration and returns the binding
721      * for it.
722      * <p>
723      * The implementation of <code>AnnotationTypeDeclaration.resolveBinding</code>
724      * forwards to this method. How the declaration resolves is often a
725      * function of the context in which the declaration node is embedded as well
726      * as the declaration subtree itself.
727      * </p>
728      * <p>
729      * The default implementation of this method returns <code>null</code>.
730      * Subclasses may reimplement.
731      * </p>
732      *
733      * @param type the annotation type declaration of interest
734      * @return the binding for the given annotation type declaration, or <code>null</code>
735      * if no binding is available
736      * @since 3.0
737      */

738     ITypeBinding resolveType(AnnotationTypeDeclaration type) {
739         return null;
740     }
741
742     /**
743      * Resolves the given anonymous class declaration and returns the binding
744      * for it.
745      * <p>
746      * The implementation of <code>AnonymousClassDeclaration.resolveBinding</code>
747      * forwards to this method. How the declaration resolves is often a
748      * function of the context in which the declaration node is embedded as well
749      * as the declaration subtree itself.
750      * </p>
751      * <p>
752      * The default implementation of this method returns <code>null</code>.
753      * Subclasses may reimplement.
754      * </p>
755      *
756      * @param type the anonymous class declaration of interest
757      * @return the binding for the given class declaration, or <code>null</code>
758      * if no binding is available
759      */

760     ITypeBinding resolveType(AnonymousClassDeclaration type) {
761         return null;
762     }
763
764     /**
765      * Resolves the given enum declaration and returns the binding
766      * for it.
767      * <p>
768      * The implementation of <code>EnumDeclaration.resolveBinding</code>
769      * forwards to this method. How the enum declaration resolves is often
770      * a function of the context in which the declaration node is embedded
771      * as well as the enum declaration subtree itself.
772      * </p>
773      * <p>
774      * The default implementation of this method returns <code>null</code>.
775      * Subclasses may reimplement.
776      * </p>
777      *
778      * @param type the enum declaration of interest
779      * @return the binding for the given enum declaration, or <code>null</code>
780      * if no binding is available
781      * @since 3.0
782      */

783     ITypeBinding resolveType(EnumDeclaration type) {
784         return null;
785     }
786
787     /**
788      * Resolves the given type and returns the type binding for it.
789      * <p>
790      * The implementation of <code>Type.resolveBinding</code>
791      * forwards to this method. How the type resolves is often a function
792      * of the context in which the type node is embedded as well as the type
793      * subtree itself.
794      * </p>
795      * <p>
796      * The default implementation of this method returns <code>null</code>.
797      * Subclasses may reimplement.
798      * </p>
799      *
800      * @param type the type of interest
801      * @return the binding for the given type, or <code>null</code>
802      * if no binding is available
803      */

804     ITypeBinding resolveType(Type type) {
805         return null;
806     }
807
808     /**
809      * Resolves the given class or interface declaration and returns the binding
810      * for it.
811      * <p>
812      * The implementation of <code>TypeDeclaration.resolveBinding</code>
813      * (and <code>TypeDeclarationStatement.resolveBinding</code>) forwards
814      * to this method. How the type declaration resolves is often a function of
815      * the context in which the type declaration node is embedded as well as the
816      * type declaration subtree itself.
817      * </p>
818      * <p>
819      * The default implementation of this method returns <code>null</code>.
820      * Subclasses may reimplement.
821      * </p>
822      *
823      * @param type the class or interface declaration of interest
824      * @return the binding for the given type declaration, or <code>null</code>
825      * if no binding is available
826      */

827     ITypeBinding resolveType(TypeDeclaration type) {
828         return null;
829     }
830
831     /**
832      * Resolves the given type parameter and returns the type binding for the
833      * type parameter.
834      * <p>
835      * The implementation of <code>TypeParameter.resolveBinding</code>
836      * forwards to this method. How the declaration resolves is often a
837      * function of the context in which the declaration node is embedded as well
838      * as the declaration subtree itself.
839      * </p>
840      * <p>
841      * The default implementation of this method returns <code>null</code>.
842      * Subclasses may reimplement.
843      * </p>
844      *
845      * @param typeParameter the type paramter of interest
846      * @return the binding for the given type parameter, or <code>null</code>
847      * if no binding is available
848      * @since 3.1
849      */

850     ITypeBinding resolveTypeParameter(TypeParameter typeParameter) {
851         return null;
852     }
853
854     /**
855      * Resolves the given enum constant declaration and returns the binding for
856      * the field.
857      * <p>
858      * The implementation of <code>EnumConstantDeclaration.resolveVariable</code>
859      * forwards to this method.
860      * </p>
861      * <p>
862      * The default implementation of this method returns <code>null</code>.
863      * Subclasses may reimplement.
864      * </p>
865      *
866      * @param enumConstant the enum constant declaration of interest
867      * @return the field binding for the given enum constant declaration, or
868      * <code>null</code> if no binding is available
869      * @since 3.0
870      */

871     IVariableBinding resolveVariable(EnumConstantDeclaration enumConstant) {
872         return null;
873     }
874
875     /**
876      * Resolves the given variable declaration and returns the binding for it.
877      * <p>
878      * The implementation of <code>VariableDeclaration.resolveBinding</code>
879      * forwards to this method. How the variable declaration resolves is often
880      * a function of the context in which the variable declaration node is
881      * embedded as well as the variable declaration subtree itself. VariableDeclaration
882      * declarations used as local variable, formal parameter and exception
883      * variables resolve to local variable bindings; variable declarations
884      * used to declare fields resolve to field bindings.
885      * </p>
886      * <p>
887      * The default implementation of this method returns <code>null</code>.
888      * Subclasses may reimplement.
889      * </p>
890      *
891      * @param variable the variable declaration of interest
892      * @return the binding for the given variable declaration, or
893      * <code>null</code> if no binding is available
894      */

895     IVariableBinding resolveVariable(VariableDeclaration variable) {
896         return null;
897     }
898
899     /**
900      * Resolves the given well known type by name and returns the type binding
901      * for it.
902      * <p>
903      * The implementation of <code>AST.resolveWellKnownType</code>
904      * forwards to this method.
905      * </p>
906      * <p>
907      * The default implementation of this method returns <code>null</code>.
908      * Subclasses may reimplement.
909      * </p>
910      *
911      * @param name the name of a well known type
912      * @return the corresponding type binding, or <code>null<code> if the
913      * named type is not considered well known or if no binding can be found
914      * for it
915      */

916     ITypeBinding resolveWellKnownType(String JavaDoc name) {
917         return null;
918     }
919
920     /**
921      * Resolves the given annotation instance and returns the DOM representation for it.
922      * <p>
923      * The implementation of {@link Annotation#resolveAnnotationBinding()}
924      * forwards to this method.
925      * </p>
926      * <p>
927      * The default implementation of this method returns <code>null</code>.
928      * Subclasses may reimplement.
929      * </p>
930      *
931      * @param annotation the annotation ast node of interest
932      * @return the DOM annotation representation for the given ast node, or
933      * <code>null</code> if none is available
934      */

935     IAnnotationBinding resolveAnnotation(Annotation annotation) {
936         return null;
937     }
938
939     /**
940      * Answer an array type binding with the given type binding and the given
941      * dimensions.
942      *
943      * <p>If the given type binding is an array binding, then the resulting dimensions is the given dimensions
944      * plus the existing dimensions of the array binding. Otherwise the resulting dimensions is the given
945      * dimensions.</p>
946      *
947      * <p>
948      * The default implementation of this method returns <code>null</code>.
949      * Subclasses may reimplement.
950      * </p>
951      *
952      * @param typeBinding the given type binding
953      * @param dimensions the given dimensions
954      * @return an array type binding with the given type binding and the given
955      * dimensions
956      * @throws IllegalArgumentException if the type binding represents the <code>void</code> type binding
957      */

958     ITypeBinding resolveArrayType(ITypeBinding typeBinding, int dimensions) {
959         return null;
960     }
961
962     /**
963      * Returns the compilation unit scope used by this binding resolver.
964      * Returns <code>null</code> if none.
965      *
966      * @return the compilation unit scope by this resolver, or <code>null</code> if none.
967      */

968     public CompilationUnitScope scope() {
969         return null;
970     }
971
972     /**
973      * Allows the user to store information about the given old/new pair of
974      * AST nodes.
975      * <p>
976      * The default implementation of this method does nothing.
977      * Subclasses may reimplement.
978      * </p>
979      *
980      * @param newNode the new AST node
981      * @param oldASTNode the old AST node
982      */

983     void store(ASTNode newNode, org.eclipse.jdt.internal.compiler.ast.ASTNode oldASTNode) {
984         // default implementation: do nothing
985
}
986
987     /**
988      * Allows the user to update information about the given old/new pair of
989      * AST nodes.
990      * <p>
991      * The default implementation of this method does nothing.
992      * Subclasses may reimplement.
993      * </p>
994      *
995      * @param node the old AST node
996      * @param newNode the new AST node
997      */

998     void updateKey(ASTNode node, ASTNode newNode) {
999         // default implementation: do nothing
1000
}
1001}
1002
Popular Tags