Lines 242-265
Link Here
|
242 |
this.compilerOptions = options; |
242 |
this.compilerOptions = options; |
243 |
} |
243 |
} |
244 |
|
244 |
|
245 |
/** |
245 |
/** |
246 |
* Requests that the compiler should perform bindings recovery. |
246 |
* Requests that the compiler should perform bindings recovery. |
247 |
* When bindings recovery is enabled the compiler returns incomplete bindings. |
247 |
* When bindings recovery is enabled the compiler returns incomplete bindings. |
248 |
* <p> |
248 |
* <p> |
249 |
* Default to <code>false</code>. |
249 |
* Default to <code>false</code>. |
250 |
* </p> |
250 |
* </p> |
251 |
* <p>This should be set to true only if bindings are resolved. It has no effect if there is no binding |
251 |
* <p>This should be set to true only if bindings are resolved. It has no effect if there is no binding |
252 |
* resolution.</p> |
252 |
* resolution.</p> |
253 |
* |
253 |
* |
254 |
* @param enabled <code>true</code> if incomplete bindings are expected, |
254 |
* @param enabled <code>true</code> if incomplete bindings are expected, |
255 |
* and <code>false</code> if only complete bindings are expected. |
255 |
* and <code>false</code> if only complete bindings are expected. |
256 |
* |
256 |
* |
257 |
* @see IBinding#isRecovered() |
257 |
* @see IBinding#isRecovered() |
258 |
* @since 3.3 |
258 |
* @since 3.3 |
259 |
*/ |
259 |
*/ |
260 |
public void setBindingsRecovery(boolean enabled) { |
260 |
public void setBindingsRecovery(boolean enabled) { |
261 |
this.bindingsRecovery = enabled; |
261 |
this.bindingsRecovery = enabled; |
262 |
} |
262 |
} |
263 |
/** |
263 |
/** |
264 |
* Sets the compiler options to be used when parsing. |
264 |
* Sets the compiler options to be used when parsing. |
265 |
* <p> |
265 |
* <p> |
Lines 350-363
Link Here
|
350 |
} |
350 |
} |
351 |
|
351 |
|
352 |
/** |
352 |
/** |
353 |
* Requests an abridged abstract syntax tree. |
353 |
* Requests an abridged abstract syntax tree. |
354 |
* By default, complete ASTs are returned. |
354 |
* By default, complete ASTs are returned. |
355 |
* <p> |
355 |
* <p> |
356 |
* When <code>true</code> the resulting AST does not have nodes for |
356 |
* When <code>true</code> the resulting AST does not have nodes for |
357 |
* the entire compilation unit. Rather, the AST is only fleshed out |
357 |
* the entire compilation unit. Rather, the AST is only fleshed out |
358 |
* for the node that include the given source position. This kind of limited |
358 |
* for the node that include the given source position. This kind of limited |
359 |
* AST is sufficient for certain purposes but totally unsuitable for others. |
359 |
* AST is sufficient for certain purposes but totally unsuitable for others. |
360 |
* In places where it can be used, the limited AST offers the advantage of |
360 |
* In places where it can be used, the limited AST offers the advantage of |
361 |
* being smaller and faster to construct. |
361 |
* being smaller and faster to construct. |
362 |
* </p> |
362 |
* </p> |
363 |
* <p> |
363 |
* <p> |
Lines 383-388
Link Here
|
383 |
* compilation unit. |
383 |
* compilation unit. |
384 |
* </p> |
384 |
* </p> |
385 |
* |
385 |
* |
|
|
386 |
* <p>This focal position is not used when the AST is built using |
387 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
388 |
* |
386 |
* @param position a position into the corresponding body declaration |
389 |
* @param position a position into the corresponding body declaration |
387 |
*/ |
390 |
*/ |
388 |
public void setFocalPosition(int position) { |
391 |
public void setFocalPosition(int position) { |
Lines 392-398
Link Here
|
392 |
|
395 |
|
393 |
/** |
396 |
/** |
394 |
* Sets the kind of constructs to be parsed from the source. |
397 |
* Sets the kind of constructs to be parsed from the source. |
395 |
* Defaults to an entire compilation unit. |
398 |
* Defaults to an entire compilation unit. |
396 |
* <p> |
399 |
* <p> |
397 |
* When the parse is successful the result returned includes the ASTs for the |
400 |
* When the parse is successful the result returned includes the ASTs for the |
398 |
* requested source: |
401 |
* requested source: |
Lines 426-432
Link Here
|
426 |
* </ul> |
429 |
* </ul> |
427 |
* The contrived nodes do not have source positions. Other aspects of the |
430 |
* The contrived nodes do not have source positions. Other aspects of the |
428 |
* {@link CompilationUnit CompilationUnit} node are unspecified, including |
431 |
* {@link CompilationUnit CompilationUnit} node are unspecified, including |
429 |
* the exact arrangment of intervening nodes. |
432 |
* the exact arrangement of intervening nodes. |
430 |
* </p> |
433 |
* </p> |
431 |
* <p> |
434 |
* <p> |
432 |
* Lexical or syntax errors detected while parsing can result in |
435 |
* Lexical or syntax errors detected while parsing can result in |
Lines 453-461
Link Here
|
453 |
* </p> |
456 |
* </p> |
454 |
* <p> |
457 |
* <p> |
455 |
* Binding information is only computed when <code>kind</code> is |
458 |
* Binding information is only computed when <code>kind</code> is |
456 |
* <code>K_COMPILATION_UNIT</code>. |
459 |
* <code>K_COMPILATION_UNIT</code>. |
457 |
* </p> |
460 |
* </p> |
458 |
* |
461 |
* |
|
|
462 |
* <p>This kind is not used the AST is built using |
463 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
464 |
* |
459 |
* @param kind the kind of construct to parse: one of |
465 |
* @param kind the kind of construct to parse: one of |
460 |
* {@link #K_COMPILATION_UNIT}, |
466 |
* {@link #K_COMPILATION_UNIT}, |
461 |
* {@link #K_CLASS_BODY_DECLARATIONS}, |
467 |
* {@link #K_CLASS_BODY_DECLARATIONS}, |
Lines 473-483
Link Here
|
473 |
} |
479 |
} |
474 |
|
480 |
|
475 |
/** |
481 |
/** |
476 |
* Sets the source code to be parsed. |
482 |
* Sets the source code to be parsed. |
477 |
* |
483 |
* |
|
|
484 |
* <p>This source is not used the AST is built using |
485 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
486 |
* |
478 |
* @param source the source string to be parsed, |
487 |
* @param source the source string to be parsed, |
479 |
* or <code>null</code> if none |
488 |
* or <code>null</code> if none |
480 |
*/ |
489 |
*/ |
481 |
public void setSource(char[] source) { |
490 |
public void setSource(char[] source) { |
482 |
this.rawSource = source; |
491 |
this.rawSource = source; |
483 |
// clear the type root |
492 |
// clear the type root |
Lines 485-513
Link Here
|
485 |
} |
494 |
} |
486 |
|
495 |
|
487 |
/** |
496 |
/** |
488 |
* Sets the source code to be parsed. |
497 |
* Sets the source code to be parsed. |
489 |
* This method automatically sets the project (and compiler |
498 |
* This method automatically sets the project (and compiler |
490 |
* options) based on the given compilation unit, in a manner |
499 |
* options) based on the given compilation unit, in a manner |
491 |
* equivalent to <code>setProject(source.getJavaProject())</code> |
500 |
* equivalent to <code>setProject(source.getJavaProject())</code> |
492 |
* |
501 |
* |
|
|
502 |
* <p>This source is not used the AST is built using |
503 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
504 |
* |
493 |
* @param source the Java model compilation unit whose source code |
505 |
* @param source the Java model compilation unit whose source code |
494 |
* is to be parsed, or <code>null</code> if none |
506 |
* is to be parsed, or <code>null</code> if none |
495 |
*/ |
507 |
*/ |
496 |
public void setSource(ICompilationUnit source) { |
508 |
public void setSource(ICompilationUnit source) { |
497 |
setSource((ITypeRoot)source); |
509 |
setSource((ITypeRoot)source); |
498 |
} |
510 |
} |
499 |
|
511 |
|
500 |
/** |
512 |
/** |
501 |
* Sets the source code to be parsed. |
513 |
* Sets the source code to be parsed. |
502 |
* <p>This method automatically sets the project (and compiler |
514 |
* <p>This method automatically sets the project (and compiler |
503 |
* options) based on the given compilation unit, in a manner |
515 |
* options) based on the given compilation unit, in a manner |
504 |
* equivalent to <code>setProject(source.getJavaProject())</code>.</p> |
516 |
* equivalent to <code>setProject(source.getJavaProject())</code>.</p> |
505 |
* <p>If the given class file has no source attachment, the creation of the |
517 |
* <p>If the given class file has no source attachment, the creation of the |
506 |
* ast will fail with an IllegalStateException.</p> |
518 |
* ast will fail with an IllegalStateException.</p> |
507 |
* |
519 |
* |
|
|
520 |
* <p>This source is not used the AST is built using |
521 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
522 |
* |
508 |
* @param source the Java model class file whose corresponding source code |
523 |
* @param source the Java model class file whose corresponding source code |
509 |
* is to be parsed, or <code>null</code> if none |
524 |
* is to be parsed, or <code>null</code> if none |
510 |
*/ |
525 |
*/ |
511 |
public void setSource(IClassFile source) { |
526 |
public void setSource(IClassFile source) { |
512 |
setSource((ITypeRoot)source); |
527 |
setSource((ITypeRoot)source); |
513 |
} |
528 |
} |
Lines 520-525
Link Here
|
520 |
* <p>If the source is a class file without source attachment, the creation of the |
535 |
* <p>If the source is a class file without source attachment, the creation of the |
521 |
* ast will fail with an IllegalStateException.</p> |
536 |
* ast will fail with an IllegalStateException.</p> |
522 |
* |
537 |
* |
|
|
538 |
* <p>This source is not used the AST is built using |
539 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
540 |
* |
523 |
* @param source the Java model compilation unit or class file whose corresponding source code |
541 |
* @param source the Java model compilation unit or class file whose corresponding source code |
524 |
* is to be parsed, or <code>null</code> if none |
542 |
* is to be parsed, or <code>null</code> if none |
525 |
* @since 3.3 |
543 |
* @since 3.3 |
Lines 541-546
Link Here
|
541 |
* By default, the entire source string will be parsed |
559 |
* By default, the entire source string will be parsed |
542 |
* (<code>offset</code> 0 and <code>length</code> -1). |
560 |
* (<code>offset</code> 0 and <code>length</code> -1). |
543 |
* |
561 |
* |
|
|
562 |
* <p>This range is not used the AST is built using |
563 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
564 |
* |
544 |
* @param offset the index of the first character to parse |
565 |
* @param offset the index of the first character to parse |
545 |
* @param length the number of characters to parse, or -1 if |
566 |
* @param length the number of characters to parse, or -1 if |
546 |
* the remainder of the source string is to be parsed |
567 |
* the remainder of the source string is to be parsed |
Lines 600-609
Link Here
|
600 |
} |
621 |
} |
601 |
|
622 |
|
602 |
/** |
623 |
/** |
603 |
* Sets the name of the compilation unit that would hypothetically contains |
624 |
* Sets the name of the compilation unit that would hypothetically contains |
604 |
* the source string. This is used in conjunction with {@link #setSource(char[])} |
625 |
* the source string. This is used in conjunction with {@link #setSource(char[])} |
605 |
* and {@link #setProject(IJavaProject) } to locate the compilation unit relative to a Java project. |
626 |
* and {@link #setProject(IJavaProject) } to locate the compilation unit relative to a Java project. |
606 |
* Defaults to none (<code>null</code>). |
627 |
* Defaults to none (<code>null</code>). |
607 |
* <p> |
628 |
* <p> |
608 |
* The name of the compilation unit must be supplied for resolving bindings. |
629 |
* The name of the compilation unit must be supplied for resolving bindings. |
609 |
* This name should be suffixed by a dot ('.') followed by one of the |
630 |
* This name should be suffixed by a dot ('.') followed by one of the |
Lines 615-624
Link Here
|
615 |
* of the compilation unit must be "/P/Foo.java". |
636 |
* of the compilation unit must be "/P/Foo.java". |
616 |
* If the source declares a public class name "Bar" in a package "p1.p2" in a project "P" in a source folder "src", |
637 |
* If the source declares a public class name "Bar" in a package "p1.p2" in a project "P" in a source folder "src", |
617 |
* the name of the compilation unit must be "/P/src/p1/p2/Bar.java".</p> |
638 |
* the name of the compilation unit must be "/P/src/p1/p2/Bar.java".</p> |
618 |
* |
639 |
* |
|
|
640 |
* <p>This source is not used the AST is built using |
641 |
* {@link #createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor)}.</p> |
642 |
* |
619 |
* @param unitName the name of the compilation unit that would contain the source |
643 |
* @param unitName the name of the compilation unit that would contain the source |
620 |
* string, or <code>null</code> if none |
644 |
* string, or <code>null</code> if none |
621 |
*/ |
645 |
*/ |
622 |
public void setUnitName(String unitName) { |
646 |
public void setUnitName(String unitName) { |
623 |
this.unitName = unitName; |
647 |
this.unitName = unitName; |
624 |
} |
648 |
} |