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 /**
16  * Binding denoting a field after type substitution got performed.
17  * On parameterized type bindings, all fields got substituted, regardless whether
18  * their signature did involve generics or not, so as to get the proper declaringClass for
19  * these fields.
20  */
21 public class ParameterizedFieldBinding extends FieldBinding {
22 
23     public FieldBinding originalField;
24 
ParameterizedFieldBinding(ParameterizedTypeBinding parameterizedDeclaringClass, FieldBinding originalField)25 	public ParameterizedFieldBinding(ParameterizedTypeBinding parameterizedDeclaringClass, FieldBinding originalField) {
26 	    super (
27 	            originalField.name,
28 	            originalField.isStatic() ? originalField.type : parameterizedDeclaringClass.substitute(originalField.type),
29 	            originalField.modifiers,
30 	            parameterizedDeclaringClass,
31 	            null);
32 	    this.originalField = originalField;
33 	}
34 	/**
35 	 * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant()
36 	 */
constant()37 	public Constant constant() {
38 		return this.originalField.constant();
39 	}
40 	/**
41 	 * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#isConstantValue()
42 	 */
isConstantValue()43 	public boolean isConstantValue() {
44 		return this.originalField.isConstantValue();
45 	}
46 	/**
47 	 * @see org.eclipse.jdt.internal.compiler.lookup.FieldBinding#original()
48 	 */
original()49 	public FieldBinding original() {
50 		return this.originalField.original();
51 	}
52 	/**
53 	 * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant()
54 	 */
setConstant(Constant constant)55 	public void setConstant(Constant constant) {
56 		this.originalField.setConstant(constant);
57 	}
58 }
59 
60