/** ClassCreatorRest = Arguments [ClassBody] */ JCExpression classCreatorRest(int newpos, JCExpression encl, List<JCExpression> typeArgs, JCExpression t) { List<JCExpression> args = arguments(); JCClassDecl body = null; if (S.token() == LBRACE) { int pos = S.pos(); List<JCTree> defs = classOrInterfaceBody(names.empty, false); JCModifiers mods = F.at(Position.NOPOS).Modifiers(0); body = toP(F.at(pos).AnonymousClassDef(mods, defs)); } return toP(F.at(newpos).NewClass(encl, typeArgs, t, args, body)); }
/** ClassCreatorRest = Arguments [ClassBody] */ JCExpression classCreatorRest(int newpos, JCExpression encl, List<JCExpression> typeArgs, JCExpression t) { List<JCExpression> args = arguments(); JCClassDecl body = null; if (S.token() == LBRACE) { int pos = S.pos(); List<JCTree> defs = classOrInterfaceBody(names.empty, false); JCModifiers mods = F.at(Position.NOPOS).Modifiers(0); body = toP(F.at(pos).AnonymousClassDef(mods, defs)); } return toP(F.at(newpos).NewClass(encl, typeArgs, t, args, body)); }
/** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt * [EXTENDS TypeList] InterfaceBody * @param mods The modifiers starting the interface declaration * @param dc The documentation comment for the interface, or null. */ JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) { int pos = S.pos(); accept(INTERFACE); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); List<JCExpression> extending = List.nil(); if (S.token() == EXTENDS) { S.nextToken(); extending = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, true); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, null, extending, defs)); attach(result, dc); return result; }
/** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt * [EXTENDS TypeList] InterfaceBody * @param mods The modifiers starting the interface declaration * @param dc The documentation comment for the interface, or null. */ JCClassDecl interfaceDeclaration(JCModifiers mods, String dc) { int pos = S.pos(); accept(INTERFACE); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); List<JCExpression> extending = List.nil(); if (S.token() == EXTENDS) { S.nextToken(); extending = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, true); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, null, extending, defs)); attach(result, dc); return result; }
/** ClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type] * [IMPLEMENTS TypeList] ClassBody * @param mods The modifiers starting the class declaration * @param dc The documentation comment for the class, or null. */ JCClassDecl classDeclaration(JCModifiers mods, String dc) { int pos = S.pos(); accept(CLASS); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); JCTree extending = null; if (S.token() == EXTENDS) { S.nextToken(); extending = type(); } List<JCExpression> implementing = List.nil(); if (S.token() == IMPLEMENTS) { S.nextToken(); implementing = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, false); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, extending, implementing, defs)); attach(result, dc); return result; }
/** ClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type] * [IMPLEMENTS TypeList] ClassBody * @param mods The modifiers starting the class declaration * @param dc The documentation comment for the class, or null. */ JCClassDecl classDeclaration(JCModifiers mods, String dc) { int pos = S.pos(); accept(CLASS); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); JCTree extending = null; if (S.token() == EXTENDS) { S.nextToken(); extending = type(); } List<JCExpression> implementing = List.nil(); if (S.token() == IMPLEMENTS) { S.nextToken(); implementing = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, false); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, extending, implementing, defs)); attach(result, dc); return result; }
if (S.token() == LBRACE) { JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM | Flags.STATIC); List<JCTree> defs = classOrInterfaceBody(names.empty, false); body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));
if (S.token() == LBRACE) { JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM | Flags.STATIC); List<JCTree> defs = classOrInterfaceBody(names.empty, false); body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));