1582 Type clazztype = attribType(clazz, env); |
1582 Type clazztype = attribType(clazz, env); |
1583 Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null); |
1583 Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null); |
1584 if (!TreeInfo.isDiamond(tree)) { |
1584 if (!TreeInfo.isDiamond(tree)) { |
1585 clazztype = chk.checkClassType( |
1585 clazztype = chk.checkClassType( |
1586 tree.clazz.pos(), clazztype, true); |
1586 tree.clazz.pos(), clazztype, true); |
|
1587 } else if (!clazztype.isErroneous() && |
|
1588 !clazztype.tsym.type.isParameterized()) { |
|
1589 log.error(tree.clazz.pos(), |
|
1590 "cant.apply.diamond.1", |
|
1591 clazztype, diags.fragment("diamond.non.generic", clazztype)); |
1587 } |
1592 } |
1588 chk.validate(clazz, localEnv); |
1593 chk.validate(clazz, localEnv); |
1589 if (tree.encl != null) { |
1594 if (tree.encl != null) { |
1590 // We have to work in this case to store |
1595 // We have to work in this case to store |
1591 // symbol + type back into the attributed tree. |
1596 // symbol + type back into the attributed tree. |
1607 |
1612 |
1608 // Attribute constructor arguments. |
1613 // Attribute constructor arguments. |
1609 List<Type> argtypes = attribArgs(tree.args, localEnv); |
1614 List<Type> argtypes = attribArgs(tree.args, localEnv); |
1610 List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv); |
1615 List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv); |
1611 |
1616 |
1612 if (TreeInfo.isDiamond(tree)) { |
1617 if (TreeInfo.isDiamond(tree) && clazztype.tsym.type.isParameterized()) { |
1613 clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes); |
1618 clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes); |
1614 clazz.type = clazztype; |
1619 clazz.type = clazztype; |
1615 } else if (allowDiamondFinder && |
1620 } else if (allowDiamondFinder && |
1616 clazztype.getTypeArguments().nonEmpty() && |
1621 clazztype.getTypeArguments().nonEmpty() && |
1617 findDiamonds) { |
1622 findDiamonds) { |