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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.lookup;
13 import org.eclipse.jdt.internal.compiler.impl.Constant;
15 public abstract class VariableBinding extends Binding {
18 public TypeBinding type;
20 private Constant constant;
21 public int id; // for flow-analysis (position in flowInfo bit vector)
24 public VariableBinding(char[] name, TypeBinding type, int modifiers, Constant constant) {
27 this.modifiers = modifiers;
28 this.constant = constant;
31 public Constant constant() {
35 public final boolean isBlankFinal(){
36 return (modifiers & AccBlankFinal) != 0;
38 /* Answer true if the receiver is final and cannot be changed
41 public boolean isConstantValue() {
42 return constant != Constant.NotAConstant;
45 public final boolean isFinal() {
46 return (modifiers & AccFinal) != 0;
48 public char[] readableName() {
51 public void setConstant(Constant constant) {
52 this.constant = constant;
54 public String toString() {
55 String s = (type != null) ? type.debugName() : "UNDEFINED TYPE"; //$NON-NLS-1$
56 s += " "; //$NON-NLS-1$
57 s += (name != null) ? new String(name) : "UNNAMED FIELD"; //$NON-NLS-1$