KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
14  * Specific local variable location used to:
15  * - either provide emulation for outer local variables used from within innerclass constructs,
16  * - or provide emulation to enclosing instances.
17  * When it is mapping to an outer local variable, this actual outer local is accessible through
18  * the public field #actualOuterLocalVariable.
19  *
20  * Such a synthetic argument binding will be inserted in all constructors of local innertypes before
21  * the user arguments.
22  */

23
24 import org.eclipse.jdt.core.compiler.CharOperation;
25 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
26
27 public class SyntheticArgumentBinding extends LocalVariableBinding {
28
29     {
30         this.tagBits |= TagBits.IsArgument;
31         this.useFlag = USED;
32     }
33     
34     // if the argument is mapping to an outer local variable, this denotes the outer actual variable
35
public LocalVariableBinding actualOuterLocalVariable;
36     // if the argument has a matching synthetic field
37
public FieldBinding matchingField;
38     
39     public SyntheticArgumentBinding(LocalVariableBinding actualOuterLocalVariable) {
40
41         super(
42             CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name),
43             actualOuterLocalVariable.type,
44             ClassFileConstants.AccFinal,
45             true);
46         this.actualOuterLocalVariable = actualOuterLocalVariable;
47     }
48
49     public SyntheticArgumentBinding(ReferenceBinding enclosingType) {
50
51         super(
52             CharOperation.concat(
53                 TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
54                 String.valueOf(enclosingType.depth()).toCharArray()),
55             enclosingType,
56             ClassFileConstants.AccFinal,
57             true);
58     }
59 }
60
Popular Tags