< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java

Print this page




 644         tree.meth = translate(tree.meth, null);
 645         Symbol meth = TreeInfo.symbol(tree.meth);
 646         Type mt = meth.erasure(types);
 647         boolean useInstantiatedPtArgs =
 648                 allowGraphInference && !types.isSignaturePolymorphic((MethodSymbol)meth.baseSymbol());
 649         List<Type> argtypes = useInstantiatedPtArgs ?
 650                 tree.meth.type.getParameterTypes() :
 651                 mt.getParameterTypes();
 652         if (meth.name == names.init && meth.owner == syms.enumSym)
 653             argtypes = argtypes.tail.tail;
 654         if (tree.varargsElement != null)
 655             tree.varargsElement = types.erasure(tree.varargsElement);
 656         else
 657             if (tree.args.length() != argtypes.length()) {
 658                 Assert.error(String.format("Incorrect number of arguments; expected %d, found %d",
 659                         tree.args.length(), argtypes.length()));
 660             }
 661         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 662 
 663         tree.type = types.erasure(tree.type);

 664         // Insert casts of method invocation results as needed.
 665         result = retype(tree, mt.getReturnType(), pt);



 666     }
 667 
 668     public void visitNewClass(JCNewClass tree) {
 669         if (tree.encl != null) {
 670             if (tree.def == null) {
 671                 tree.encl = translate(tree.encl, erasure(tree.encl.type));
 672             } else {
 673                 tree.args = tree.args.prepend(attr.makeNullCheck(tree.encl));
 674                 tree.encl = null;
 675             }
 676         }
 677 
 678         Type erasedConstructorType = tree.constructorType != null ?
 679                 erasure(tree.constructorType) :
 680                 null;
 681 
 682         List<Type> argtypes = erasedConstructorType != null && allowGraphInference ?
 683                 erasedConstructorType.getParameterTypes() :
 684                 tree.constructor.erasure(types).getParameterTypes();
 685 




 644         tree.meth = translate(tree.meth, null);
 645         Symbol meth = TreeInfo.symbol(tree.meth);
 646         Type mt = meth.erasure(types);
 647         boolean useInstantiatedPtArgs =
 648                 allowGraphInference && !types.isSignaturePolymorphic((MethodSymbol)meth.baseSymbol());
 649         List<Type> argtypes = useInstantiatedPtArgs ?
 650                 tree.meth.type.getParameterTypes() :
 651                 mt.getParameterTypes();
 652         if (meth.name == names.init && meth.owner == syms.enumSym)
 653             argtypes = argtypes.tail.tail;
 654         if (tree.varargsElement != null)
 655             tree.varargsElement = types.erasure(tree.varargsElement);
 656         else
 657             if (tree.args.length() != argtypes.length()) {
 658                 Assert.error(String.format("Incorrect number of arguments; expected %d, found %d",
 659                         tree.args.length(), argtypes.length()));
 660             }
 661         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 662 
 663         tree.type = types.erasure(tree.type);
 664         Object constant = tree.type.constValue();
 665         // Insert casts of method invocation results as needed.
 666         result = retype(tree, mt.getReturnType(), pt);
 667         if (constant != null) {
 668             tree.type = tree.type.constType(constant);
 669         }
 670     }
 671 
 672     public void visitNewClass(JCNewClass tree) {
 673         if (tree.encl != null) {
 674             if (tree.def == null) {
 675                 tree.encl = translate(tree.encl, erasure(tree.encl.type));
 676             } else {
 677                 tree.args = tree.args.prepend(attr.makeNullCheck(tree.encl));
 678                 tree.encl = null;
 679             }
 680         }
 681 
 682         Type erasedConstructorType = tree.constructorType != null ?
 683                 erasure(tree.constructorType) :
 684                 null;
 685 
 686         List<Type> argtypes = erasedConstructorType != null && allowGraphInference ?
 687                 erasedConstructorType.getParameterTypes() :
 688                 tree.constructor.erasure(types).getParameterTypes();
 689 


< prev index next >