ASTNode node = parser.createAST(this.progressMonitor);
String createdNodeSource;
if (node.getNodeType() != ASTNode.TYPE_DECLARATION) {
createdNodeSource = generateSyntaxIncorrectAST();
if (this.createdNode == null)
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
} else {
TypeDeclaration typeDeclaration = (TypeDeclaration) node;
if ((typeDeclaration.getFlags() & ASTNode.MALFORMED) != 0) {
createdNodeSource = generateSyntaxIncorrectAST();
if (this.createdNode == null)
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
} else {
List bodyDeclarations = typeDeclaration.bodyDeclarations();
if (bodyDeclarations.size() == 0) {
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
}
this.createdNode = (ASTNode) bodyDeclarations.iterator().next();
createdNodeSource = this.source;
}
}