/projects/aspectj-1.6.9/aspectjtools1.6.9/org/aspectj/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 412 lines · 133 code · 3 blank · 276 comment · 0 complexity · e4d8dabc88c29001e50393f3eea3b5b5 MD5 · raw file

  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.aspectj.org.eclipse.jdt.internal.compiler;
  12. import org.aspectj.org.eclipse.jdt.core.compiler.CategorizedProblem;
  13. /**
  14. * Part of the source element parser responsible for building the output.
  15. * It gets notified of structural information as they are detected, relying
  16. * on the requestor to assemble them together, based on the notifications it got.
  17. *
  18. * The structural investigation includes:
  19. * - package statement
  20. * - import statements
  21. * - top-level types: package member, member types (member types of member types...)
  22. * - fields
  23. * - methods
  24. *
  25. * If reference information is requested, then all source constructs are
  26. * investigated and type, field & method references are provided as well.
  27. *
  28. * Any (parsing) problem encountered is also provided.
  29. *
  30. * All positions are relative to the exact source fed to the parser.
  31. *
  32. * Elements which are complex are notified in two steps:
  33. * - enter<Element> : once the element header has been identified
  34. * - exit<Element> : once the element has been fully consumed
  35. *
  36. * other simpler elements (package, import) are read all at once:
  37. * - accept<Element>
  38. */
  39. public interface IDocumentElementRequestor {
  40. /**
  41. * @param declarationStart - a source position corresponding to the start of the package
  42. * declaration
  43. * @param declarationEnd - a source position corresponding to the end of the package
  44. * declaration
  45. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  46. * positions of the available JavaDoc comments. The array is a flattened
  47. * structure: 2*n entries with consecutives start and end positions.
  48. * If no JavaDoc is available, then null is answered instead of an empty array.
  49. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  50. * The array is equals to null if there are no javadoc comments
  51. * @param name - the name of the package
  52. * @param nameStartPosition - a source position corresponding to the first character of the
  53. * name
  54. * @param onDemand - a boolean equals to true if the import is an import on demand
  55. */
  56. void acceptImport(
  57. int declarationStart,
  58. int declarationEnd,
  59. int[] javaDocPositions,
  60. char[] name,
  61. int nameStartPosition,
  62. boolean onDemand,
  63. int modifiers);
  64. /**
  65. * @param declarationStart - a source position corresponding to the start of the package
  66. * declaration
  67. * @param declarationEnd - a source position corresponding to the end of the package
  68. * declaration
  69. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  70. * positions of the available JavaDoc comments. The array is a flattened
  71. * structure: 2*n entries with consecutives start and end positions.
  72. * If no JavaDoc is available, then null is answered instead of an empty array.
  73. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  74. * The array is equals to null if there are no javadoc comments
  75. * @param modifiers - the modifiers for this initializer
  76. * @param modifiersStart - a source position corresponding to the start
  77. * of the textual modifiers, is < 0 if there are no textual modifiers
  78. * @param bodyStart - the position of the '{'
  79. * @param bodyEnd - the position of the '}'
  80. */
  81. void acceptInitializer(
  82. int declarationStart,
  83. int declarationEnd,
  84. int[] javaDocPositions,
  85. int modifiers,
  86. int modifiersStart,
  87. int bodyStart,
  88. int bodyEnd);
  89. /*
  90. * Table of line separator position. This table is passed once at the end
  91. * of the parse action, so as to allow computation of normalized ranges.
  92. *
  93. * A line separator might corresponds to several characters in the source,
  94. *
  95. */
  96. void acceptLineSeparatorPositions(int[] positions);
  97. /**
  98. * @param declarationStart - a source position corresponding to the start of the package
  99. * declaration
  100. * @param declarationEnd - a source position corresponding to the end of the package
  101. * declaration
  102. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  103. * positions of the available JavaDoc comments. The array is a flattened
  104. * structure: 2*n entries with consecutives start and end positions.
  105. * If no JavaDoc is available, then null is answered instead of an empty array.
  106. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  107. * The array is equals to null if there are no javadoc comments
  108. * @param name - the name of the package
  109. * @param nameStartPosition - a source position corresponding to the first character of the
  110. * name
  111. */
  112. void acceptPackage(
  113. int declarationStart,
  114. int declarationEnd,
  115. int[] javaDocPositions,
  116. char[] name,
  117. int nameStartPosition);
  118. /**
  119. * @param problem - Used to report a problem while running the JDOM
  120. */
  121. void acceptProblem(CategorizedProblem problem);
  122. /**
  123. * @param declarationStart - a source position corresponding to the start
  124. * of this class.
  125. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  126. * positions of the available JavaDoc comments. The array is a flattened
  127. * structure: 2*n entries with consecutives start and end positions.
  128. * If no JavaDoc is available, then null is answered instead of an empty array.
  129. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  130. * The array is equals to null if there are no javadoc comments
  131. * @param modifiers - the modifiers for this class
  132. * @param modifiersStart - a source position corresponding to the start
  133. * of the textual modifiers, is < 0 if there are no textual modifiers
  134. * @param classStart - a source position corresponding to the start
  135. * of the keyword 'class'
  136. * @param name - the name of the class
  137. * @param nameStart - a source position corresponding to the start of the name
  138. * @param nameEnd - a source position corresponding to the end of the name
  139. * @param superclass - the name of the superclass
  140. * @param superclassStart - a source position corresponding to the start
  141. * of the superclass name
  142. * @param superclassEnd - a source position corresponding to the end of the
  143. * superclass name
  144. * @param superinterfaces - the name of the superinterfaces
  145. * @param superinterfaceStarts - an array of source positions corresponding
  146. * to the start of their respective superinterface names
  147. * @param superinterfaceEnds - an array of source positions corresponding
  148. * to the end of their respective superinterface names
  149. * @param bodyStart - a source position corresponding to the open bracket
  150. * of the class body
  151. */
  152. void enterClass(
  153. int declarationStart,
  154. int[] javaDocPositions,
  155. int modifiers,
  156. int modifiersStart,
  157. int classStart,
  158. char[] name,
  159. int nameStart,
  160. int nameEnd,
  161. char[] superclass,
  162. int superclassStart,
  163. int superclassEnd,
  164. char[][] superinterfaces,
  165. int[] superinterfaceStarts,
  166. int[] superinterfaceEnds,
  167. int bodyStart);
  168. void enterCompilationUnit();
  169. /**
  170. * @param declarationStart - a source position corresponding to the first character
  171. * of this constructor declaration
  172. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  173. * positions of the available JavaDoc comments. The array is a flattened
  174. * structure: 2*n entries with consecutives start and end positions.
  175. * If no JavaDoc is available, then null is answered instead of an empty array.
  176. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  177. * The array is equals to null if there are no javadoc comments
  178. * @param modifiers - the modifiers for this constructor converted to a flag
  179. * @param modifiersStart - a source position corresponding to the first character of the
  180. * textual modifiers
  181. * @param name - the name of this constructor
  182. * @param nameStart - a source position corresponding to the first character of the name
  183. * @param nameEnd - a source position corresponding to the last character of the name
  184. * @param parameterTypes - a list of parameter type names
  185. * @param parameterTypeStarts - a list of source positions corresponding to the
  186. * first character of each parameter type name
  187. * @param parameterTypeEnds - a list of source positions corresponding to the
  188. * last character of each parameter type name
  189. * @param parameterNames - a list of the names of the parameters
  190. * @param parametersEnd - a source position corresponding to the last character of the
  191. * parameter list
  192. * @param exceptionTypes - a list of the exception types
  193. * @param exceptionTypeStarts - a list of source positions corresponding to the first
  194. * character of the respective exception types
  195. * @param exceptionTypeEnds - a list of source positions corresponding to the last
  196. * character of the respective exception types
  197. * @param bodyStart - a source position corresponding to the start of this
  198. * constructor's body
  199. */
  200. void enterConstructor(
  201. int declarationStart,
  202. int[] javaDocPositions,
  203. int modifiers,
  204. int modifiersStart,
  205. char[] name,
  206. int nameStart,
  207. int nameEnd,
  208. char[][] parameterTypes,
  209. int [] parameterTypeStarts,
  210. int [] parameterTypeEnds,
  211. char[][] parameterNames,
  212. int [] parameterNameStarts,
  213. int [] parameterNameEnds,
  214. int parametersEnd,
  215. char[][] exceptionTypes,
  216. int [] exceptionTypeStarts,
  217. int [] exceptionTypeEnds,
  218. int bodyStart);
  219. /**
  220. * @param declarationStart - a source position corresponding to the first character
  221. * of this field
  222. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  223. * positions of the available JavaDoc comments. The array is a flattened
  224. * structure: 2*n entries with consecutives start and end positions.
  225. * If no JavaDoc is available, then null is answered instead of an empty array.
  226. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  227. * The array is equals to null if there are no javadoc comments
  228. * @param modifiers - the modifiers for this field converted to a flag
  229. * @param modifiersStart - a source position corresponding to the first character of the
  230. * textual modifiers
  231. * @param type - the name of the field type
  232. * @param typeStart - a source position corresponding to the start of the fields type
  233. * @param typeEnd - a source position corresponding to the end of the fields type
  234. * @param typeDimensionCount - the array dimension indicated on the type (for example, 'int[] v')
  235. * @param name - the name of this constructor
  236. * @param nameStart - a source position corresponding to the first character of the name
  237. * @param nameEnd - a source position corresponding to the last character of the name
  238. * @param extendedTypeDimensionCount - the array dimension indicated on the variable,
  239. * (for example, 'int v[]')
  240. * @param extendedTypeDimensionEnd - a source position corresponding to the end of
  241. * the extened type dimension. This position should be -1 in case there is no extended
  242. * dimension for the type.
  243. */
  244. void enterField(
  245. int declarationStart,
  246. int[] javaDocPositions,
  247. int modifiers,
  248. int modifiersStart,
  249. char[] type,
  250. int typeStart,
  251. int typeEnd,
  252. int typeDimensionCount,
  253. char[] name,
  254. int nameStart,
  255. int nameEnd,
  256. int extendedTypeDimensionCount,
  257. int extendedTypeDimensionEnd);
  258. /**
  259. * @param declarationStart - a source position corresponding to the start
  260. * of this class.
  261. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  262. * positions of the available JavaDoc comments. The array is a flattened
  263. * structure: 2*n entries with consecutives start and end positions.
  264. * If no JavaDoc is available, then null is answered instead of an empty array.
  265. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  266. * The array is equals to null if there are no javadoc comments
  267. * @param modifiers - the modifiers for this class
  268. * @param modifiersStart - a source position corresponding to the start
  269. * of the textual modifiers, is < 0 if there are no textual modifiers
  270. * @param interfaceStart - a source position corresponding to the start
  271. * of the keyword 'interface'
  272. * @param name - the name of the class
  273. * @param nameStart - a source position corresponding to the start of the name
  274. * @param nameEnd - a source position corresponding to the end of the name
  275. * @param superinterfaces - the name of the superinterfaces
  276. * @param superinterfaceStarts - an array of source positions corresponding
  277. * to the start of their respective superinterface names
  278. * @param superinterfaceEnds - an array of source positions corresponding
  279. * to the end of their respective superinterface names
  280. * @param bodyStart - a source position corresponding to the open bracket
  281. * of the class body
  282. */
  283. void enterInterface(
  284. int declarationStart,
  285. int[] javaDocPositions,
  286. int modifiers,
  287. int modifiersStart,
  288. int interfaceStart,
  289. char[] name,
  290. int nameStart,
  291. int nameEnd,
  292. char[][] superinterfaces,
  293. int[] superinterfaceStarts,
  294. int[] superinterfaceEnds,
  295. int bodyStart);
  296. /**
  297. * @param declarationStart - a source position corresponding to the first character
  298. * of this constructor declaration
  299. * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
  300. * positions of the available JavaDoc comments. The array is a flattened
  301. * structure: 2*n entries with consecutives start and end positions.
  302. * If no JavaDoc is available, then null is answered instead of an empty array.
  303. * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
  304. * The array is equals to null if there are no javadoc comments
  305. * @param modifiers - the modifiers for this constructor converted to a flag
  306. * @param modifiersStart - a source position corresponding to the first character of the
  307. * textual modifiers
  308. * @param returnType - the name of the return type
  309. * @param returnTypeStart - a source position corresponding to the first character
  310. * of the return type
  311. * @param returnTypeEnd - a source position corresponding to the last character
  312. * of the return type
  313. * @param returnTypeDimensionCount - the array dimension count as supplied on the
  314. * return type (for example, 'public int[] foo() {}')
  315. * @param name - the name of this constructor
  316. * @param nameStart - a source position corresponding to the first character of the name
  317. * @param nameEnd - a source position corresponding to the last character of the name
  318. * @param parameterTypes - a list of parameter type names
  319. * @param parameterTypeStarts - a list of source positions corresponding to the
  320. * first character of each parameter type name
  321. * @param parameterTypeEnds - a list of source positions corresponding to the
  322. * last character of each parameter type name
  323. * @param parameterNames - a list of the names of the parameters
  324. * @param parametersEnd - a source position corresponding to the last character of the
  325. * parameter list
  326. * @param extendedReturnTypeDimensionCount - the array dimension count as supplied on the
  327. * end of the parameter list (for example, 'public int foo()[] {}')
  328. * @param extendedReturnTypeDimensionEnd - a source position corresponding to the last character
  329. * of the extended return type dimension. This position should be -1 in case there is no extended
  330. * dimension for the type.
  331. * @param exceptionTypes - a list of the exception types
  332. * @param exceptionTypeStarts - a list of source positions corresponding to the first
  333. * character of the respective exception types
  334. * @param exceptionTypeEnds - a list of source positions corresponding to the last
  335. * character of the respective exception types
  336. * @param bodyStart - a source position corresponding to the start of this
  337. * method's body
  338. */
  339. void enterMethod(
  340. int declarationStart,
  341. int[] javaDocPositions,
  342. int modifiers,
  343. int modifiersStart,
  344. char[] returnType,
  345. int returnTypeStart,
  346. int returnTypeEnd,
  347. int returnTypeDimensionCount,
  348. char[] name,
  349. int nameStart,
  350. int nameEnd,
  351. char[][] parameterTypes,
  352. int [] parameterTypeStarts,
  353. int [] parameterTypeEnds,
  354. char[][] parameterNames,
  355. int [] parameterNameStarts,
  356. int [] parameterNameEnds,
  357. int parametersEnd,
  358. int extendedReturnTypeDimensionCount,
  359. int extendedReturnTypeDimensionEnd,
  360. char[][] exceptionTypes,
  361. int [] exceptionTypeStarts,
  362. int [] exceptionTypeEnds,
  363. int bodyStart);
  364. /**
  365. * @param bodyEnd - a source position corresponding to the closing bracket of the class
  366. * @param declarationEnd - a source position corresponding to the end of the class
  367. * declaration. This can include whitespace and comments following the closing bracket.
  368. */
  369. void exitClass(
  370. int bodyEnd,
  371. int declarationEnd);
  372. /**
  373. * @param declarationEnd - a source position corresponding to the end of the compilation unit
  374. */
  375. void exitCompilationUnit(
  376. int declarationEnd);
  377. /**
  378. * @param bodyEnd - a source position corresponding to the closing bracket of the method
  379. * @param declarationEnd - a source position corresponding to the end of the method
  380. * declaration. This can include whitespace and comments following the closing bracket.
  381. */
  382. void exitConstructor(
  383. int bodyEnd,
  384. int declarationEnd);
  385. /**
  386. * @param bodyEnd - a source position corresponding to the end of the field.
  387. * @param declarationEnd - a source position corresponding to the end of the field.
  388. * This can include whitespace and comments following the semi-colon.
  389. */
  390. void exitField(
  391. int bodyEnd,
  392. int declarationEnd);
  393. /**
  394. * @param bodyEnd - a source position corresponding to the closing bracket of the interface
  395. * @param declarationEnd - a source position corresponding to the end of the interface
  396. * declaration. This can include whitespace and comments following the closing bracket.
  397. */
  398. void exitInterface(
  399. int bodyEnd,
  400. int declarationEnd);
  401. /**
  402. * @param bodyEnd - a source position corresponding to the closing bracket of the method
  403. * @param declarationEnd - a source position corresponding to the end of the method
  404. * declaration. This can include whitespace and comments following the closing bracket.
  405. */
  406. void exitMethod(
  407. int bodyEnd,
  408. int declarationEnd);
  409. }