01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.lookup;
11:
12: import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
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:
25: public ParameterizedFieldBinding(
26: ParameterizedTypeBinding parameterizedDeclaringClass,
27: FieldBinding originalField) {
28: super (
29: originalField.name,
30: (originalField.modifiers & ClassFileConstants.AccEnum) != 0 ? parameterizedDeclaringClass // enum constant get paramType as its type
31: : (originalField.modifiers & ClassFileConstants.AccStatic) != 0 ? originalField.type // no subst for static field
32: : Scope.substitute(
33: parameterizedDeclaringClass,
34: originalField.type),
35: originalField.modifiers, parameterizedDeclaringClass,
36: null);
37: this .originalField = originalField;
38: this .tagBits = originalField.tagBits;
39: this .id = originalField.id;
40: }
41:
42: /**
43: * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant()
44: */
45: public Constant constant() {
46: return this .originalField.constant();
47: }
48:
49: /**
50: * @see org.eclipse.jdt.internal.compiler.lookup.FieldBinding#original()
51: */
52: public FieldBinding original() {
53: return this .originalField.original();
54: }
55:
56: /**
57: * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant()
58: */
59: public void setConstant(Constant constant) {
60: this.originalField.setConstant(constant);
61: }
62: }
|