|
Eclipse JDT Release 3.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.core.dom.ASTNode
org.eclipse.jdt.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:AssertStatement
,Block
,BreakStatement
,ConstructorInvocation
,ContinueStatement
,DoStatement
,EmptyStatement
,ExpressionStatement
,ForStatement
,IfStatement
,LabeledStatement
,ReturnStatement
,SuperConstructorInvocation
,SwitchCase
,SwitchStatement
,SynchronizedStatement
,ThrowStatement
,TryStatement
,TypeDeclarationStatement
,VariableDeclarationStatement
,WhileStatement
For JLS3, an enhanced for node type was added:
Statement:
<JLS2 statements>...,
EnhancedForStatement
Field Summary |
---|
Method Summary | |
---|---|
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(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.jdt.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 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public 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(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
IllegalArgumentException
- if the comment string is invalid
|
Eclipse JDT Release 3.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.