|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.jsdt.core.dom.ASTNode
org.eclipse.wst.jsdt.core.dom.ProgramElement
org.eclipse.wst.jsdt.core.dom.Statement
public abstract class Statement
Abstract base class of AST nodes that represent statements. There are many kinds of statements.
The grammar combines both Statement and BlockStatement. For JLS2:
Statement: Block IfStatement ForStatement WhileStatement DoStatement TryStatement SwitchStatement SynchronizedStatement ReturnStatement ThrowStatement BreakStatement ContinueStatement EmptyStatement ExpressionStatement LabeledStatement AssertStatement VariableDeclarationStatement TypeDeclarationStatement ConstructorInvocation SuperConstructorInvocationFor JLS3, an enhanced for node type was added:
Statement: Block IfStatement ForStatement EnhancedForStatement WhileStatement DoStatement TryStatement SwitchStatement SynchronizedStatement ReturnStatement ThrowStatement BreakStatement ContinueStatement EmptyStatement ExpressionStatement LabeledStatement AssertStatement VariableDeclarationStatement TypeDeclarationStatement ConstructorInvocation SuperConstructorInvocationProvisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Field Summary |
---|
Method Summary | |
---|---|
java.lang.String |
getLeadingComment()
Deprecated. This feature was removed in the 2.1 release because it was only a partial, and inadequate, solution to the issue of associating comments with statements. Furthermore, AST.parseCompilationUnit did not associate leading comments, making this moot. Clients that need to access comments preceding a statement should either consult the compilation unit's comment table or use a scanner to reanalyze the source text immediately preceding the statement's source range. |
void |
setLeadingComment(java.lang.String comment)
Deprecated. This feature was removed in the 2.1 release because it was only a partial, and inadequate, solution to the issue of associating comments with statements. |
Methods inherited from class org.eclipse.wst.jsdt.core.dom.ASTNode |
---|
accept, copySubtree, copySubtrees, delete, equals, getAST, getFlags, getLength, getLocationInParent, getNodeType, getParent, getProperty, getRoot, getStartPosition, getStructuralProperty, hashCode, nodeClassForType, properties, setFlags, setProperty, setSourceRange, setStructuralProperty, structuralPropertiesForType, subtreeBytes, subtreeMatch, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.String getLeadingComment()
A leading comment is a comment that appears before the statement. It may be either a traditional comment or an end-of-line comment. Traditional comments must begin with "/*, may contain line breaks, and must end with "*/. End-of-line comments must begin with "//", must end with a line delimiter (as per JLS 3.7), and must not contain line breaks.
null
if nonepublic void setLeadingComment(java.lang.String comment)
A leading comment is a comment that appears before the statement. It may be either a traditional comment or an end-of-line comment. Traditional comments must begin with "/*, may contain line breaks, and must end with "*/. End-of-line comments must begin with "//" (as per JLS 3.7), and must not contain line breaks.
Examples:
setLeadingComment("/* traditional comment */"); // correct
setLeadingComment("missing comment delimiters"); // wrong
setLeadingComment("/* unterminated traditional comment "); // wrong
setLeadingComment("/* broken\n traditional comment */"); // correct
setLeadingComment("// end-of-line comment\n"); // correct
setLeadingComment("// end-of-line comment without line terminator"); // correct
setLeadingComment("// broken\n end-of-line comment\n"); // wrong
comment
- the comment string, or null
if none
java.lang.IllegalArgumentException
- if the comment string is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |