KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > ISourceElementRequestor


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;
12
13 import org.eclipse.jdt.core.compiler.CategorizedProblem;
14
15 /*
16  * Part of the source element parser responsible for building the output. It
17  * gets notified of structural information as they are detected, relying on the
18  * requestor to assemble them together, based on the notifications it got.
19  *
20  * The structural investigation includes: - package statement - import
21  * statements - top-level types: package member, member types (member types of
22  * member types...) - fields - methods
23  *
24  * If reference information is requested, then all source constructs are
25  * investigated and type, field & method references are provided as well.
26  *
27  * Any (parsing) problem encountered is also provided.
28  *
29  * All positions are relative to the exact source fed to the parser.
30  *
31  * Elements which are complex are notified in two steps: - enter <Element> :
32  * once the element header has been identified - exit <Element> : once the
33  * element has been fully consumed
34  *
35  * other simpler elements (package, import) are read all at once: - accept
36  * <Element>
37  */

38
39 public interface ISourceElementRequestor {
40     
41     public static class TypeInfo {
42         public int declarationStart;
43         public int modifiers;
44         public char[] name;
45         public int nameSourceStart;
46         public int nameSourceEnd;
47         public char[] superclass;
48         public char[][] superinterfaces;
49         public TypeParameterInfo[] typeParameters;
50         public long[] annotationPositions;
51         public char[][] categories;
52         public boolean secondary;
53         public boolean anonymousMember;
54     }
55     
56     public static class TypeParameterInfo {
57         public int declarationStart;
58         public int declarationEnd;
59         public char[] name;
60         public int nameSourceStart;
61         public int nameSourceEnd;
62         public char[][] bounds;
63         public long[] annotationPositions;
64     }
65     
66     public static class MethodInfo {
67         public boolean isConstructor;
68         public boolean isAnnotation;
69         public int declarationStart;
70         public int modifiers;
71         public char[] returnType;
72         public char[] name;
73         public int nameSourceStart;
74         public int nameSourceEnd;
75         public char[][] parameterTypes;
76         public char[][] parameterNames;
77         public char[][] exceptionTypes;
78         public TypeParameterInfo[] typeParameters;
79         public long[] annotationPositions;
80         public char[][] categories;
81     }
82     
83     public static class FieldInfo {
84         public int declarationStart;
85         public int modifiers;
86         public char[] type;
87         public char[] name;
88         public int nameSourceStart;
89         public int nameSourceEnd;
90         public long[] annotationPositions;
91         public char[][] categories;
92     }
93     
94     void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
95     
96     void acceptFieldReference(char[] fieldName, int sourcePosition);
97     /**
98      * @param declarationStart
99      * This is the position of the first character of the import
100      * keyword.
101      * @param declarationEnd
102      * This is the position of the ';' ending the import statement or
103      * the end of the comment following the import.
104      * @param tokens
105      * This are the tokens of the import like specified in the source.
106      * @param onDemand
107      * set to true if the import is an import on demand (e.g. import
108      * java.io.*). False otherwise.
109      * @param modifiers
110      * can be set to static from 1.5 on.
111      */

112     void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers);
113
114     /*
115      * Table of line separator position. This table is passed once at the end of
116      * the parse action, so as to allow computation of normalized ranges.
117      *
118      * A line separator might corresponds to several characters in the source,
119      *
120      */

121     void acceptLineSeparatorPositions(int[] positions);
122
123     void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
124     
125     void acceptPackage(int declarationStart, int declarationEnd, char[] name);
126
127     void acceptProblem(CategorizedProblem problem);
128
129     void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
130
131     void acceptTypeReference(char[] typeName, int sourcePosition);
132
133     void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
134
135     void acceptUnknownReference(char[] name, int sourcePosition);
136
137     void enterCompilationUnit();
138
139     void enterConstructor(MethodInfo methodInfo);
140
141     void enterField(FieldInfo fieldInfo);
142     
143     void enterInitializer(int declarationStart, int modifiers);
144     
145     void enterMethod(MethodInfo methodInfo);
146     
147     void enterType(TypeInfo typeInfo);
148     
149     void exitCompilationUnit(int declarationEnd);
150     
151     void exitConstructor(int declarationEnd);
152
153     /*
154      * initializationStart denotes the source start of the expression used for
155      * initializing the field if any (-1 if no initialization).
156      */

157     void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
158     
159     void exitInitializer(int declarationEnd);
160     
161     void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd);
162     
163     void exitType(int declarationEnd);
164 }
165
Popular Tags