3386 JCExpression extending = null;
3387 if (token.kind == EXTENDS) {
3388 nextToken();
3389 extending = parseType();
3390 }
3391 List<JCExpression> implementing = List.nil();
3392 if (token.kind == IMPLEMENTS) {
3393 nextToken();
3394 implementing = typeList();
3395 }
3396 List<JCTree> defs = classOrInterfaceBody(name, false);
3397 JCClassDecl result = toP(F.at(pos).ClassDef(
3398 mods, name, typarams, extending, implementing, defs));
3399 attach(result, dc);
3400 return result;
3401 }
3402
3403 Name typeName() {
3404 int pos = token.pos;
3405 Name name = ident();
3406 if (isRestrictedLocalVarTypeName(name)) {
3407 reportSyntaxError(pos, "var.not.allowed", name);
3408 }
3409 return name;
3410 }
3411
3412 /** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
3413 * [EXTENDS TypeList] InterfaceBody
3414 * @param mods The modifiers starting the interface declaration
3415 * @param dc The documentation comment for the interface, or null.
3416 */
3417 protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
3418 int pos = token.pos;
3419 accept(INTERFACE);
3420
3421 Name name = typeName();
3422
3423 List<JCTypeParameter> typarams = typeParametersOpt();
3424
3425 List<JCExpression> extending = List.nil();
3426 if (token.kind == EXTENDS) {
3427 nextToken();
|
3386 JCExpression extending = null;
3387 if (token.kind == EXTENDS) {
3388 nextToken();
3389 extending = parseType();
3390 }
3391 List<JCExpression> implementing = List.nil();
3392 if (token.kind == IMPLEMENTS) {
3393 nextToken();
3394 implementing = typeList();
3395 }
3396 List<JCTree> defs = classOrInterfaceBody(name, false);
3397 JCClassDecl result = toP(F.at(pos).ClassDef(
3398 mods, name, typarams, extending, implementing, defs));
3399 attach(result, dc);
3400 return result;
3401 }
3402
3403 Name typeName() {
3404 int pos = token.pos;
3405 Name name = ident();
3406 if (name == names.var) {
3407 if (Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source)) {
3408 reportSyntaxError(pos, "var.not.allowed", name);
3409 } else {
3410 warning(pos, "var.not.allowed", name);
3411 }
3412 }
3413 return name;
3414 }
3415
3416 /** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
3417 * [EXTENDS TypeList] InterfaceBody
3418 * @param mods The modifiers starting the interface declaration
3419 * @param dc The documentation comment for the interface, or null.
3420 */
3421 protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
3422 int pos = token.pos;
3423 accept(INTERFACE);
3424
3425 Name name = typeName();
3426
3427 List<JCTypeParameter> typarams = typeParametersOpt();
3428
3429 List<JCExpression> extending = List.nil();
3430 if (token.kind == EXTENDS) {
3431 nextToken();
|