return;
}
// "void" method declaration.
if (this.peekKeyword("void")) {
Location location = this.location();
this.eatToken();
if (optionalDocComment == null) this.warning("MDCM", "Method doc comment missing", location);
String name = this.readIdentifier();
classDeclaration.addDeclaredMethod(this.parseMethodDeclarationRest(
optionalDocComment, // declaringType
modifiers, // optionalDocComment
new Java.BasicType(location, Java.BasicType.VOID), // modifiers
name // name
));
return;
}
// Member class.
if (this.peekKeyword("class")) {
if (optionalDocComment == null) this.warning("MCDCM", "Member class doc comment missing", this.location());
this.eatToken();
classDeclaration.addMemberTypeDeclaration((Java.MemberTypeDeclaration) this.parseClassDeclarationRest(
optionalDocComment, // optionalDocComment
modifiers, // modifiers
ClassDeclarationContext.TYPE_DECLARATION // context
));
return;
}
// Member interface.
if (this.peekKeyword("interface")) {
if (optionalDocComment == null) {
this.warning("MIDCM", "Member interface doc comment missing", this.location());
}
this.eatToken();
classDeclaration.addMemberTypeDeclaration((Java.MemberTypeDeclaration) this.parseInterfaceDeclarationRest(
optionalDocComment, // optionalDocComment
(short) (modifiers | Mod.STATIC), // modifiers
InterfaceDeclarationContext.NAMED_TYPE_DECLARATION // context
));
return;
}
// Constructor.
if (
classDeclaration instanceof Java.NamedClassDeclaration &&
this.scanner.peek().isIdentifier(((Java.NamedClassDeclaration) classDeclaration).getName()) &&
this.scanner.peekNextButOne().isOperator("(")
) {
if (optionalDocComment == null) this.warning("CDCM", "Constructor doc comment missing", this.location());
classDeclaration.addConstructor(this.parseConstructorDeclarator(
optionalDocComment, // declaringClass
modifiers // modifiers
));
return;
}
// Member method or field.
Java.Type memberType = this.parseType();
Location location = this.location();
String memberName = this.readIdentifier();
// Method declarator.
if (this.peekOperator("(")) {
if (optionalDocComment == null) this.warning("MDCM", "Method doc comment missing", this.location());