added -J option to preserve unmodified files in preexisting jarfile
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / lookup / VariableBinding.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.lookup;
12
13 import org.eclipse.jdt.internal.compiler.impl.Constant;
14
15 public abstract class VariableBinding extends Binding {
16     
17         public int modifiers;
18         public TypeBinding type;
19         public char[] name;
20         private Constant constant;
21         public int id; // for flow-analysis (position in flowInfo bit vector)
22         public long tagBits;
23
24         public VariableBinding(char[] name, TypeBinding type, int modifiers, Constant constant) {
25                 this.name = name;
26                 this.type = type;
27                 this.modifiers = modifiers;
28                 this.constant = constant;
29         }
30         
31         public Constant constant() {
32                 return this.constant;
33         }
34         
35         public final boolean isBlankFinal(){
36                 return (modifiers & AccBlankFinal) != 0;
37         }
38         /* Answer true if the receiver is final and cannot be changed
39         */
40         
41         public boolean isConstantValue() {
42                 return constant != Constant.NotAConstant;
43         }
44         
45         public final boolean isFinal() {
46                 return (modifiers & AccFinal) != 0;
47         }
48         public char[] readableName() {
49                 return name;
50         }
51         public void setConstant(Constant constant) {
52                 this.constant = constant;
53         }
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$
58                 return s;
59         }
60 }