KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > lookup > VariableBinding


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.lookup;
12
13 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14 import org.eclipse.jdt.internal.compiler.impl.Constant;
15
16 public abstract class VariableBinding extends Binding {
17     
18     public int modifiers;
19     public TypeBinding type;
20     public char[] name;
21     protected Constant constant;
22     public int id; // for flow-analysis (position in flowInfo bit vector)
23
public long tagBits;
24
25     public VariableBinding(char[] name, TypeBinding type, int modifiers, Constant constant) {
26         this.name = name;
27         this.type = type;
28         this.modifiers = modifiers;
29         this.constant = constant;
30     }
31     
32     public Constant constant() {
33         return this.constant;
34     }
35
36     public abstract AnnotationBinding[] getAnnotations();
37
38     public final boolean isBlankFinal(){
39         return (modifiers & ExtraCompilerModifiers.AccBlankFinal) != 0;
40     }
41     /* Answer true if the receiver is final and cannot be changed
42     */

43     
44     public final boolean isFinal() {
45         return (modifiers & ClassFileConstants.AccFinal) != 0;
46     }
47     public char[] readableName() {
48         return name;
49     }
50     public void setConstant(Constant constant) {
51         this.constant = constant;
52     }
53     public String JavaDoc toString() {
54         String JavaDoc s = (type != null) ? type.debugName() : "UNDEFINED TYPE"; //$NON-NLS-1$
55
s += " "; //$NON-NLS-1$
56
s += (name != null) ? new String JavaDoc(name) : "UNNAMED FIELD"; //$NON-NLS-1$
57
return s;
58     }
59 }
60
Popular Tags