langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 8430 be3e5581ea25
parent 8239 d2c934e951e2
child 8622 4f032629a0fd
equal deleted inserted replaced
8429:510df4cd65d7 8430:be3e5581ea25
   774                 else {
   774                 else {
   775                     // Theoretically, this can't happen, but it is possible
   775                     // Theoretically, this can't happen, but it is possible
   776                     // due to error recovery or mixing incompatible class files
   776                     // due to error recovery or mixing incompatible class files
   777                     return ambiguityError(m1, m2);
   777                     return ambiguityError(m1, m2);
   778                 }
   778                 }
       
   779                 List<Type> allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes());
       
   780                 Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown);
   779                 MethodSymbol result = new MethodSymbol(
   781                 MethodSymbol result = new MethodSymbol(
   780                         mostSpecific.flags(),
   782                         mostSpecific.flags(),
   781                         mostSpecific.name,
   783                         mostSpecific.name,
   782                         null,
   784                         newSig,
   783                         mostSpecific.owner) {
   785                         mostSpecific.owner) {
   784                     @Override
   786                     @Override
   785                     public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
   787                     public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
   786                         if (origin == site.tsym)
   788                         if (origin == site.tsym)
   787                             return this;
   789                             return this;
   788                         else
   790                         else
   789                             return super.implementation(origin, types, checkResult);
   791                             return super.implementation(origin, types, checkResult);
   790                     }
   792                     }
   791                 };
   793                 };
   792                 result.type = (Type)mostSpecific.type.clone();
       
   793                 result.type.setThrown(chk.intersect(mt1.getThrownTypes(),
       
   794                                                     mt2.getThrownTypes()));
       
   795                 return result;
   794                 return result;
   796             }
   795             }
   797             if (m1SignatureMoreSpecific) return m1;
   796             if (m1SignatureMoreSpecific) return m1;
   798             if (m2SignatureMoreSpecific) return m2;
   797             if (m2SignatureMoreSpecific) return m2;
   799             return ambiguityError(m1, m2);
   798             return ambiguityError(m1, m2);
   850                 //argument (array type) is removed
   849                 //argument (array type) is removed
   851                 args.appendList(toArgs.reverse().tail.reverse());
   850                 args.appendList(toArgs.reverse().tail.reverse());
   852             }
   851             }
   853             //append varargs element type as last synthetic formal
   852             //append varargs element type as last synthetic formal
   854             args.append(types.elemtype(varargsTypeTo));
   853             args.append(types.elemtype(varargsTypeTo));
   855             MethodSymbol msym = new MethodSymbol(to.flags_field,
   854             Type mtype = types.createMethodTypeWithParameters(to.type, args.toList());
   856                                                  to.name,
   855             return new MethodSymbol(to.flags_field, to.name, mtype, to.owner);
   857                                                  (Type)to.type.clone(), //see: 6990136
       
   858                                                  to.owner);
       
   859             MethodType mtype = msym.type.asMethodType();
       
   860             mtype.argtypes = args.toList();
       
   861             return msym;
       
   862         } else {
   856         } else {
   863             return to;
   857             return to;
   864         }
   858         }
   865     }
   859     }
   866     //where
   860     //where