private static HeldLockSet handleMonitorGuards(VisitorState state, HeldLockSet locks) { JCNewClass newClassTree = ASTHelpers.findEnclosingNode(state.getPath(), JCNewClass.class); if (newClassTree == null) { return locks; } Symbol clazzSym = ASTHelpers.getSymbol(newClassTree.clazz); if (!(clazzSym instanceof ClassSymbol)) { return locks; } if (!((ClassSymbol) clazzSym).fullname.contentEquals(MONITOR_GUARD_CLASS)) { return locks; } Optional<GuardedByExpression> lockExpression = GuardedByBinder.bindExpression( Iterables.getOnlyElement(newClassTree.getArguments()), state); if (!lockExpression.isPresent()) { return locks; } return locks.plus(lockExpression.get()); }
endPosTable.storeEnd(clazzid1, tree.getEndPosition(endPosTable)); if (clazz.hasTag(ANNOTATED_TYPE)) { JCAnnotatedType annoType = (JCAnnotatedType) clazz; rs.resolveImplicitThis(tree.pos(), env, clazztype); (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 || ((JCVariableDecl) env.tree).init != tree)) log.error(tree.pos(), "enum.cant.be.instantiated"); log.error(tree.pos(), "abstract.cant.be.instantiated", clazztype.tsym); } else if (cdef != null && clazztype.tsym.isInterface()) { Symbol constructor = rs.resolveDiamond(tree.pos(), diamondEnv, site, rsEnv.info.pendingResolutionPhase = null; tree.constructor = rs.resolveConstructor( tree.pos(), rsEnv, clazztype, argtypes, typeargtypes); if (cdef == null) { //do not check twice! tree.constructorType = checkId(noCheckTree, tree.pos(), localEnv, clazztype, argtypes, typeargtypes); Assert.check(sym.kind < AMBIGUOUS); tree.constructor = sym;
endPosTable.storeEnd(clazzid1, tree.getEndPosition(endPosTable)); if (clazz.hasTag(ANNOTATED_TYPE)) { JCAnnotatedType annoType = (JCAnnotatedType) clazz; rs.resolveImplicitThis(tree.pos(), env, clazztype); (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 || ((JCVariableDecl) env.tree).init != tree)) log.error(tree.pos(), "enum.cant.be.instantiated"); log.error(tree.pos(), "abstract.cant.be.instantiated", clazztype.tsym); } else if (cdef != null && clazztype.tsym.isInterface()) { Symbol constructor = rs.resolveDiamond(tree.pos(), diamondEnv, site, rsEnv.info.pendingResolutionPhase = null; tree.constructor = rs.resolveConstructor( tree.pos(), rsEnv, clazztype, argtypes, typeargtypes); if (cdef == null) { //do not check twice! tree.constructorType = checkId(tree, tree.pos(), localEnv, clazztype, argtypes, typeargtypes); Assert.check(sym.kind < AMBIGUOUS); tree.constructor = sym;
clazztype.getEnclosingType().tag == CLASS) { rs.resolveImplicitThis(tree.pos(), env, clazztype); (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 || ((JCVariableDecl) env.tree).init != tree)) log.error(tree.pos(), "enum.cant.be.instantiated"); log.error(tree.pos(), "abstract.cant.be.instantiated", clazztype.tsym); } else if (cdef != null && clazztype.tsym.isInterface()) { localEnv.info.varArgs = false; tree.constructor = rs.resolveConstructor( tree.pos(), localEnv, clazztype, argtypes, typeargtypes); Type ctorType = checkMethod(clazztype, tree.constructor, tree.pos(), localEnv, clazztype, argtypes, typeargtypes, true, tree.varargsElement != null); assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
clazztype.getEnclosingType().tag == CLASS) { rs.resolveImplicitThis(tree.pos(), env, clazztype); (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 || ((JCVariableDecl) env.tree).init != tree)) log.error(tree.pos(), "enum.cant.be.instantiated"); log.error(tree.pos(), "abstract.cant.be.instantiated", clazztype.tsym); } else if (cdef != null && clazztype.tsym.isInterface()) { localEnv.info.varArgs = false; tree.constructor = rs.resolveConstructor( tree.pos(), localEnv, clazztype, argtypes, typeargtypes); Type ctorType = checkMethod(clazztype, tree.constructor, tree.pos(), localEnv, clazztype, argtypes, typeargtypes, true, tree.varargsElement != null); assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
if (vd.init instanceof JCNewClass) { JCNewClass init = (JCNewClass) vd.init; fillList(init.getArguments(), ec.rawArguments()); if (init.getClassBody() != null) { NormalTypeBody constantBody = setPos(init, new NormalTypeBody()); fillList(init.getClassBody().getMembers(), constantBody.rawMembers()); ec.astBody(constantBody);
if (vd.init instanceof JCNewClass) { JCNewClass init = (JCNewClass) vd.init; fillList(init.getArguments(), ec.rawArguments()); if (init.getClassBody() != null) { NormalTypeBody constantBody = setPos(init, new NormalTypeBody()); fillList(init.getClassBody().getMembers(), constantBody.rawMembers()); ec.astBody(constantBody);
if (vd.init instanceof JCNewClass) { JCNewClass init = (JCNewClass) vd.init; fillList(init.getArguments(), ec.rawArguments()); if (init.getClassBody() != null) { NormalTypeBody constantBody = setPos(init, new NormalTypeBody()); fillList(init.getClassBody().getMembers(), constantBody.rawMembers()); ec.astBody(constantBody);
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c))); Symbol constructor = accessConstructor(tree.pos(), tree.constructor); if (constructor != tree.constructor) { tree.args = tree.args.append(makeNull()); } else if (c.isLocal()) { thisArg = makeThis(tree.pos(), c.type.getEnclosingType().tsym); } else { thisArg = makeOwnerThis(tree.pos(), c, false);
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c))); Symbol constructor = accessConstructor(tree.pos(), tree.constructor); if (constructor != tree.constructor) { tree.args = tree.args.append(makeNull()); } else if (c.isLocal()) { thisArg = makeThis(tree.pos(), c.type.getEnclosingType().tsym); } else { thisArg = makeOwnerThis(tree.pos(), c, false);
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c))); Symbol constructor = accessConstructor(tree.pos(), tree.constructor); if (constructor != tree.constructor) { tree.args = tree.args.append(makeNull()); } else if ((c.owner.kind & (MTH | VAR)) != 0) { thisArg = makeThis(tree.pos(), c.type.getEnclosingType().tsym); } else { thisArg = makeOwnerThis(tree.pos(), c, false);
make.Type( symTab.objectType ), List.nil(), tree.getArguments() ); argsArray.type = new Type.ArrayType( symTab.objectType, symTab.arrayClass );
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c))); Symbol constructor = accessConstructor(tree.pos(), tree.constructor); if (constructor != tree.constructor) { tree.args = tree.args.append(makeNull()); } else if ((c.owner.kind & (MTH | VAR)) != 0) { thisArg = makeThis(tree.pos(), c.type.getEnclosingType().tsym); } else { thisArg = makeOwnerThis(tree.pos(), c, false);
make.Type( symTab.objectType ), List.nil(), tree.getArguments() ); argsArray.type = new Type.ArrayType( symTab.objectType, symTab.arrayClass );
int argumentIndex = context.argumentIndex; List<JCTree.JCExpression> argumentExpressions = newClass.getArguments(); java.util.List<String> arguments = getArgumentsType(context, argumentExpressions); context.setArgumentIndex(argumentIndex); JCTree.JCExpression identifier = newClass.getIdentifier(); String name = identifier.toString(); JCTree.JCClassDecl classBody = newClass.getClassBody(); analyzeParsedTree(context, classBody);
private static HeldLockSet handleMonitorGuards(VisitorState state, HeldLockSet locks) { JCNewClass newClassTree = ASTHelpers.findEnclosingNode(state.getPath(), JCNewClass.class); if (newClassTree == null) { return locks; } Symbol clazzSym = ASTHelpers.getSymbol(newClassTree.clazz); if (!(clazzSym instanceof ClassSymbol)) { return locks; } if (!((ClassSymbol) clazzSym).fullname.contentEquals(MONITOR_GUARD_CLASS)) { return locks; } Optional<GuardedByExpression> lockExpression = GuardedByBinder.bindExpression( Iterables.getOnlyElement(newClassTree.getArguments()), state); if (!lockExpression.isPresent()) { return locks; } return locks.plus(lockExpression.get()); }
public void visitNewClass(JCNewClass tree) { // Enclosing instances or anonymous classes should have been eliminated // by now. Assert.check(tree.encl == null && tree.def == null); setTypeAnnotationPositions(tree.pos); code.emitop2(new_, makeRef(tree.pos(), tree.type)); code.emitop0(dup); // Generate code for all arguments, where the expected types are // the parameters of the constructor's external type (that is, // any implicit outer instance appears as first parameter). genArgs(tree.args, tree.constructor.externalType(types).getParameterTypes()); items.makeMemberItem(tree.constructor, true).invoke(); result = items.makeStackItem(tree.type); }
public void visitNewClass(JCNewClass tree) { // Enclosing instances or anonymous classes should have been eliminated // by now. Assert.check(tree.encl == null && tree.def == null); setTypeAnnotationPositions(tree.pos); code.emitop2(new_, makeRef(tree.pos(), tree.type)); code.emitop0(dup); // Generate code for all arguments, where the expected types are // the parameters of the constructor's external type (that is, // any implicit outer instance appears as first parameter). genArgs(tree.args, tree.constructor.externalType(types).getParameterTypes()); items.makeMemberItem(tree.constructor, true).invoke(); result = items.makeStackItem(tree.type); }
public void visitNewClass(JCNewClass tree) { // Enclosing instances or anonymous classes should have been eliminated // by now. assert tree.encl == null && tree.def == null; code.emitop2(new_, makeRef(tree.pos(), tree.type)); code.emitop0(dup); // Generate code for all arguments, where the expected types are // the parameters of the constructor's external type (that is, // any implicit outer instance appears as first parameter). genArgs(tree.args, tree.constructor.externalType(types).getParameterTypes()); items.makeMemberItem(tree.constructor, true).invoke(); result = items.makeStackItem(tree.type); }
public void visitNewClass(JCNewClass tree) { // Enclosing instances or anonymous classes should have been eliminated // by now. assert tree.encl == null && tree.def == null; code.emitop2(new_, makeRef(tree.pos(), tree.type)); code.emitop0(dup); // Generate code for all arguments, where the expected types are // the parameters of the constructor's external type (that is, // any implicit outer instance appears as first parameter). genArgs(tree.args, tree.constructor.externalType(types).getParameterTypes()); items.makeMemberItem(tree.constructor, true).invoke(); result = items.makeStackItem(tree.type); }