content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
add ar-tn locale
f3b97530e7c3cb3fe35b3a0983d1d04ba811f04b
<ide><path>locale/ar-tn.js <add>// moment.js locale configuration <add>// locale : Tunisian Arabic (ar-tn) <add> <add>(function (factory) { <add> if (typeof define === 'function' && define.amd) { <add> define(['moment'], factory); // AMD <add> } else if (typeof exports === 'object') { <add> module.exports = factory(require('../moment')); // Node <add> } else { <add> factory((typeof global !== 'undefined' ? global : this).moment); // node or other global <add> } <add>}(function (moment) { <add> return moment.defineLocale('ar-tn', { <add> months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), <add> monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), <add> weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), <add> weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), <add> weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), <add> longDateFormat: { <add> LT: 'HH:mm', <add> LTS: 'LT:ss', <add> L: 'DD/MM/YYYY', <add> LL: 'D MMMM YYYY', <add> LLL: 'D MMMM YYYY LT', <add> LLLL: 'dddd D MMMM YYYY LT' <add> }, <add> calendar: { <add> sameDay: '[اليوم على الساعة] LT', <add> nextDay: '[غدا على الساعة] LT', <add> nextWeek: 'dddd [على الساعة] LT', <add> lastDay: '[أمس على الساعة] LT', <add> lastWeek: 'dddd [على الساعة] LT', <add> sameElse: 'L' <add> }, <add> relativeTime: { <add> future: 'في %s', <add> past: 'منذ %s', <add> s: 'ثوان', <add> m: 'دقيقة', <add> mm: '%d دقائق', <add> h: 'ساعة', <add> hh: '%d ساعات', <add> d: 'يوم', <add> dd: '%d أيام', <add> M: 'شهر', <add> MM: '%d أشهر', <add> y: 'سنة', <add> yy: '%d سنوات' <add> }, <add> week: { <add> dow: 1, // Monday is the first day of the week. <add> doy: 4 // The week that contains Jan 4th is the first week of the year. <add> } <add> }); <add>})); <ide><path>test/locale/ar-tn.js <add>// moment.js Tunisian arabic (ar-tn) tests <add> <add>var moment = require('../../moment'); <add> <add>exports['locale:ar-tn'] = { <add> setUp : function (cb) { <add> moment.locale('ar-tn'); <add> moment.createFromInputFallback = function () { <add> throw new Error('input not handled by moment'); <add> }; <add> cb(); <add> }, <add> <add> tearDown : function (cb) { <add> moment.locale('en'); <add> cb(); <add> }, <add> <add> 'parse' : function (test) { <add> var tests = 'جانفي:جانفي_فيفري:فيفري_مارس:مارس_أفريل:أفريل_ماي:ماي_جوان:جوان_جويلية:جويلية_أوت:أوت_سبتمبر:سبتمبر_أكتوبر:أكتوبر_نوفمبر:نوفمبر_ديسمبر:ديسمبر'.split('_'), <add> i; <add> <add> function equalTest(input, mmm, i) { <add> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); <add> } <add> for (i = 0; i < 12; i++) { <add> tests[i] = tests[i].split(':'); <add> equalTest(tests[i][0], 'MMM', i); <add> equalTest(tests[i][1], 'MMM', i); <add> equalTest(tests[i][0], 'MMMM', i); <add> equalTest(tests[i][1], 'MMMM', i); <add> equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); <add> equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); <add> equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); <add> equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); <add> } <add> test.done(); <add> }, <add> <add> 'format' : function (test) { <add> var a = [ <add> ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد, فيفري 14 2010, 3:25:50 pm'], <add> ['ddd, hA', 'أحد, 3PM'], <add> ['M Mo MM MMMM MMM', '2 2 02 فيفري فيفري'], <add> ['YYYY YY', '2010 10'], <add> ['D Do DD', '14 14 14'], <add> ['d do dddd ddd dd', '0 0 الأحد أحد ح'], <add> ['DDD DDDo DDDD', '45 45 045'], <add> ['w wo ww', '6 6 06'], <add> ['h hh', '3 03'], <add> ['H HH', '15 15'], <add> ['m mm', '25 25'], <add> ['s ss', '50 50'], <add> ['a A', 'pm PM'], <add> ['[the] DDDo [day of the year]', 'the 45 day of the year'], <add> ['LT', '15:25'], <add> ['LTS', '15:25:50'], <add> ['L', '14/02/2010'], <add> ['LL', '14 فيفري 2010'], <add> ['LLL', '14 فيفري 2010 15:25'], <add> ['LLLL', 'الأحد 14 فيفري 2010 15:25'], <add> ['l', '14/2/2010'], <add> ['ll', '14 فيفري 2010'], <add> ['lll', '14 فيفري 2010 15:25'], <add> ['llll', 'أحد 14 فيفري 2010 15:25'] <add> ], <add> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), <add> i; <add> for (i = 0; i < a.length; i++) { <add> test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); <add> } <add> test.done(); <add> }, <add> <add> 'format ordinal' : function (test) { <add> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); <add> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); <add> test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); <add> test.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); <add> test.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); <add> test.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); <add> test.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); <add> test.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); <add> test.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); <add> test.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); <add> <add> test.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); <add> test.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); <add> test.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); <add> test.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); <add> test.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); <add> test.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); <add> test.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); <add> test.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); <add> test.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); <add> test.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); <add> <add> test.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); <add> test.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); <add> test.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); <add> test.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); <add> test.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); <add> test.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); <add> test.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); <add> test.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); <add> test.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); <add> test.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); <add> <add> test.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); <add> test.done(); <add> }, <add> <add> 'format month' : function (test) { <add> var expected = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.split('_'), <add> i; <add> for (i = 0; i < expected.length; i++) { <add> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); <add> } <add> test.done(); <add> }, <add> <add> 'format week' : function (test) { <add> var expected = 'الأحد أحد ح_الإثنين إثنين ن_الثلاثاء ثلاثاء ث_الأربعاء أربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), <add> i; <add> for (i = 0; i < expected.length; i++) { <add> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); <add> } <add> test.done(); <add> }, <add> <add> 'from' : function (test) { <add> var start = moment([2007, 1, 28]); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> s: 44 <add> }), true), 'ثوان', '44 seconds = a few seconds'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> s: 45 <add> }), true), 'دقيقة', '45 seconds = a minute'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> s: 89 <add> }), true), 'دقيقة', '89 seconds = a minute'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> s: 90 <add> }), true), '2 دقائق', '90 seconds = 2 minutes'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> m: 44 <add> }), true), '44 دقائق', '44 minutes = 44 minutes'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> m: 45 <add> }), true), 'ساعة', '45 minutes = an hour'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> m: 89 <add> }), true), 'ساعة', '89 minutes = an hour'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> m: 90 <add> }), true), '2 ساعات', '90 minutes = 2 hours'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> h: 5 <add> }), true), '5 ساعات', '5 hours = 5 hours'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> h: 21 <add> }), true), '21 ساعات', '21 hours = 21 hours'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> h: 22 <add> }), true), 'يوم', '22 hours = a day'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> h: 35 <add> }), true), 'يوم', '35 hours = a day'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> h: 36 <add> }), true), '2 أيام', '36 hours = 2 days'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 1 <add> }), true), 'يوم', '1 day = a day'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 5 <add> }), true), '5 أيام', '5 days = 5 days'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 25 <add> }), true), '25 أيام', '25 days = 25 days'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 26 <add> }), true), 'شهر', '26 days = a month'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 30 <add> }), true), 'شهر', '30 days = a month'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 43 <add> }), true), 'شهر', '43 days = a month'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 46 <add> }), true), '2 أشهر', '46 days = 2 months'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 74 <add> }), true), '2 أشهر', '75 days = 2 months'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 76 <add> }), true), '3 أشهر', '76 days = 3 months'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> M: 1 <add> }), true), 'شهر', '1 month = a month'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> M: 5 <add> }), true), '5 أشهر', '5 months = 5 months'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 345 <add> }), true), 'سنة', '345 days = a year'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> d: 548 <add> }), true), '2 سنوات', '548 days = 2 years'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> y: 1 <add> }), true), 'سنة', '1 year = a year'); <add> test.equal(start.from(moment([2007, 1, 28]).add({ <add> y: 5 <add> }), true), '5 سنوات', '5 years = 5 years'); <add> test.done(); <add> }, <add> <add> 'suffix' : function (test) { <add> test.equal(moment(30000).from(0), 'في ثوان', 'prefix'); <add> test.equal(moment(0).from(30000), 'منذ ثوان', 'suffix'); <add> test.done(); <add> }, <add> <add> 'now from now' : function (test) { <add> test.equal(moment().fromNow(), 'منذ ثوان', 'now from now should display as in the past'); <add> test.done(); <add> }, <add> <add> 'fromNow' : function (test) { <add> test.equal(moment().add({ <add> s: 30 <add> }).fromNow(), 'في ثوان', 'in a few seconds'); <add> test.equal(moment().add({ <add> d: 5 <add> }).fromNow(), 'في 5 أيام', 'in 5 days'); <add> test.done(); <add> }, <add> <add> 'calendar day' : function (test) { <add> var a = moment().hours(2).minutes(0).seconds(0); <add> <add> test.equal(moment(a).calendar(), 'اليوم على الساعة 02:00', 'today at the same time'); <add> test.equal(moment(a).add({ <add> m: 25 <add> }).calendar(), 'اليوم على الساعة 02:25', 'Now plus 25 min'); <add> test.equal(moment(a).add({ <add> h: 1 <add> }).calendar(), 'اليوم على الساعة 03:00', 'Now plus 1 hour'); <add> test.equal(moment(a).add({ <add> d: 1 <add> }).calendar(), 'غدا على الساعة 02:00', 'tomorrow at the same time'); <add> test.equal(moment(a).subtract({ <add> h: 1 <add> }).calendar(), 'اليوم على الساعة 01:00', 'Now minus 1 hour'); <add> test.equal(moment(a).subtract({ <add> d: 1 <add> }).calendar(), 'أمس على الساعة 02:00', 'yesterday at the same time'); <add> test.done(); <add> }, <add> <add> 'calendar next week' : function (test) { <add> var i, m; <add> for (i = 2; i < 7; i++) { <add> m = moment().add({ <add> d: i <add> }); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days current time'); <add> m.hours(0).minutes(0).seconds(0).milliseconds(0); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days beginning of day'); <add> m.hours(23).minutes(59).seconds(59).milliseconds(999); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days end of day'); <add> } <add> test.done(); <add> }, <add> <add> 'calendar last week' : function (test) { <add> var i, m; <add> for (i = 2; i < 7; i++) { <add> m = moment().subtract({ <add> d: i <add> }); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days current time'); <add> m.hours(0).minutes(0).seconds(0).milliseconds(0); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days beginning of day'); <add> m.hours(23).minutes(59).seconds(59).milliseconds(999); <add> test.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days end of day'); <add> } <add> test.done(); <add> }, <add> <add> 'calendar all else': function (test) { <add> var weeksAgo = moment().subtract({ <add> w: 1 <add> }), <add> weeksFromNow = moment().add({ <add> w: 1 <add> }); <add> <add> test.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); <add> test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); <add> <add> weeksAgo = moment().subtract({ <add> w: 2 <add> }); <add> weeksFromNow = moment().add({ <add> w: 2 <add> }); <add> <add> test.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); <add> test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); <add> test.done(); <add> }, <add> <add> <add> // Monday is the first day of the week. <add> // The week that contains Jan 4th is the first week of the year. <add> <add> 'weeks year starting sunday' : function (test) { <add> test.equal(moment([2012, 0, 1]).week(), 52, 'Jan 1 2012 should be week 52'); <add> test.equal(moment([2012, 0, 2]).week(), 1, 'Jan 2 2012 should be week 1'); <add> test.equal(moment([2012, 0, 8]).week(), 1, 'Jan 8 2012 should be week 1'); <add> test.equal(moment([2012, 0, 9]).week(), 2, 'Jan 9 2012 should be week 2'); <add> test.equal(moment([2012, 0, 15]).week(), 2, 'Jan 15 2012 should be week 2'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting monday' : function (test) { <add> test.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); <add> test.equal(moment([2007, 0, 7]).week(), 1, 'Jan 7 2007 should be week 1'); <add> test.equal(moment([2007, 0, 8]).week(), 2, 'Jan 8 2007 should be week 2'); <add> test.equal(moment([2007, 0, 14]).week(), 2, 'Jan 14 2007 should be week 2'); <add> test.equal(moment([2007, 0, 15]).week(), 3, 'Jan 15 2007 should be week 3'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting tuesday' : function (test) { <add> test.equal(moment([2007, 11, 31]).week(), 1, 'Dec 31 2007 should be week 1'); <add> test.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); <add> test.equal(moment([2008, 0, 6]).week(), 1, 'Jan 6 2008 should be week 1'); <add> test.equal(moment([2008, 0, 7]).week(), 2, 'Jan 7 2008 should be week 2'); <add> test.equal(moment([2008, 0, 13]).week(), 2, 'Jan 13 2008 should be week 2'); <add> test.equal(moment([2008, 0, 14]).week(), 3, 'Jan 14 2008 should be week 3'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting wednesday' : function (test) { <add> test.equal(moment([2002, 11, 30]).week(), 1, 'Dec 30 2002 should be week 1'); <add> test.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); <add> test.equal(moment([2003, 0, 5]).week(), 1, 'Jan 5 2003 should be week 1'); <add> test.equal(moment([2003, 0, 6]).week(), 2, 'Jan 6 2003 should be week 2'); <add> test.equal(moment([2003, 0, 12]).week(), 2, 'Jan 12 2003 should be week 2'); <add> test.equal(moment([2003, 0, 13]).week(), 3, 'Jan 13 2003 should be week 3'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting thursday' : function (test) { <add> test.equal(moment([2008, 11, 29]).week(), 1, 'Dec 29 2008 should be week 1'); <add> test.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); <add> test.equal(moment([2009, 0, 4]).week(), 1, 'Jan 4 2009 should be week 1'); <add> test.equal(moment([2009, 0, 5]).week(), 2, 'Jan 5 2009 should be week 2'); <add> test.equal(moment([2009, 0, 11]).week(), 2, 'Jan 11 2009 should be week 2'); <add> test.equal(moment([2009, 0, 13]).week(), 3, 'Jan 12 2009 should be week 3'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting friday' : function (test) { <add> test.equal(moment([2009, 11, 28]).week(), 53, 'Dec 28 2009 should be week 53'); <add> test.equal(moment([2010, 0, 1]).week(), 53, 'Jan 1 2010 should be week 53'); <add> test.equal(moment([2010, 0, 3]).week(), 53, 'Jan 3 2010 should be week 53'); <add> test.equal(moment([2010, 0, 4]).week(), 1, 'Jan 4 2010 should be week 1'); <add> test.equal(moment([2010, 0, 10]).week(), 1, 'Jan 10 2010 should be week 1'); <add> test.equal(moment([2010, 0, 11]).week(), 2, 'Jan 11 2010 should be week 2'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting saturday' : function (test) { <add> test.equal(moment([2010, 11, 27]).week(), 52, 'Dec 27 2010 should be week 52'); <add> test.equal(moment([2011, 0, 1]).week(), 52, 'Jan 1 2011 should be week 52'); <add> test.equal(moment([2011, 0, 2]).week(), 52, 'Jan 2 2011 should be week 52'); <add> test.equal(moment([2011, 0, 3]).week(), 1, 'Jan 3 2011 should be week 1'); <add> test.equal(moment([2011, 0, 9]).week(), 1, 'Jan 9 2011 should be week 1'); <add> test.equal(moment([2011, 0, 10]).week(), 2, 'Jan 10 2011 should be week 2'); <add> <add> test.done(); <add> }, <add> <add> 'weeks year starting sunday formatted' : function (test) { <add> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); <add> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); <add> test.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); <add> test.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); <add> test.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); <add> <add> test.done(); <add> }, <add> <add> 'lenient ordinal parsing': function (test) { <add> var i, ordinalStr, testMoment; <add> for (i = 1; i <= 31; ++i) { <add> ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); <add> testMoment = moment(ordinalStr, 'YYYY MM Do'); <add> test.equal(testMoment.year(), 2014, <add> 'lenient ordinal parsing ' + i + ' year check'); <add> test.equal(testMoment.month(), 0, <add> 'lenient ordinal parsing ' + i + ' month check'); <add> test.equal(testMoment.date(), i, <add> 'lenient ordinal parsing ' + i + ' date check'); <add> } <add> test.done(); <add> }, <add> <add> 'lenient ordinal parsing of number': function (test) { <add> var i, testMoment; <add> for (i = 1; i <= 31; ++i) { <add> testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); <add> test.equal(testMoment.year(), 2014, <add> 'lenient ordinal parsing of number ' + i + ' year check'); <add> test.equal(testMoment.month(), 0, <add> 'lenient ordinal parsing of number ' + i + ' month check'); <add> test.equal(testMoment.date(), i, <add> 'lenient ordinal parsing of number ' + i + ' date check'); <add> } <add> test.done(); <add> }, <add> <add> 'strict ordinal parsing': function (test) { <add> var i, ordinalStr, testMoment; <add> for (i = 1; i <= 31; ++i) { <add> ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); <add> testMoment = moment(ordinalStr, 'YYYY MM Do', true); <add> test.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); <add> } <add> test.done(); <add> } <add>};
2
Ruby
Ruby
fix failing test
3b2ea8b68352c1c4534ff30a086a16d00e8a12cf
<ide><path>activerecord/lib/active_record/persistence.rb <ide> def update_columns(attributes) <ide> verify_readonly_attribute(key.to_s) <ide> end <ide> <add> id_in_database = self.id_in_database <ide> attributes.each do |k, v| <ide> write_attribute_without_type_cast(k, v) <ide> end
1
PHP
PHP
fix doc block
6c915b8ba5505d819c949a4b8fac8009d902876d
<ide><path>src/Illuminate/Routing/Router.php <ide> public function currentRouteName() <ide> } <ide> <ide> /** <del> * Alias for the "currentRouteName" method. <add> * Alias for the "currentRouteNamed" method. <ide> * <ide> * @param mixed string <ide> * @return bool
1
PHP
PHP
add strict typing to http/**
33168b47f37954f88bbdd8b1a5f11ec3df53deff
<ide><path>src/Controller/Component/RequestHandlerComponent.php <ide> public function beforeRender(EventInterface $event): void <ide> $request = $controller->getRequest(); <ide> <ide> $isRecognized = ( <add> $this->ext && <ide> !in_array($this->ext, ['html', 'htm']) && <ide> $response->getMimeType($this->ext) <ide> ); <ide><path>src/Core/HttpApplicationInterface.php <ide> interface HttpApplicationInterface <ide> * <ide> * @return void <ide> */ <del> public function bootstrap(); <add> public function bootstrap(): void; <ide> <ide> /** <ide> * Define the routes for an application. <ide> public function bootstrap(); <ide> * @param \Cake\Routing\RouteBuilder $routes A route builder to add routes into. <ide> * @return void <ide> */ <del> public function routes($routes); <add> public function routes($routes): void; <ide> <ide> /** <ide> * Define the HTTP middleware layers for an application. <ide> public function middleware($middleware); <ide> * @param callable $next The next middleware <ide> * @return \Psr\Http\Message\ResponseInterface <ide> */ <del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next): ResponseInterface; <add> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface; <ide> } <ide><path>src/Event/EventDispatcherInterface.php <ide> public function dispatchEvent(string $name, $data = null, $subject = null): Even <ide> * @param \Cake\Event\EventManagerInterface $eventManager the eventManager to set <ide> * @return \Cake\Event\EventDispatcherInterface <ide> */ <del> public function setEventManager(EventManagerInterface $eventManager): self; <add> public function setEventManager(EventManagerInterface $eventManager): EventDispatcherInterface; <ide> <ide> /** <ide> * Returns the Cake\Event\EventManager manager instance for this object. <ide><path>src/Http/ActionDispatcher.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> use Cake\Controller\Controller; <ide> use Cake\Event\EventDispatcherInterface; <ide> use Cake\Event\EventDispatcherTrait; <add>use Cake\Event\EventManager; <add>use Cake\Http\ControllerFactory; <add>use Cake\Http\Response; <ide> use Cake\Routing\Router; <ide> use LogicException; <ide> <ide> class ActionDispatcher implements EventDispatcherInterface <ide> * @param \Cake\Http\ControllerFactory|null $factory A controller factory instance. <ide> * @param \Cake\Event\EventManager|null $eventManager An event manager if you want to inject one. <ide> */ <del> public function __construct($factory = null, $eventManager = null) <add> public function __construct(?ControllerFactory $factory = null, ?EventManager $eventManager = null) <ide> { <ide> if ($eventManager) { <ide> $this->setEventManager($eventManager); <ide> public function __construct($factory = null, $eventManager = null) <ide> * @return \Cake\Http\Response A modified/replaced response. <ide> * @throws \ReflectionException <ide> */ <del> public function dispatch(ServerRequest $request, Response $response) <add> public function dispatch(ServerRequest $request, Response $response): Response <ide> { <ide> if (Router::getRequest(true) !== $request) { <ide> Router::pushRequest($request); <ide> public function dispatch(ServerRequest $request, Response $response) <ide> * @return \Cake\Http\Response The response <ide> * @throws \LogicException If the controller action returns a non-response value. <ide> */ <del> protected function _invoke(Controller $controller) <add> protected function _invoke(Controller $controller): Response <ide> { <ide> $this->dispatchEvent('Dispatcher.invokeController', ['controller' => $controller]); <ide> <ide> protected function _invoke(Controller $controller) <ide> * <ide> * @return array <ide> */ <del> public function getFilters() <add> public function getFilters(): array <ide> { <ide> return $this->filters; <ide> } <ide><path>src/Http/BaseApplication.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> use Cake\Core\HttpApplicationInterface; <ide> use Cake\Core\Plugin; <ide> use Cake\Core\PluginApplicationInterface; <add>use Cake\Core\PluginCollection; <ide> use Cake\Core\PluginInterface; <ide> use Cake\Event\EventDispatcherTrait; <ide> use Cake\Event\EventManager; <ide> use Cake\Event\EventManagerInterface; <add>use Cake\Http\ActionDispatcher; <add>use Cake\Http\MiddlewareQueue; <add>use Cake\Routing\RouteBuilder; <ide> use Cake\Routing\Router; <ide> use InvalidArgumentException; <ide> use Psr\Http\Message\ResponseInterface; <ide> abstract class BaseApplication implements <ide> * @param string $configDir The directory the bootstrap configuration is held in. <ide> * @param \Cake\Event\EventManagerInterface $eventManager Application event manager instance. <ide> */ <del> public function __construct($configDir, ?EventManagerInterface $eventManager = null) <add> public function __construct(string $configDir, ?EventManagerInterface $eventManager = null) <ide> { <ide> $this->configDir = $configDir; <ide> $this->plugins = Plugin::getCollection(); <ide> public function addPlugin($name, array $config = []): PluginApplicationInterface <ide> * <ide> * @return \Cake\Core\PluginCollection <ide> */ <del> public function getPlugins() <add> public function getPlugins(): PluginCollection <ide> { <ide> return $this->plugins; <ide> } <ide> public function getPlugins() <ide> * @param array $config Configuration options for the plugin <ide> * @return \Cake\Core\PluginInterface <ide> */ <del> protected function makePlugin($name, array $config) <add> protected function makePlugin(string $name, array $config): PluginInterface <ide> { <ide> $className = $name; <ide> if (strpos($className, '\\') === false) { <ide> $className = str_replace('/', '\\', $className) . '\\' . 'Plugin'; <ide> } <ide> if (class_exists($className)) { <del> return new $className($config); <add> $plugin = new $className($config); <add> if (!$plugin instanceof PluginInterface) { <add> throw new InvalidArgumentException(sprintf( <add> 'The `%s` plugin does not implement Cake\Core\PluginInterface.', <add> get_class($plugin) <add> )); <add> } <add> <add> return $plugin; <ide> } <ide> <ide> if (!isset($config['path'])) { <ide> protected function makePlugin($name, array $config) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function bootstrap() <add> public function bootstrap(): void <ide> { <ide> require_once $this->configDir . '/bootstrap.php'; <ide> } <ide> public function pluginBootstrap(): void <ide> * @param \Cake\Routing\RouteBuilder $routes A route builder to add routes into. <ide> * @return void <ide> */ <del> public function routes($routes) <add> public function routes($routes): void <ide> { <ide> // Only load routes if the router is empty <ide> if (!Router::routes()) { <ide> public function pluginConsole($commands) <ide> * @param callable $next The next middleware <ide> * @return \Psr\Http\Message\ResponseInterface <ide> */ <del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next): ResponseInterface <add> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface <ide> { <ide> return $this->getDispatcher()->dispatch($request, $response); <ide> } <ide> public function __invoke(ServerRequestInterface $request, ResponseInterface $res <ide> * <ide> * @return \Cake\Http\ActionDispatcher <ide> */ <del> protected function getDispatcher() <add> protected function getDispatcher(): ActionDispatcher <ide> { <ide> return new ActionDispatcher(null, $this->getEventManager()); <ide> } <ide><path>src/Http/CallbackStream.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Http/Client.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> use Cake\Http\Client\Adapter\Stream; <ide> use Cake\Http\Client\AdapterInterface; <ide> use Cake\Http\Client\Request; <add>use Cake\Http\Client\Response; <ide> use Cake\Http\Cookie\CookieCollection; <ide> use Cake\Http\Cookie\CookieInterface; <ide> use Cake\Utility\Hash; <ide> class Client <ide> * <ide> * @param array $config Config options for scoped clients. <ide> */ <del> public function __construct($config = []) <add> public function __construct(array $config = []) <ide> { <ide> $this->setConfig($config); <ide> <ide> public function __construct($config = []) <ide> * <ide> * @return \Cake\Http\Cookie\CookieCollection <ide> */ <del> public function cookies() <add> public function cookies(): CookieCollection <ide> { <ide> return $this->_cookies; <ide> } <ide> public function addCookie(CookieInterface $cookie) <ide> * this feature. <ide> * <ide> * @param string $url The url or path you want to request. <del> * @param array $data The query data you want to send. <add> * @param array|string $data The query data you want to send. <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function get($url, $data = [], array $options = []) <add> public function get(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $body = null; <del> if (isset($data['_content'])) { <add> if (is_array($data) && isset($data['_content'])) { <ide> $body = $data['_content']; <ide> unset($data['_content']); <ide> } <ide> public function get($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function post($url, $data = [], array $options = []) <add> public function post(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function post($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function put($url, $data = [], array $options = []) <add> public function put(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function put($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function patch($url, $data = [], array $options = []) <add> public function patch(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function patch($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function options($url, $data = [], array $options = []) <add> public function options(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function options($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function trace($url, $data = [], array $options = []) <add> public function trace(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function trace($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function delete($url, $data = [], array $options = []) <add> public function delete(string $url, $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, [], $options); <ide> public function delete($url, $data = [], array $options = []) <ide> * @param array $options Additional options for the request. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function head($url, array $data = [], array $options = []) <add> public function head(string $url, array $data = [], array $options = []): Response <ide> { <ide> $options = $this->_mergeOptions($options); <ide> $url = $this->buildUrl($url, $data, $options); <ide> public function head($url, array $data = [], array $options = []) <ide> * @param array $options The options to use. Contains auth, proxy, etc. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> protected function _doRequest($method, $url, $data, $options) <add> protected function _doRequest(string $method, string $url, $data, $options): Response <ide> { <ide> $request = $this->_createRequest( <ide> $method, <ide> protected function _doRequest($method, $url, $data, $options) <ide> * @param array $options Options to merge. <ide> * @return array Options merged with set config. <ide> */ <del> protected function _mergeOptions($options) <add> protected function _mergeOptions(array $options): array <ide> { <ide> return Hash::merge($this->_config, $options); <ide> } <ide> protected function _mergeOptions($options) <ide> * @param array $options Additional options to use. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> public function send(Request $request, array $options = []) <add> public function send(Request $request, array $options = []): Response <ide> { <ide> $redirects = 0; <ide> if (isset($options['redirect'])) { <ide> public function send(Request $request, array $options = []) <ide> * @param array $options Additional options to use. <ide> * @return \Cake\Http\Client\Response <ide> */ <del> protected function _sendRequest(Request $request, $options) <add> protected function _sendRequest(Request $request, array $options): Response <ide> { <ide> $responses = $this->_adapter->send($request, $options); <ide> $url = $request->getUri(); <ide> protected function _sendRequest(Request $request, $options) <ide> * @param array $options The config options stored with Client::config() <ide> * @return string A complete url with scheme, port, host, and path. <ide> */ <del> public function buildUrl($url, $query = [], array $options = []) <add> public function buildUrl(string $url, $query = [], array $options = []): string <ide> { <ide> if (empty($options) && empty($query)) { <ide> return $url; <ide> public function buildUrl($url, $query = [], array $options = []) <ide> * @param array $options The options to use. Contains auth, proxy, etc. <ide> * @return \Cake\Http\Client\Request <ide> */ <del> protected function _createRequest($method, $url, $data, $options) <add> protected function _createRequest(string $method, string $url, $data, $options): Request <ide> { <ide> $headers = isset($options['headers']) ? (array)$options['headers'] : []; <ide> if (isset($options['type'])) { <ide> protected function _createRequest($method, $url, $data, $options) <ide> * @return array Headers to set on the request. <ide> * @throws \Cake\Core\Exception\Exception When an unknown type alias is used. <ide> */ <del> protected function _typeHeaders($type) <add> protected function _typeHeaders(string $type): array <ide> { <ide> if (strpos($type, '/') !== false) { <ide> return [ <ide> protected function _typeHeaders($type) <ide> * @param array $options Array of options containing the 'auth' key. <ide> * @return \Cake\Http\Client\Request The updated request object. <ide> */ <del> protected function _addAuthentication(Request $request, $options) <add> protected function _addAuthentication(Request $request, array $options): Request <ide> { <ide> $auth = $options['auth']; <ide> $adapter = $this->_createAuth($auth, $options); <ide> protected function _addAuthentication(Request $request, $options) <ide> * @param array $options Array of options containing the 'proxy' key. <ide> * @return \Cake\Http\Client\Request The updated request object. <ide> */ <del> protected function _addProxy(Request $request, $options) <add> protected function _addProxy(Request $request, array $options): Request <ide> { <ide> $auth = $options['proxy']; <ide> $adapter = $this->_createAuth($auth, $options); <ide> protected function _addProxy(Request $request, $options) <ide> * @return mixed Authentication strategy instance. <ide> * @throws \Cake\Core\Exception\Exception when an invalid strategy is chosen. <ide> */ <del> protected function _createAuth($auth, $options) <add> protected function _createAuth(array $auth, array $options) <ide> { <ide> if (empty($auth['type'])) { <ide> $auth['type'] = 'basic'; <ide><path>src/Http/Client/Auth/Digest.php <ide> public function authentication(Request $request, array $credentials): Request <ide> protected function _getServerInfo(Request $request, array $credentials): array <ide> { <ide> $response = $this->_client->get( <del> $request->getUri(), <add> (string)$request->getUri(), <ide> [], <ide> ['auth' => ['type' => null]] <ide> ); <ide><path>src/Http/ControllerFactory.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function create(ServerRequest $request, Response $response) <ide> * Determine the controller class name based on current request and controller param <ide> * <ide> * @param \Cake\Http\ServerRequest $request The request to build a controller for. <del> * @return string|null <add> * @return string|false <ide> */ <ide> public function getControllerClass(ServerRequest $request) <ide> { <ide> public function getControllerClass(ServerRequest $request) <ide> * @throws \Cake\Routing\Exception\MissingControllerException <ide> * @return void <ide> */ <del> protected function missingController($request) <add> protected function missingController(ServerRequest $request): void <ide> { <ide> throw new MissingControllerException([ <ide> 'class' => $request->getParam('controller'), <ide><path>src/Http/Cookie/Cookie.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> class Cookie implements CookieInterface <ide> * @param bool $httpOnly HTTP Only <ide> */ <ide> public function __construct( <del> $name, <add> string $name, <ide> $value = '', <ide> $expiresAt = null, <del> $path = '/', <del> $domain = '', <del> $secure = false, <del> $httpOnly = false <add> string $path = '/', <add> string $domain = '', <add> bool $secure = false, <add> bool $httpOnly = false <ide> ) { <ide> $this->validateName($name); <ide> $this->name = $name; <ide> public function __construct( <ide> * <ide> * @return string <ide> */ <del> public function toHeaderValue() <add> public function toHeaderValue(): string <ide> { <ide> $value = $this->value; <ide> if ($this->isExpanded) { <ide> public function toHeaderValue() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withName($name) <add> public function withName(string $name): CookieInterface <ide> { <ide> $this->validateName($name); <ide> $new = clone $this; <ide> public function withName($name) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getId() <add> public function getId(): string <ide> { <ide> return "{$this->name};{$this->domain};{$this->path}"; <ide> } <ide> <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getName() <add> public function getName(): string <ide> { <ide> return $this->name; <ide> } <ide> public function getName() <ide> * @throws \InvalidArgumentException <ide> * @link https://tools.ietf.org/html/rfc2616#section-2.2 Rules for naming cookies. <ide> */ <del> protected function validateName($name) <add> protected function validateName(string $name): void <ide> { <ide> if (preg_match("/[=,;\t\r\n\013\014]/", $name)) { <ide> throw new InvalidArgumentException( <ide> public function getStringValue() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withValue($value) <add> public function withValue($value): CookieInterface <ide> { <ide> $new = clone $this; <ide> $new->_setValue($value); <ide> public function withValue($value) <ide> * @param mixed $value The value to store. <ide> * @return void <ide> */ <del> protected function _setValue($value) <add> protected function _setValue($value): void <ide> { <ide> $this->isExpanded = is_array($value); <ide> $this->value = $value; <ide> protected function _setValue($value) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withPath($path) <add> public function withPath(string $path): CookieInterface <ide> { <ide> $this->validateString($path); <ide> $new = clone $this; <ide> public function withPath($path) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getPath() <add> public function getPath(): string <ide> { <ide> return $this->path; <ide> } <ide> <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withDomain($domain) <add> public function withDomain(string $domain): CookieInterface <ide> { <ide> $this->validateString($domain); <ide> $new = clone $this; <ide> public function withDomain($domain) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getDomain() <add> public function getDomain(): string <ide> { <ide> return $this->domain; <ide> } <ide> public function getDomain() <ide> * @return void <ide> * @throws \InvalidArgumentException <ide> */ <del> protected function validateString($value) <add> protected function validateString(string $value): void <ide> { <ide> if (!is_string($value)) { <ide> throw new InvalidArgumentException(sprintf( <ide> protected function validateString($value) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function isSecure() <add> public function isSecure(): bool <ide> { <ide> return $this->secure; <ide> } <ide> <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withSecure($secure) <add> public function withSecure(bool $secure): CookieInterface <ide> { <ide> $this->validateBool($secure); <ide> $new = clone $this; <ide> public function withSecure($secure) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withHttpOnly($httpOnly) <add> public function withHttpOnly(bool $httpOnly): CookieInterface <ide> { <ide> $this->validateBool($httpOnly); <ide> $new = clone $this; <ide> public function withHttpOnly($httpOnly) <ide> * @return void <ide> * @throws \InvalidArgumentException <ide> */ <del> protected function validateBool($value) <add> protected function validateBool(bool $value): void <ide> { <ide> if (!is_bool($value)) { <ide> throw new InvalidArgumentException(sprintf( <ide> protected function validateBool($value) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function isHttpOnly() <add> public function isHttpOnly(): bool <ide> { <ide> return $this->httpOnly; <ide> } <ide> <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withExpiry($dateTime) <add> public function withExpiry($dateTime): CookieInterface <ide> { <ide> $new = clone $this; <ide> $new->expiresAt = $dateTime->setTimezone(new DateTimeZone('GMT')); <ide> public function getExpiry() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getExpiresTimestamp() <add> public function getExpiresTimestamp(): ?string <ide> { <ide> if (!$this->expiresAt) { <ide> return null; <ide> public function getExpiresTimestamp() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function getFormattedExpires() <add> public function getFormattedExpires(): string <ide> { <ide> if (!$this->expiresAt) { <ide> return ''; <ide> public function getFormattedExpires() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function isExpired($time = null) <add> public function isExpired($time = null): bool <ide> { <ide> $time = $time ?: new DateTimeImmutable('now', new DateTimeZone('UTC')); <ide> if (!$this->expiresAt) { <ide> public function isExpired($time = null) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withNeverExpire() <add> public function withNeverExpire(): CookieInterface <ide> { <ide> $new = clone $this; <ide> $new->expiresAt = Chronos::createFromDate(2038, 1, 1); <ide> public function withNeverExpire() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function withExpired() <add> public function withExpired(): CookieInterface <ide> { <ide> $new = clone $this; <ide> $new->expiresAt = Chronos::createFromTimestamp(1); <ide> public function withExpired() <ide> * @param string $path Path to check <ide> * @return bool <ide> */ <del> public function check($path) <add> public function check(string $path): bool <ide> { <ide> if ($this->isExpanded === false) { <ide> $this->value = $this->_expand($this->value); <ide> public function check($path) <ide> * @param mixed $value Value to write <ide> * @return static <ide> */ <del> public function withAddedValue($path, $value) <add> public function withAddedValue(string $path, $value): CookieInterface <ide> { <ide> $new = clone $this; <ide> if ($new->isExpanded === false) { <ide> public function withAddedValue($path, $value) <ide> * @param string $path Path to remove <ide> * @return static <ide> */ <del> public function withoutAddedValue($path) <add> public function withoutAddedValue(string $path): CookieInterface <ide> { <ide> $new = clone $this; <ide> if ($new->isExpanded === false) { <ide> public function withoutAddedValue($path) <ide> * @param string $path Path to read the data from <ide> * @return mixed <ide> */ <del> public function read($path = null) <add> public function read(?string $path = null) <ide> { <ide> if ($this->isExpanded === false) { <ide> $this->value = $this->_expand($this->value); <ide> public function read($path = null) <ide> * <ide> * @return bool <ide> */ <del> public function isExpanded() <add> public function isExpanded(): bool <ide> { <ide> return $this->isExpanded; <ide> } <ide> public function isExpanded() <ide> * @param array $array Map of key and values <ide> * @return string A json encoded string. <ide> */ <del> protected function _flatten(array $array) <add> protected function _flatten(array $array): string <ide> { <ide> return json_encode($array); <ide> } <ide> protected function _flatten(array $array) <ide> * @param string $string A string containing JSON encoded data, or a bare string. <ide> * @return string|array Map of key and values <ide> */ <del> protected function _expand($string) <add> protected function _expand(string $string) <ide> { <ide> $this->isExpanded = true; <ide> $first = substr($string, 0, 1); <ide><path>src/Http/Cookie/CookieCollection.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> public static function createFromServerRequest(ServerRequestInterface $request) <ide> * <ide> * @return int <ide> */ <del> public function count() <add> public function count(): int <ide> { <ide> return count($this->cookies); <ide> } <ide> public function add(CookieInterface $cookie) <ide> * @param string $name The name of the cookie. <ide> * @return \Cake\Http\Cookie\CookieInterface|null <ide> */ <del> public function get($name) <add> public function get(string $name): ?CookieInterface <ide> { <ide> $key = mb_strtolower($name); <ide> foreach ($this->cookies as $cookie) { <ide> public function get($name) <ide> * @param string $name The cookie name to check. <ide> * @return bool True if the cookie exists, otherwise false. <ide> */ <del> public function has($name) <add> public function has(string $name): bool <ide> { <ide> $key = mb_strtolower($name); <ide> foreach ($this->cookies as $cookie) { <ide> public function has($name) <ide> * @param string $name The name of the cookie to remove. <ide> * @return static <ide> */ <del> public function remove($name) <add> public function remove(string $name): self <ide> { <ide> $new = clone $this; <ide> $key = mb_strtolower($name); <ide> public function remove($name) <ide> * @return void <ide> * @throws \InvalidArgumentException <ide> */ <del> protected function checkCookies(array $cookies) <add> protected function checkCookies(array $cookies): void <ide> { <ide> foreach ($cookies as $index => $cookie) { <ide> if (!$cookie instanceof CookieInterface) { <ide> protected function checkCookies(array $cookies) <ide> * <ide> * @return \ArrayIterator <ide> */ <del> public function getIterator() <add> public function getIterator(): ArrayIterator <ide> { <ide> return new ArrayIterator($this->cookies); <ide> } <ide> public function getIterator() <ide> * is useful when you have cookie data from outside the collection you want to send. <ide> * @return \Psr\Http\Message\RequestInterface An updated request. <ide> */ <del> public function addToRequest(RequestInterface $request, array $extraCookies = []) <add> public function addToRequest(RequestInterface $request, array $extraCookies = []): RequestInterface <ide> { <ide> $uri = $request->getUri(); <ide> $cookies = $this->findMatchingCookies( <ide> public function addToRequest(RequestInterface $request, array $extraCookies = [] <ide> * @param string $path The path to match <ide> * @return array An array of cookie name/value pairs <ide> */ <del> protected function findMatchingCookies($scheme, $host, $path) <add> protected function findMatchingCookies(string $scheme, string $host, string $path): array <ide> { <ide> $out = []; <ide> $now = new DateTimeImmutable('now', new DateTimeZone('UTC')); <ide> protected function findMatchingCookies($scheme, $host, $path) <ide> * @param \Psr\Http\Message\RequestInterface $request Request to get cookie context from. <ide> * @return static <ide> */ <del> public function addFromResponse(ResponseInterface $response, RequestInterface $request) <add> public function addFromResponse(ResponseInterface $response, RequestInterface $request): self <ide> { <ide> $uri = $request->getUri(); <ide> $host = $uri->getHost(); <ide> public function addFromResponse(ResponseInterface $response, RequestInterface $r <ide> * @param string $path The path to set. <ide> * @return array An array of updated cookies. <ide> */ <del> protected function setRequestDefaults(array $cookies, $host, $path) <add> protected function setRequestDefaults(array $cookies, string $host, string $path): array <ide> { <ide> $out = []; <ide> foreach ($cookies as $name => $cookie) { <ide> protected function setRequestDefaults(array $cookies, $host, $path) <ide> * @param array $values List of Set-Cookie Header values. <ide> * @return \Cake\Http\Cookie\Cookie[] An array of cookie objects <ide> */ <del> protected static function parseSetCookieHeader($values) <add> protected static function parseSetCookieHeader(array $values): array <ide> { <ide> $cookies = []; <ide> foreach ($values as $value) { <ide> protected static function parseSetCookieHeader($values) <ide> } <ide> if ($i === 0) { <ide> $name = $key; <del> $cookie['value'] = urldecode($value); <add> $cookie['value'] = urldecode((string)$value); <ide> continue; <ide> } <ide> $key = strtolower($key); <del> if (array_key_exists($key, $cookie) && !strlen($cookie[$key])) { <add> if (array_key_exists($key, $cookie) && !strlen((string)$cookie[$key])) { <ide> $cookie[$key] = $value; <ide> } <ide> } <ide> protected static function parseSetCookieHeader($values) <ide> * @param string $path The path to check for expired cookies on. <ide> * @return void <ide> */ <del> protected function removeExpiredCookies($host, $path) <add> protected function removeExpiredCookies(string $host, string $path): void <ide> { <ide> $time = new DateTimeImmutable('now', new DateTimeZone('UTC')); <ide> $hostPattern = '/' . preg_quote($host, '/') . '$/'; <ide><path>src/Http/Cookie/CookieInterface.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> interface CookieInterface <ide> * @param string $name Name of the cookie <ide> * @return static <ide> */ <del> public function withName($name); <add> public function withName(string $name): CookieInterface; <ide> <ide> /** <ide> * Gets the cookie name <ide> * <ide> * @return string <ide> */ <del> public function getName(); <add> public function getName(): string; <ide> <ide> /** <ide> * Gets the cookie value <ide> public function getStringValue(); <ide> * @param string|array $value Value of the cookie to set <ide> * @return static <ide> */ <del> public function withValue($value); <add> public function withValue($value): CookieInterface; <ide> <ide> /** <ide> * Get the id for a cookie <ide> public function withValue($value); <ide> * <ide> * @return string <ide> */ <del> public function getId(); <add> public function getId(): string; <ide> <ide> /** <ide> * Get the path attribute. <ide> * <ide> * @return string <ide> */ <del> public function getPath(); <add> public function getPath(): string; <ide> <ide> /** <ide> * Create a new cookie with an updated path <ide> * <ide> * @param string $path Sets the path <ide> * @return static <ide> */ <del> public function withPath($path); <add> public function withPath(string $path): CookieInterface; <ide> <ide> /** <ide> * Get the domain attribute. <ide> * <ide> * @return string <ide> */ <del> public function getDomain(); <add> public function getDomain(): string; <ide> <ide> /** <ide> * Create a cookie with an updated domain <ide> * <ide> * @param string $domain Domain to set <ide> * @return static <ide> */ <del> public function withDomain($domain); <add> public function withDomain(string $domain): CookieInterface; <ide> <ide> /** <ide> * Get the current expiry time <ide> public function getExpiry(); <ide> * <ide> * @return string|null The expiry time as a string timestamp. <ide> */ <del> public function getExpiresTimestamp(); <add> public function getExpiresTimestamp(): ?string; <ide> <ide> /** <ide> * Builds the expiration value part of the header string <ide> * <ide> * @return string <ide> */ <del> public function getFormattedExpires(); <add> public function getFormattedExpires(): string; <ide> <ide> /** <ide> * Create a cookie with an updated expiration date <ide> * <ide> * @param \DateTime|\DateTimeImmutable $dateTime Date time object <ide> * @return static <ide> */ <del> public function withExpiry($dateTime); <add> public function withExpiry($dateTime): CookieInterface; <ide> <ide> /** <ide> * Create a new cookie that will virtually never expire. <ide> * <ide> * @return static <ide> */ <del> public function withNeverExpire(); <add> public function withNeverExpire(): CookieInterface; <ide> <ide> /** <ide> * Create a new cookie that will expire/delete the cookie from the browser. <ide> public function withNeverExpire(); <ide> * <ide> * @return static <ide> */ <del> public function withExpired(); <add> public function withExpired(): CookieInterface; <ide> <ide> /** <ide> * Check if a cookie is expired when compared to $time <ide> public function withExpired(); <ide> * @param \DateTime|\DateTimeImmutable $time The time to test against. Defaults to 'now' in UTC. <ide> * @return bool <ide> */ <del> public function isExpired($time = null); <add> public function isExpired($time = null): bool; <ide> <ide> /** <ide> * Check if the cookie is HTTP only <ide> * <ide> * @return bool <ide> */ <del> public function isHttpOnly(); <add> public function isHttpOnly(): bool; <ide> <ide> /** <ide> * Create a cookie with HTTP Only updated <ide> * <ide> * @param bool $httpOnly HTTP Only <ide> * @return static <ide> */ <del> public function withHttpOnly($httpOnly); <add> public function withHttpOnly(bool $httpOnly): CookieInterface; <ide> <ide> /** <ide> * Check if the cookie is secure <ide> * <ide> * @return bool <ide> */ <del> public function isSecure(); <add> public function isSecure(): bool; <ide> <ide> /** <ide> * Create a cookie with Secure updated <ide> * <ide> * @param bool $secure Secure attribute value <ide> * @return static <ide> */ <del> public function withSecure($secure); <add> public function withSecure(bool $secure): CookieInterface; <ide> <ide> /** <ide> * Returns the cookie as header value <ide> * <ide> * @return string <ide> */ <del> public function toHeaderValue(); <add> public function toHeaderValue(): string; <ide> } <ide><path>src/Http/CorsBuilder.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class CorsBuilder <ide> * @param string $origin The request's Origin header. <ide> * @param bool $isSsl Whether or not the request was over SSL. <ide> */ <del> public function __construct(MessageInterface $response, $origin, $isSsl = false) <add> public function __construct(MessageInterface $response, string $origin, bool $isSsl = false) <ide> { <ide> $this->_origin = $origin; <ide> $this->_isSsl = $isSsl; <ide> public function __construct(MessageInterface $response, $origin, $isSsl = false) <ide> * <ide> * @return \Psr\Http\Message\MessageInterface A new instance of the response with new headers. <ide> */ <del> public function build() <add> public function build(): MessageInterface <ide> { <ide> $response = $this->_response; <ide> if (empty($this->_origin)) { <ide> public function allowOrigin($domain) <ide> * @param array $domains Domain names to normalize. <ide> * @return array <ide> */ <del> protected function _normalizeDomains($domains) <add> protected function _normalizeDomains(array $domains): array <ide> { <ide> $result = []; <ide> foreach ($domains as $domain) { <ide> public function exposeHeaders(array $headers) <ide> /** <ide> * Define the max-age preflight OPTIONS requests are valid for. <ide> * <del> * @param int $age The max-age for OPTIONS requests in seconds <add> * @param int|string $age The max-age for OPTIONS requests in seconds <ide> * @return $this <ide> */ <ide> public function maxAge($age) <ide><path>src/Http/Exception/BadRequestException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 400 error. <ide> */ <ide> class BadRequestException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Bad Request' will be the message <del> * @param int $code Status code, defaults to 400 <add> * @param int|null $code Status code, defaults to 400 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Bad Request'; <ide><path>src/Http/Exception/ConflictException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 409 error. <ide> */ <ide> class ConflictException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Conflict' will be the message <del> * @param int $code Status code, defaults to 409 <add> * @param int|null $code Status code, defaults to 409 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Conflict'; <ide><path>src/Http/Exception/ForbiddenException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 403 error. <ide> */ <ide> class ForbiddenException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Forbidden' will be the message <del> * @param int $code Status code, defaults to 403 <add> * @param int|null $code Status code, defaults to 403 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Forbidden'; <ide><path>src/Http/Exception/GoneException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 410 error. <ide> */ <ide> class GoneException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Gone' will be the message <del> * @param int $code Status code, defaults to 410 <add> * @param int|null $code Status code, defaults to 410 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Gone'; <ide><path>src/Http/Exception/HttpException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Http/Exception/InternalErrorException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 500 error. <ide> */ <ide> class InternalErrorException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Internal Server Error' will be the message <del> * @param int $code Status code, defaults to 500 <add> * @param int|null $code Status code, defaults to 500 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Internal Server Error'; <ide><path>src/Http/Exception/InvalidCsrfTokenException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 403 error caused by an invalid CSRF token <ide> */ <ide> class InvalidCsrfTokenException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Invalid CSRF Token' will be the message <del> * @param int $code Status code, defaults to 403 <add> * @param int|null $code Status code, defaults to 403 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Invalid CSRF Token'; <ide><path>src/Http/Exception/MethodNotAllowedException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 405 error. <ide> */ <ide> class MethodNotAllowedException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Method Not Allowed' will be the message <del> * @param int $code Status code, defaults to 405 <add> * @param int|null $code Status code, defaults to 405 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Method Not Allowed'; <ide><path>src/Http/Exception/NotAcceptableException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 406 error. <ide> */ <ide> class NotAcceptableException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Not Acceptable' will be the message <del> * @param int $code Status code, defaults to 406 <add> * @param int|null $code Status code, defaults to 406 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Not Acceptable'; <ide><path>src/Http/Exception/NotFoundException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 404 error. <ide> */ <ide> class NotFoundException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Not Found' will be the message <del> * @param int $code Status code, defaults to 404 <add> * @param int|null $code Status code, defaults to 404 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Not Found'; <ide><path>src/Http/Exception/NotImplementedException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Http/Exception/ServiceUnavailableException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 503 error. <ide> */ <ide> class ServiceUnavailableException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Service Unavailable' will be the message <del> * @param int $code Status code, defaults to 503 <add> * @param int|null $code Status code, defaults to 503 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Service Unavailable'; <ide><path>src/Http/Exception/UnauthorizedException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 401 error. <ide> */ <ide> class UnauthorizedException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Unauthorized' will be the message <del> * @param int $code Status code, defaults to 401 <add> * @param int|null $code Status code, defaults to 401 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Unauthorized'; <ide><path>src/Http/Exception/UnavailableForLegalReasonsException.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> */ <ide> namespace Cake\Http\Exception; <ide> <add>use Exception; <add> <ide> /** <ide> * Represents an HTTP 451 error. <ide> */ <ide> class UnavailableForLegalReasonsException extends HttpException <ide> * Constructor <ide> * <ide> * @param string|null $message If no message is given 'Unavailable For Legal Reasons' will be the message <del> * @param int $code Status code, defaults to 451 <add> * @param int|null $code Status code, defaults to 451 <ide> * @param \Exception|null $previous The previous exception. <ide> */ <del> public function __construct($message = null, $code = null, $previous = null) <add> public function __construct(?string $message = null, ?int $code = null, ?Exception $previous = null) <ide> { <ide> if (empty($message)) { <ide> $message = 'Unavailable For Legal Reasons'; <ide><path>src/Http/MiddlewareQueue.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct(array $middleware = []) <ide> * @return callable|null Either the callable middleware or null <ide> * if the index is undefined. <ide> */ <del> public function get($index) <add> public function get(int $index): ?callable <ide> { <ide> if (isset($this->callables[$index])) { <ide> return $this->callables[$index]; <ide> public function get($index) <ide> * if the index is undefined. <ide> * @throws \RuntimeException If Middleware not found. <ide> */ <del> protected function resolve($index) <add> protected function resolve(int $index): ?callable <ide> { <ide> if (!isset($this->queue[$index])) { <ide> return null; <ide> protected function resolve($index) <ide> * @param callable|string|array $middleware The middleware(s) to append. <ide> * @return $this <ide> */ <del> public function add($middleware) <add> public function add($middleware): self <ide> { <ide> if (is_array($middleware)) { <ide> $this->queue = array_merge($this->queue, $middleware); <ide> public function add($middleware) <ide> * @return $this <ide> * @see MiddlewareQueue::add() <ide> */ <del> public function push($middleware) <add> public function push($middleware): self <ide> { <ide> return $this->add($middleware); <ide> } <ide> public function push($middleware) <ide> * @param callable|string|array $middleware The middleware(s) to prepend. <ide> * @return $this <ide> */ <del> public function prepend($middleware) <add> public function prepend($middleware): self <ide> { <ide> if (is_array($middleware)) { <ide> $this->queue = array_merge($middleware, $this->queue); <ide> public function prepend($middleware) <ide> * @param callable|string $middleware The middleware to insert. <ide> * @return $this <ide> */ <del> public function insertAt($index, $middleware) <add> public function insertAt(int $index, $middleware): self <ide> { <ide> array_splice($this->queue, $index, 0, [$middleware]); <ide> <ide> public function insertAt($index, $middleware) <ide> * @return $this <ide> * @throws \LogicException If middleware to insert before is not found. <ide> */ <del> public function insertBefore($class, $middleware) <add> public function insertBefore(string $class, $middleware): self <ide> { <ide> $found = false; <ide> $i = null; <ide> public function insertBefore($class, $middleware) <ide> * @param callable|string $middleware The middleware to insert. <ide> * @return $this <ide> */ <del> public function insertAfter($class, $middleware) <add> public function insertAfter(string $class, $middleware): self <ide> { <ide> $found = false; <ide> $i = null; <ide> public function insertAfter($class, $middleware) <ide> * <ide> * @return int <ide> */ <del> public function count() <add> public function count(): int <ide> { <ide> return count($this->queue); <ide> } <ide><path>src/Http/Response.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct(array $options = []) <ide> * <ide> * @return void <ide> */ <del> protected function _createStream() <add> protected function _createStream(): void <ide> { <ide> $this->stream = new Stream($this->_streamTarget, $this->_streamMode); <ide> } <ide> protected function _createStream() <ide> * <ide> * @return void <ide> */ <del> protected function _setContentType() <add> protected function _setContentType(): void <ide> { <ide> if (in_array($this->_status, [304, 204])) { <ide> $this->_clearHeader('Content-Type'); <ide> protected function _setContentType() <ide> * @param string $url The location to redirect to. <ide> * @return static A new response with the Location header set. <ide> */ <del> public function withLocation($url) <add> public function withLocation(string $url): ResponseInterface <ide> { <ide> $new = $this->withHeader('Location', $url); <ide> if ($new->_status === 200) { <ide> public function withLocation($url) <ide> * @param string $value Header value. <ide> * @return void <ide> */ <del> protected function _setHeader($header, $value) <add> protected function _setHeader(string $header, string $value): void <ide> { <ide> $normalized = strtolower($header); <ide> $this->headerNames[$normalized] = $header; <ide> protected function _setHeader($header, $value) <ide> * @param string $header Header key. <ide> * @return void <ide> */ <del> protected function _clearHeader($header) <add> protected function _clearHeader(string $header): void <ide> { <ide> $normalized = strtolower($header); <ide> if (!isset($this->headerNames[$normalized])) { <ide> public function withStatus($code, $reasonPhrase = '') <ide> * @return void <ide> * @throws \InvalidArgumentException For invalid status code arguments. <ide> */ <del> protected function _setStatus($code, $reasonPhrase = '') <add> protected function _setStatus(int $code, string $reasonPhrase = ''): void <ide> { <ide> if (!isset($this->_statusCodes[$code])) { <ide> throw new InvalidArgumentException(sprintf( <ide> public function getReasonPhrase() <ide> * <ide> * @return string <ide> */ <del> public function getType() <add> public function getType(): string <ide> { <ide> return $this->_contentType; <ide> } <ide> public function getType() <ide> * @param string $contentType Either a file extension which will be mapped to a mime-type or a concrete mime-type. <ide> * @return static <ide> */ <del> public function withType($contentType) <add> public function withType(string $contentType): ResponseInterface <ide> { <ide> $mappedType = $this->resolveType($contentType); <ide> $new = clone $this; <ide> public function withType($contentType) <ide> * @return string The resolved content-type <ide> * @throws \InvalidArgumentException When an invalid content-type or alias is used. <ide> */ <del> protected function resolveType($contentType) <add> protected function resolveType(string $contentType): string <ide> { <ide> $mapped = $this->getMimeType($contentType); <ide> if ($mapped) { <ide> protected function resolveType($contentType) <ide> * @param string $alias the content type alias to map <ide> * @return mixed String mapped mime type or false if $alias is not mapped <ide> */ <del> public function getMimeType($alias) <add> public function getMimeType(string $alias) <ide> { <ide> if (isset($this->_mimeTypes[$alias])) { <ide> return $this->_mimeTypes[$alias]; <ide> public function mapType($ctype) <ide> * <ide> * @return string <ide> */ <del> public function getCharset() <add> public function getCharset(): string <ide> { <ide> return $this->_charset; <ide> } <ide> public function getCharset() <ide> * @param string $charset Character set string. <ide> * @return static <ide> */ <del> public function withCharset($charset) <add> public function withCharset(string $charset): ResponseInterface <ide> { <ide> $new = clone $this; <ide> $new->_charset = $charset; <ide> public function withCharset($charset) <ide> * <ide> * @return static <ide> */ <del> public function withDisabledCache() <add> public function withDisabledCache(): ResponseInterface <ide> { <ide> return $this->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT') <ide> ->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT') <ide> public function withDisabledCache() <ide> /** <ide> * Create a new instance with the headers to enable client caching. <ide> * <del> * @param string $since a valid time since the response text has not been modified <del> * @param string $time a valid time for cache expiry <add> * @param int|string $since a valid time since the response text has not been modified <add> * @param int|string $time a valid time for cache expiry <ide> * @return static <ide> */ <del> public function withCache($since, $time = '+1 day') <add> public function withCache($since, $time = '+1 day'): ResponseInterface <ide> { <ide> if (!is_int($time)) { <ide> $time = strtotime($time); <ide> public function withCache($since, $time = '+1 day') <ide> * @param int|null $time time in seconds after which the response should no longer be considered fresh. <ide> * @return static <ide> */ <del> public function withSharable($public, $time = null) <add> public function withSharable(bool $public, ?int $time = null): ResponseInterface <ide> { <ide> $new = clone $this; <ide> unset($new->_cacheDirectives['private'], $new->_cacheDirectives['public']); <ide> public function withSharable($public, $time = null) <ide> * @param int $seconds The number of seconds for shared max-age <ide> * @return static <ide> */ <del> public function withSharedMaxAge($seconds) <add> public function withSharedMaxAge(int $seconds): ResponseInterface <ide> { <ide> $new = clone $this; <ide> $new->_cacheDirectives['s-maxage'] = $seconds; <ide> public function withSharedMaxAge($seconds) <ide> * @param int $seconds The seconds a cached response can be considered valid <ide> * @return static <ide> */ <del> public function withMaxAge($seconds) <add> public function withMaxAge(int $seconds): ResponseInterface <ide> { <ide> $new = clone $this; <ide> $new->_cacheDirectives['max-age'] = $seconds; <ide> public function withMaxAge($seconds) <ide> * @param bool $enable If boolean sets or unsets the directive. <ide> * @return static <ide> */ <del> public function withMustRevalidate($enable) <add> public function withMustRevalidate(bool $enable): ResponseInterface <ide> { <ide> $new = clone $this; <ide> if ($enable) { <ide> public function withMustRevalidate($enable) <ide> * <ide> * @return void <ide> */ <del> protected function _setCacheControl() <add> protected function _setCacheControl(): void <ide> { <ide> $control = ''; <ide> foreach ($this->_cacheDirectives as $key => $val) { <ide> protected function _setCacheControl() <ide> * @param string|\DateTime $time Valid time string or \DateTime instance. <ide> * @return static <ide> */ <del> public function withExpires($time) <add> public function withExpires($time): ResponseInterface <ide> { <ide> $date = $this->_getUTCDate($time); <ide> <ide> public function withExpires($time) <ide> * $response->withModified(new DateTime('+1 day')) <ide> * ``` <ide> * <del> * @param string|\DateTime $time Valid time string or \DateTime instance. <add> * @param int|string|\DateTime $time Valid time string or \DateTime instance. <ide> * @return static <ide> */ <del> public function withModified($time) <add> public function withModified($time): ResponseInterface <ide> { <ide> $date = $this->_getUTCDate($time); <ide> <ide> public function withModified($time) <ide> * <ide> * @return void <ide> */ <del> public function notModified() <add> public function notModified(): void <ide> { <ide> $this->_createStream(); <ide> $this->_setStatus(304); <ide> public function notModified() <ide> * <ide> * @return static <ide> */ <del> public function withNotModified() <add> public function withNotModified(): ResponseInterface <ide> { <ide> $new = $this->withStatus(304); <ide> $new->_createStream(); <ide> public function withNotModified() <ide> * containing the list for variances. <ide> * @return static <ide> */ <del> public function withVary($cacheVariances) <add> public function withVary($cacheVariances): ResponseInterface <ide> { <ide> return $this->withHeader('Vary', (array)$cacheVariances); <ide> } <ide> public function withVary($cacheVariances) <ide> * other with the same hash or not. Defaults to false <ide> * @return static <ide> */ <del> public function withEtag($hash, $weak = false) <add> public function withEtag(string $hash, bool $weak = false): ResponseInterface <ide> { <ide> $hash = sprintf('%s"%s"', $weak ? 'W/' : null, $hash); <ide> <ide> public function withEtag($hash, $weak = false) <ide> * @param string|int|\DateTime|null $time Valid time string or \DateTime instance. <ide> * @return \DateTime <ide> */ <del> protected function _getUTCDate($time = null) <add> protected function _getUTCDate($time = null): DateTime <ide> { <ide> if ($time instanceof DateTime) { <ide> $result = clone $time; <ide> protected function _getUTCDate($time = null) <ide> * <ide> * @return bool false if client does not accept compressed responses or no handler is available, true otherwise <ide> */ <del> public function compress() <add> public function compress(): bool <ide> { <ide> $compressionEnabled = ini_get('zlib.output_compression') !== '1' && <ide> extension_loaded('zlib') && <ide> public function compress() <ide> * <ide> * @return bool <ide> */ <del> public function outputCompressed() <add> public function outputCompressed(): bool <ide> { <ide> return strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false <ide> && (ini_get('zlib.output_compression') === '1' || in_array('ob_gzhandler', ob_list_handlers())); <ide> public function outputCompressed() <ide> * @param string $filename The name of the file as the browser will download the response <ide> * @return static <ide> */ <del> public function withDownload($filename) <add> public function withDownload(string $filename): ResponseInterface <ide> { <ide> return $this->withHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); <ide> } <ide> public function withDownload($filename) <ide> * @param int|string $bytes Number of bytes <ide> * @return static <ide> */ <del> public function withLength($bytes) <add> public function withLength($bytes): ResponseInterface <ide> { <ide> return $this->withHeader('Content-Length', (string)$bytes); <ide> } <ide> public function withLength($bytes) <ide> * @return static <ide> * @since 3.6.0 <ide> */ <del> public function withAddedLink($url, array $options = []) <add> public function withAddedLink(string $url, array $options = []): ResponseInterface <ide> { <ide> $params = []; <ide> foreach ($options as $key => $option) { <ide> public function withAddedLink($url, array $options = []) <ide> * @param \Cake\Http\ServerRequest $request Request object <ide> * @return bool Whether the response was marked as not modified or not. <ide> */ <del> public function checkNotModified(ServerRequest $request) <add> public function checkNotModified(ServerRequest $request): bool <ide> { <ide> $etags = preg_split('/\s*,\s*/', (string)$request->getHeaderLine('If-None-Match'), 0, PREG_SPLIT_NO_EMPTY); <ide> $responseTag = $this->getHeaderLine('Etag'); <ide> public function __toString() <ide> * @param array|string $data Either a string value, or an array of cookie options. <ide> * @return static <ide> */ <del> public function withCookie($name, $data = '') <add> public function withCookie($name, $data = ''): ResponseInterface <ide> { <ide> if ($name instanceof Cookie) { <ide> $cookie = $name; <ide> public function withCookie($name, $data = '') <ide> * @param array $options An array of cookie options. <ide> * @return static <ide> */ <del> public function withExpiredCookie($name, array $options = []) <add> public function withExpiredCookie($name, array $options = []): ResponseInterface <ide> { <ide> if ($name instanceof CookieInterface) { <ide> $cookie = $name->withExpired(); <ide> public function withExpiredCookie($name, array $options = []) <ide> * @param string $name The cookie name you want to read. <ide> * @return array|null Either the cookie data or null <ide> */ <del> public function getCookie($name) <add> public function getCookie(string $name): ?array <ide> { <ide> if (!$this->_cookies->has($name)) { <ide> return null; <ide> public function getCookie($name) <ide> * <ide> * @return array <ide> */ <del> public function getCookies() <add> public function getCookies(): array <ide> { <ide> $out = []; <ide> foreach ($this->_cookies as $cookie) { <ide> public function getCookies() <ide> * @param \Cake\Http\Cookie\CookieInterface $cookie Cookie object. <ide> * @return array <ide> */ <del> protected function convertCookieToArray(CookieInterface $cookie) <add> protected function convertCookieToArray(CookieInterface $cookie): array <ide> { <ide> return [ <ide> 'name' => $cookie->getName(), <ide> protected function convertCookieToArray(CookieInterface $cookie) <ide> * <ide> * @return \Cake\Http\Cookie\CookieCollection <ide> */ <del> public function getCookieCollection() <add> public function getCookieCollection(): CookieCollection <ide> { <ide> return $this->_cookies; <ide> } <ide> public function getCookieCollection() <ide> * @return \Cake\Http\CorsBuilder A builder object the provides a fluent interface for defining <ide> * additional CORS headers. <ide> */ <del> public function cors(ServerRequest $request) <add> public function cors(ServerRequest $request): CorsBuilder <ide> { <ide> $origin = $request->getHeaderLine('Origin'); <ide> $ssl = $request->is('ssl'); <ide> public function cors(ServerRequest $request) <ide> * @return static <ide> * @throws \Cake\Http\Exception\NotFoundException <ide> */ <del> public function withFile($path, array $options = []) <add> public function withFile(string $path, array $options = []): ResponseInterface <ide> { <ide> $file = $this->validateFile($path); <ide> $options += [ <ide> public function withFile($path, array $options = []) <ide> if ($options['download']) { <ide> $agent = env('HTTP_USER_AGENT'); <ide> <del> if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) { <add> if ($agent && preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) { <ide> $contentType = 'application/octet-stream'; <del> } elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { <add> } elseif ($agent && preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { <ide> $contentType = 'application/force-download'; <ide> } <ide> <ide> public function withFile($path, array $options = []) <ide> * @param string $string The string to be sent <ide> * @return static <ide> */ <del> public function withStringBody($string) <add> public function withStringBody(?string $string): ResponseInterface <ide> { <ide> $new = clone $this; <ide> $new->_createStream(); <ide> public function withStringBody($string) <ide> * @throws \Cake\Http\Exception\NotFoundException <ide> * @return \Cake\Filesystem\File <ide> */ <del> protected function validateFile($path) <add> protected function validateFile(string $path): File <ide> { <ide> if (strpos($path, '../') !== false || strpos($path, '..\\') !== false) { <ide> throw new NotFoundException(__d('cake', 'The requested file contains `..` and will not be read.')); <ide> protected function validateFile($path) <ide> * <ide> * @return \Cake\Filesystem\File|null The file to use in the response or null <ide> */ <del> public function getFile() <add> public function getFile(): ?File <ide> { <ide> return $this->_file; <ide> } <ide> public function getFile() <ide> * @param string $httpRange The range to use. <ide> * @return void <ide> */ <del> protected function _fileRange($file, $httpRange) <add> protected function _fileRange(File $file, string $httpRange): void <ide> { <ide> $fileSize = $file->size(); <ide> $lastByte = $fileSize - 1; <ide> protected function _fileRange($file, $httpRange) <ide> return; <ide> } <ide> <del> $this->_setHeader('Content-Length', $end - $start + 1); <add> $this->_setHeader('Content-Length', (string)($end - $start + 1)); <ide> $this->_setHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $fileSize); <ide> $this->_setStatus(206); <ide> $this->_fileRange = [$start, $end]; <ide><path>src/Http/ResponseEmitter.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function emit(ResponseInterface $response, $maxBufferLength = 8192) <ide> * @param int $maxBufferLength The chunk size to emit <ide> * @return void <ide> */ <del> protected function emitBody(ResponseInterface $response, $maxBufferLength) <add> protected function emitBody(ResponseInterface $response, int $maxBufferLength): void <ide> { <ide> if (in_array($response->getStatusCode(), [204, 304])) { <ide> return; <ide> protected function emitBody(ResponseInterface $response, $maxBufferLength) <ide> * @param int $maxBufferLength The chunk size to emit <ide> * @return void <ide> */ <del> protected function emitBodyRange(array $range, ResponseInterface $response, $maxBufferLength) <add> protected function emitBodyRange(array $range, ResponseInterface $response, int $maxBufferLength): void <ide> { <ide> list($unit, $first, $last, $length) = $range; <ide> <ide> protected function emitBodyRange(array $range, ResponseInterface $response, $max <ide> * @param \Psr\Http\Message\ResponseInterface $response The response to emit <ide> * @return void <ide> */ <del> protected function emitStatusLine(ResponseInterface $response) <add> protected function emitStatusLine(ResponseInterface $response): void <ide> { <ide> $reasonPhrase = $response->getReasonPhrase(); <ide> header(sprintf( <ide> protected function emitStatusLine(ResponseInterface $response) <ide> * @param \Psr\Http\Message\ResponseInterface $response The response to emit <ide> * @return void <ide> */ <del> protected function emitHeaders(ResponseInterface $response) <add> protected function emitHeaders(ResponseInterface $response): void <ide> { <ide> $cookies = []; <ide> if (method_exists($response, 'getCookies')) { <ide> protected function emitHeaders(ResponseInterface $response) <ide> * @param array $cookies An array of Set-Cookie headers. <ide> * @return void <ide> */ <del> protected function emitCookies(array $cookies) <add> protected function emitCookies(array $cookies): void <ide> { <ide> foreach ($cookies as $cookie) { <ide> if (is_array($cookie)) { <ide> protected function emitCookies(array $cookies) <ide> * @param int|null $maxBufferLevel Flush up to this buffer level. <ide> * @return void <ide> */ <del> protected function flush($maxBufferLevel = null) <add> protected function flush(?int $maxBufferLevel = null): void <ide> { <ide> if ($maxBufferLevel === null) { <ide> $maxBufferLevel = ob_get_level(); <ide> protected function flush($maxBufferLevel = null) <ide> * @return false|array [unit, first, last, length]; returns false if no <ide> * content range or an invalid content range is provided <ide> */ <del> protected function parseContentRange($header) <add> protected function parseContentRange(string $header) <ide> { <ide> if (preg_match('/(?P<unit>[\w]+)\s+(?P<first>\d+)-(?P<last>\d+)\/(?P<length>\d+|\*)/', $header, $matches)) { <ide> return [ <ide><path>src/Http/Runner.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class Runner <ide> * @param \Psr\Http\Message\ResponseInterface $response The response <ide> * @return \Psr\Http\Message\ResponseInterface A response object <ide> */ <del> public function run($middleware, ServerRequestInterface $request, ResponseInterface $response) <add> public function run(MiddlewareQueue $middleware, ServerRequestInterface $request, ResponseInterface $response): ResponseInterface <ide> { <ide> $this->middleware = $middleware; <ide> $this->index = 0; <ide> public function run($middleware, ServerRequestInterface $request, ResponseInterf <ide> * @param \Psr\Http\Message\ResponseInterface $response The response object <ide> * @return \Psr\Http\Message\ResponseInterface An updated response <ide> */ <del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response) <add> public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface <ide> { <ide> $next = $this->middleware->get($this->index); <ide> if ($next) { <ide><path>src/Http/Server.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> public function __construct(HttpApplicationInterface $app) <ide> * @return \Psr\Http\Message\ResponseInterface <ide> * @throws \RuntimeException When the application does not make a response. <ide> */ <del> public function run(?ServerRequestInterface $request = null, ?ResponseInterface $response = null) <add> public function run(?ServerRequestInterface $request = null, ?ResponseInterface $response = null): ResponseInterface <ide> { <ide> $this->bootstrap(); <ide> <ide> public function run(?ServerRequestInterface $request = null, ?ResponseInterface <ide> * <ide> * @return void <ide> */ <del> protected function bootstrap() <add> protected function bootstrap(): void <ide> { <ide> $this->app->bootstrap(); <ide> <ide> protected function bootstrap() <ide> * When null, a SAPI Stream Emitter will be used. <ide> * @return void <ide> */ <del> public function emit(ResponseInterface $response, ?EmitterInterface $emitter = null) <add> public function emit(ResponseInterface $response, ?EmitterInterface $emitter = null): void <ide> { <ide> if (!$emitter) { <ide> $emitter = new ResponseEmitter(); <ide> public function emit(ResponseInterface $response, ?EmitterInterface $emitter = n <ide> * <ide> * @return \Cake\Core\HttpApplicationInterface The application that will be run. <ide> */ <del> public function getApp() <add> public function getApp(): HttpApplicationInterface <ide> { <ide> return $this->app; <ide> } <ide> public function getApp() <ide> * @param \Cake\Http\Runner $runner The runner to use. <ide> * @return $this <ide> */ <del> public function setRunner(Runner $runner) <add> public function setRunner(Runner $runner): self <ide> { <ide> $this->runner = $runner; <ide> <ide><path>src/Http/ServerRequest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class ServerRequest implements ServerRequestInterface <ide> * <ide> * @param array $config An array of request data to create a request with. <ide> */ <del> public function __construct($config = []) <add> public function __construct(array $config = []) <ide> { <del> if (is_string($config)) { <del> trigger_error('ServerRequest no longer accepts a string as its argument.', E_USER_WARNING); <del> } <ide> $config += [ <ide> 'params' => $this->params, <ide> 'query' => [], <ide> public function __construct($config = []) <ide> * @param array $config The config data to use. <ide> * @return void <ide> */ <del> protected function _setConfig($config) <add> protected function _setConfig(array $config): void <ide> { <ide> if (!empty($config['url']) && $config['url'][0] === '/') { <ide> $config['url'] = substr($config['url'], 1); <ide> protected function _processPost($data) <ide> $override = false; <ide> <ide> if (in_array($method, ['PUT', 'DELETE', 'PATCH']) && <del> strpos($this->contentType(), 'application/x-www-form-urlencoded') === 0 <add> strpos((string)$this->contentType(), 'application/x-www-form-urlencoded') === 0 <ide> ) { <ide> $data = $this->input(); <ide> parse_str($data, $data); <ide> protected function _processPost($data) <ide> * @param string $queryString A query string from the URL if provided <ide> * @return array An array containing the parsed query string as keys/values. <ide> */ <del> protected function _processGet($query, $queryString = '') <add> protected function _processGet(array $query, string $queryString = ''): array <ide> { <ide> $unsetUrl = '/' . str_replace(['.', ' '], '_', urldecode($this->url)); <ide> unset($query[$unsetUrl], $query[$this->base . $unsetUrl]); <ide> protected function _processGet($query, $queryString = '') <ide> * @param array $files Uploaded files to merge in. <ide> * @return array merged post + file data. <ide> */ <del> protected function _processFiles($post, $files) <add> protected function _processFiles($post, array $files) <ide> { <ide> if (!is_array($files)) { <ide> return $post; <ide> protected function _processFiles($post, $files) <ide> if ($error === UPLOAD_ERR_OK) { <ide> $tmpName = $file->getStream()->getMetadata('uri'); <ide> } <del> $post = Hash::insert($post, $key, [ <add> $post = Hash::insert($post, (string)$key, [ <ide> 'tmp_name' => $tmpName, <ide> 'error' => $error, <ide> 'name' => $file->getClientFilename(), <ide> protected function _createUploadedFile(array $value) <ide> * @param array $files The file data to normalize & convert. <ide> * @return array An array of UploadedFileInterface objects. <ide> */ <del> protected function _normalizeNestedFiles(array $files = []) <add> protected function _normalizeNestedFiles(array $files = []): array <ide> { <ide> $normalizedFiles = []; <ide> foreach (array_keys($files['tmp_name']) as $key) { <ide> protected function _normalizeNestedFiles(array $files = []) <ide> /** <ide> * Get the content type used in this request. <ide> * <del> * @return string <add> * @return string|null <ide> */ <del> public function contentType() <add> public function contentType(): ?string <ide> { <ide> $type = $this->getEnv('CONTENT_TYPE'); <ide> if ($type) { <ide> public function contentType() <ide> * <ide> * @return \Cake\Http\Session <ide> */ <del> public function getSession() <add> public function getSession(): Session <ide> { <ide> return $this->session; <ide> } <ide> public function getSession() <ide> * <ide> * @return string The client IP. <ide> */ <del> public function clientIp() <add> public function clientIp(): string <ide> { <ide> if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_FOR')) { <ide> $addresses = array_map('trim', explode(',', $this->getEnv('HTTP_X_FORWARDED_FOR'))); <ide> public function clientIp() <ide> * @param array $proxies ips list of trusted proxies <ide> * @return void <ide> */ <del> public function setTrustedProxies(array $proxies) <add> public function setTrustedProxies(array $proxies): void <ide> { <ide> $this->trustedProxies = $proxies; <ide> $this->trustProxy = true; <ide> public function setTrustedProxies(array $proxies) <ide> * <ide> * @return array <ide> */ <del> public function getTrustedProxies() <add> public function getTrustedProxies(): array <ide> { <ide> return $this->trustedProxies; <ide> } <ide> public function getTrustedProxies() <ide> * Local addresses do not contain hostnames. <ide> * @return string The referring address for this request. <ide> */ <del> public function referer($local = false) <add> public function referer(bool $local = false): string <ide> { <ide> $ref = $this->getEnv('HTTP_REFERER'); <ide> <ide> public function __call($name, $params) <ide> * @param array ...$args List of arguments <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> public function is($type, ...$args) <add> public function is($type, ...$args): bool <ide> { <ide> if (is_array($type)) { <ide> $result = array_map([$this, 'is'], $type); <ide> public function is($type, ...$args) <ide> * <ide> * @return void <ide> */ <del> public function clearDetectorCache() <add> public function clearDetectorCache(): void <ide> { <ide> $this->_detectorCache = []; <ide> } <ide> public function clearDetectorCache() <ide> * @param array $args Array of custom detector arguments. <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> protected function _is($type, $args) <add> protected function _is(string $type, array $args): bool <ide> { <ide> $detect = static::$_detectors[$type]; <ide> if (is_callable($detect)) { <ide> protected function _is($type, $args) <ide> * @param array $detect Detector options array. <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> protected function _acceptHeaderDetector($detect) <add> protected function _acceptHeaderDetector(array $detect): bool <ide> { <del> $acceptHeaders = explode(',', $this->getEnv('HTTP_ACCEPT')); <add> $acceptHeaders = explode(',', (string)$this->getEnv('HTTP_ACCEPT')); <ide> foreach ($detect['accept'] as $header) { <ide> if (in_array($header, $acceptHeaders)) { <ide> return true; <ide> protected function _acceptHeaderDetector($detect) <ide> * @param array $detect Detector options array. <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> protected function _headerDetector($detect) <add> protected function _headerDetector(array $detect): bool <ide> { <ide> foreach ($detect['header'] as $header => $value) { <ide> $header = $this->getEnv('http_' . $header); <ide> protected function _headerDetector($detect) <ide> * @param array $detect Detector options array. <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> protected function _paramDetector($detect) <add> protected function _paramDetector(array $detect): bool <ide> { <ide> $key = $detect['param']; <ide> if (isset($detect['value'])) { <ide> protected function _paramDetector($detect) <ide> * @param array $detect Detector options array. <ide> * @return bool Whether or not the request is the type you are checking. <ide> */ <del> protected function _environmentDetector($detect) <add> protected function _environmentDetector(array $detect): bool <ide> { <ide> if (isset($detect['env'])) { <ide> if (isset($detect['value'])) { <ide> protected function _environmentDetector($detect) <ide> * @return bool Success. <ide> * @see \Cake\Http\ServerRequest::is() <ide> */ <del> public function isAll(array $types) <add> public function isAll(array $types): bool <ide> { <ide> $result = array_filter(array_map([$this, 'is'], $types)); <ide> <ide> public function isAll(array $types) <ide> * @param callable|array $callable A callable or options array for the detector definition. <ide> * @return void <ide> */ <del> public static function addDetector($name, $callable) <add> public static function addDetector(string $name, $callable): void <ide> { <ide> $name = strtolower($name); <ide> if (is_callable($callable)) { <ide> public static function addDetector($name, $callable) <ide> * @param string $name The header name. <ide> * @return string The normalized header name. <ide> */ <del> protected function normalizeHeaderName($name) <add> protected function normalizeHeaderName(string $name): string <ide> { <ide> $name = str_replace('-', '_', strtoupper($name)); <ide> if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'])) { <ide> public function withQueryParams(array $query) <ide> * <ide> * @return string <ide> */ <del> public function host() <add> public function host(): string <ide> { <ide> if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_HOST')) { <ide> return $this->getEnv('HTTP_X_FORWARDED_HOST'); <ide> public function host() <ide> * <ide> * @return string <ide> */ <del> public function port() <add> public function port(): string <ide> { <ide> if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_PORT')) { <ide> return $this->getEnv('HTTP_X_FORWARDED_PORT'); <ide> public function port() <ide> * <ide> * @return string The scheme used for the request. <ide> */ <del> public function scheme() <add> public function scheme(): string <ide> { <ide> if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_PROTO')) { <ide> return $this->getEnv('HTTP_X_FORWARDED_PROTO'); <ide> public function scheme() <ide> * While `example.co.uk` contains 2. <ide> * @return string Domain name without subdomains. <ide> */ <del> public function domain($tldLength = 1) <add> public function domain(int $tldLength = 1): string <ide> { <ide> $segments = explode('.', $this->host()); <ide> $domain = array_slice($segments, -1 * ($tldLength + 1)); <ide> public function domain($tldLength = 1) <ide> * While `example.co.uk` contains 2. <ide> * @return array An array of subdomains. <ide> */ <del> public function subdomains($tldLength = 1) <add> public function subdomains(int $tldLength = 1): array <ide> { <ide> $segments = explode('.', $this->host()); <ide> <ide> public function subdomains($tldLength = 1) <ide> * @return array|bool Either an array of all the types the client accepts or a boolean if they accept the <ide> * provided type. <ide> */ <del> public function accepts($type = null) <add> public function accepts(?string $type = null) <ide> { <ide> $raw = $this->parseAccept(); <ide> $accept = []; <ide> public function accepts($type = null) <ide> * <ide> * @return array An array of prefValue => [content/types] <ide> */ <del> public function parseAccept() <add> public function parseAccept(): array <ide> { <ide> return $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept')); <ide> } <ide> public function parseAccept() <ide> * @param string|null $language The language to test. <ide> * @return array|bool If a $language is provided, a boolean. Otherwise the array of accepted languages. <ide> */ <del> public function acceptLanguage($language = null) <add> public function acceptLanguage(?string $language = null) <ide> { <ide> $raw = $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept-Language')); <ide> $accept = []; <ide> public function acceptLanguage($language = null) <ide> * @param string $header Header to parse. <ide> * @return array <ide> */ <del> protected function _parseAcceptWithQualifier($header) <add> protected function _parseAcceptWithQualifier(string $header): array <ide> { <ide> $accept = []; <ide> $header = explode(',', $header); <ide> protected function _parseAcceptWithQualifier($header) <ide> * @return null|string|array Query data. <ide> * @see ServerRequest::getQueryParams() <ide> */ <del> public function getQuery($name = null, $default = null) <add> public function getQuery(?string $name = null, $default = null) <ide> { <ide> if ($name === null) { <ide> return $this->query; <ide> public function getQuery($name = null, $default = null) <ide> * @param mixed $default The default data. <ide> * @return null|string|array The value being read. <ide> */ <del> public function getData($name = null, $default = null) <add> public function getData(?string $name = null, $default = null) <ide> { <ide> if ($name === null) { <ide> return $this->data; <ide> public function getData($name = null, $default = null) <ide> * representation. Leave empty to access the raw input data. You can also <ide> * supply additional parameters for the decoding callback using var args, see above. <ide> * @param array ...$args The additional arguments <del> * @return string The decoded/processed request data. <add> * @return mixed The decoded/processed request data. <ide> */ <del> public function input($callback = null, ...$args) <add> public function input(?string $callback = null, ...$args) <ide> { <ide> $this->stream->rewind(); <ide> $input = $this->stream->getContents(); <ide> public function input($callback = null, ...$args) <ide> * @param string $default The default value if the cookie is not set. <ide> * @return null|array|string Either the cookie value, or null if the value doesn't exist. <ide> */ <del> public function getCookie($key, $default = null) <add> public function getCookie(string $key, ?string $default = null) <ide> { <ide> return Hash::get($this->cookies, $key, $default); <ide> } <ide> public function getCookie($key, $default = null) <ide> * <ide> * @return \Cake\Http\Cookie\CookieCollection <ide> */ <del> public function getCookieCollection() <add> public function getCookieCollection(): CookieCollection <ide> { <ide> return CookieCollection::createFromServerRequest($this); <ide> } <ide> public function getCookieCollection() <ide> * @param \Cake\Http\Cookie\CookieCollection $cookies The cookie collection <ide> * @return static <ide> */ <del> public function withCookieCollection(CookieCollection $cookies) <add> public function withCookieCollection(CookieCollection $cookies): ServerRequestInterface <ide> { <ide> $new = clone $this; <ide> $values = []; <ide> public function withCookieCollection(CookieCollection $cookies) <ide> * <ide> * @return array An array of cookie data. <ide> */ <del> public function getCookieParams() <add> public function getCookieParams(): array <ide> { <ide> return $this->cookies; <ide> } <ide> public function getCookieParams() <ide> * @param array $cookies The new cookie data to use. <ide> * @return static <ide> */ <del> public function withCookieParams(array $cookies) <add> public function withCookieParams(array $cookies): ServerRequestInterface <ide> { <ide> $new = clone $this; <ide> $new->cookies = $cookies; <ide> public function getParsedBody() <ide> * typically be in an array or object. <ide> * @return static <ide> */ <del> public function withParsedBody($data) <add> public function withParsedBody($data): ServerRequestInterface <ide> { <ide> $new = clone $this; <ide> $new->data = $data; <ide> public function getProtocolVersion() <ide> } <ide> <ide> // Lazily populate this data as it is generally not used. <del> preg_match('/^HTTP\/([\d.]+)$/', $this->getEnv('SERVER_PROTOCOL'), $match); <add> preg_match('/^HTTP\/([\d.]+)$/', (string)$this->getEnv('SERVER_PROTOCOL'), $match); <ide> $protocol = '1.1'; <ide> if (isset($match[1])) { <ide> $protocol = $match[1]; <ide> public function withProtocolVersion($version) <ide> * variable's value that does not exist. <ide> * @return string|null Either the environment value, or null if the value doesn't exist. <ide> */ <del> public function getEnv($key, $default = null) <add> public function getEnv(string $key, ?string $default = null): ?string <ide> { <ide> $key = strtoupper($key); <ide> if (!array_key_exists($key, $this->_environment)) { <ide> $this->_environment[$key] = env($key); <ide> } <ide> <del> return $this->_environment[$key] !== null ? $this->_environment[$key] : $default; <add> return $this->_environment[$key] !== null ? (string)$this->_environment[$key] : $default; <ide> } <ide> <ide> /** <ide> public function getEnv($key, $default = null) <ide> * @param string $value Value to set <ide> * @return static <ide> */ <del> public function withEnv($key, $value) <add> public function withEnv(string $key, string $value): ServerRequestInterface <ide> { <ide> $new = clone $this; <ide> $new->_environment[$key] = $value; <ide> public function withEnv($key, $value) <ide> * @return bool true <ide> * @throws \Cake\Http\Exception\MethodNotAllowedException <ide> */ <del> public function allowMethod($methods) <add> public function allowMethod($methods): bool <ide> { <ide> $methods = (array)$methods; <ide> foreach ($methods as $method) { <ide> public function allowMethod($methods) <ide> * <ide> * @return string contents of php://input <ide> */ <del> protected function _readInput() <add> protected function _readInput(): string <ide> { <ide> if (empty($this->_input)) { <ide> $fh = fopen('php://input', 'rb'); <ide> protected function _readInput() <ide> * @param mixed $value The value to insert into the request data. <ide> * @return static <ide> */ <del> public function withData($name, $value) <add> public function withData(string $name, $value): ServerRequestInterface <ide> { <ide> $copy = clone $this; <ide> $copy->data = Hash::insert($copy->data, $name, $value); <ide> public function withData($name, $value) <ide> * @param string $name The dot separated path to remove. <ide> * @return static <ide> */ <del> public function withoutData($name) <add> public function withoutData(string $name): ServerRequestInterface <ide> { <ide> $copy = clone $this; <ide> $copy->data = Hash::remove($copy->data, $name); <ide> public function withoutData($name) <ide> * @param mixed $value The value to insert into the the request parameters. <ide> * @return static <ide> */ <del> public function withParam($name, $value) <add> public function withParam(string $name, $value): ServerRequestInterface <ide> { <ide> $copy = clone $this; <ide> $copy->params = Hash::insert($copy->params, $name, $value); <ide> public function withParam($name, $value) <ide> * @param mixed $default The default value if `$name` is not set. Default `null`. <ide> * @return mixed <ide> */ <del> public function getParam($name, $default = null) <add> public function getParam(string $name, $default = null) <ide> { <ide> return Hash::get($this->params, $name, $default); <ide> } <ide> public function getAttributes() <ide> * @param string $path The dot separated path to the file you want. <ide> * @return null|\Psr\Http\Message\UploadedFileInterface <ide> */ <del> public function getUploadedFile($path) <add> public function getUploadedFile(string $path): ?UploadedFileInterface <ide> { <ide> $file = Hash::get($this->uploadedFiles, $path); <ide> if (!$file instanceof UploadedFile) { <ide> public function withUploadedFiles(array $files) <ide> * @return void <ide> * @throws \InvalidArgumentException If any leaf elements are not valid files. <ide> */ <del> protected function validateUploadedFiles(array $uploadedFiles, $path) <add> protected function validateUploadedFiles(array $uploadedFiles, string $path): void <ide> { <ide> foreach ($uploadedFiles as $key => $file) { <ide> if (is_array($file)) { <ide> public function getRequestTarget() <ide> * @return string <ide> * @since 3.6.1 <ide> */ <del> public function getPath() <add> public function getPath(): string <ide> { <ide> if ($this->requestTarget === null) { <ide> return $this->uri->getPath(); <ide><path>src/Http/ServerRequestFactory.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> <ide> use Cake\Core\Configure; <ide> use Cake\Utility\Hash; <add>use Psr\Http\Message\UriInterface; <ide> use Zend\Diactoros\ServerRequestFactory as BaseFactory; <ide> <ide> /** <ide> public static function fromGlobals( <ide> ?array $body = null, <ide> ?array $cookies = null, <ide> ?array $files = null <del> ) { <add> ): ServerRequest { <ide> $server = static::normalizeServer($server ?: $_SERVER); <ide> $uri = static::createUri($server); <ide> $sessionConfig = (array)Configure::read('Session') + [ <ide> public static function fromGlobals( <ide> * $_SERVER will be added into the $server parameter. <ide> * @return \Psr\Http\Message\UriInterface New instance. <ide> */ <del> public static function createUri(array $server = []) <add> public static function createUri(array $server = []): UriInterface <ide> { <ide> $server += $_SERVER; <ide> $server = static::normalizeServer($server); <ide> public static function createUri(array $server = []) <ide> * @param array $headers The normalized headers <ide> * @return \Psr\Http\Message\UriInterface a constructed Uri <ide> */ <del> public static function marshalUriFromServer(array $server, array $headers) <add> public static function marshalUriFromServer(array $server, array $headers): UriInterface <ide> { <ide> $uri = parent::marshalUriFromServer($server, $headers); <ide> list($base, $webroot) = static::getBase($uri, $server); <ide> public static function marshalUriFromServer(array $server, array $headers) <ide> * @param \Psr\Http\Message\UriInterface $uri The uri to update. <ide> * @return \Psr\Http\Message\UriInterface The modified Uri instance. <ide> */ <del> protected static function updatePath($base, $uri) <add> protected static function updatePath(string $base, UriInterface $uri): UriInterface <ide> { <ide> $path = $uri->getPath(); <ide> if (strlen($base) > 0 && strpos($path, $base) === 0) { <ide> protected static function updatePath($base, $uri) <ide> * @param array $server The SERVER data to use. <ide> * @return array An array containing the [baseDir, webroot] <ide> */ <del> protected static function getBase($uri, $server) <add> protected static function getBase(UriInterface $uri, array $server): array <ide> { <ide> $config = (array)Configure::read('App') + [ <ide> 'base' => null, <ide><path>src/Http/Session.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> class Session <ide> * @return static <ide> * @see \Cake\Http\Session::__construct() <ide> */ <del> public static function create($sessionConfig = []) <add> public static function create(array $sessionConfig = []) <ide> { <ide> if (isset($sessionConfig['defaults'])) { <ide> $defaults = static::_defaultConfig($sessionConfig['defaults']); <ide> public static function create($sessionConfig = []) <ide> * @param string $name Config name. <ide> * @return bool|array <ide> */ <del> protected static function _defaultConfig($name) <add> protected static function _defaultConfig(string $name) <ide> { <ide> $defaults = [ <ide> 'php' => [ <ide> public function __construct(array $config = []) <ide> * @return \SessionHandlerInterface|null <ide> * @throws \InvalidArgumentException <ide> */ <del> public function engine($class = null, array $options = []) <add> public function engine($class = null, array $options = []): ?SessionHandlerInterface <ide> { <ide> if ($class === null) { <ide> return $this->_engine; <ide> public function engine($class = null, array $options = []) <ide> * @param \SessionHandlerInterface $handler The handler to set <ide> * @return \SessionHandlerInterface <ide> */ <del> protected function setEngine(SessionHandlerInterface $handler) <add> protected function setEngine(SessionHandlerInterface $handler): SessionHandlerInterface <ide> { <ide> if (!headers_sent()) { <ide> session_set_save_handler($handler, false); <ide> protected function setEngine(SessionHandlerInterface $handler) <ide> * @return void <ide> * @throws \RuntimeException if any directive could not be set <ide> */ <del> public function options(array $options) <add> public function options(array $options): void <ide> { <ide> if (session_status() === \PHP_SESSION_ACTIVE || headers_sent()) { <ide> return; <ide> public function options(array $options) <ide> * @return bool True if session was started <ide> * @throws \RuntimeException if the session was already started <ide> */ <del> public function start() <add> public function start(): bool <ide> { <ide> if ($this->_started) { <ide> return true; <ide> public function start() <ide> * <ide> * @return bool True if session has been started. <ide> */ <del> public function started() <add> public function started(): bool <ide> { <ide> return $this->_started || session_status() === \PHP_SESSION_ACTIVE; <ide> } <ide> public function started() <ide> * @param string|null $name Variable name to check for <ide> * @return bool True if variable is there <ide> */ <del> public function check($name = null) <add> public function check(?string $name = null): bool <ide> { <ide> if ($this->_hasSession() && !$this->started()) { <ide> $this->start(); <ide> public function check($name = null) <ide> * @return string|array|null The value of the session variable, null if session not available, <ide> * session not started, or provided name not found in the session. <ide> */ <del> public function read($name = null) <add> public function read(?string $name = null) <ide> { <ide> if ($this->_hasSession() && !$this->started()) { <ide> $this->start(); <ide> public function read($name = null) <ide> * @return mixed The value of the session variable, null if session not available, <ide> * session not started, or provided name not found in the session. <ide> */ <del> public function consume($name) <add> public function consume(string $name) <ide> { <ide> if (empty($name)) { <ide> return null; <ide> public function consume($name) <ide> * @param mixed $value Value to write <ide> * @return void <ide> */ <del> public function write($name, $value = null) <add> public function write($name, $value = null): void <ide> { <ide> if (!$this->started()) { <ide> $this->start(); <ide> public function write($name, $value = null) <ide> * @param string|null $id Id to replace the current session id <ide> * @return string Session id <ide> */ <del> public function id($id = null) <add> public function id(?string $id = null): string <ide> { <ide> if ($id !== null && !headers_sent()) { <ide> session_id($id); <ide> public function id($id = null) <ide> * @param string $name Session variable to remove <ide> * @return void <ide> */ <del> public function delete($name) <add> public function delete(string $name): void <ide> { <ide> if ($this->check($name)) { <ide> $this->_overwrite($_SESSION, Hash::remove($_SESSION, $name)); <ide> public function delete($name) <ide> * @param array $new New set of variable => value <ide> * @return void <ide> */ <del> protected function _overwrite(&$old, $new) <add> protected function _overwrite(array &$old, array $new): void <ide> { <ide> if (!empty($old)) { <ide> foreach ($old as $key => $var) { <ide> protected function _overwrite(&$old, $new) <ide> * <ide> * @return void <ide> */ <del> public function destroy() <add> public function destroy(): void <ide> { <ide> if ($this->_hasSession() && !$this->started()) { <ide> $this->start(); <ide> public function destroy() <ide> * @param bool $renew If session should be renewed, as well. Defaults to false. <ide> * @return void <ide> */ <del> public function clear($renew = false) <add> public function clear(bool $renew = false): void <ide> { <ide> $_SESSION = []; <ide> if ($renew) { <ide> public function clear($renew = false) <ide> * <ide> * @return bool <ide> */ <del> protected function _hasSession() <add> protected function _hasSession(): bool <ide> { <ide> return !ini_get('session.use_cookies') <ide> || isset($_COOKIE[session_name()]) <ide> protected function _hasSession() <ide> * <ide> * @return void <ide> */ <del> public function renew() <add> public function renew(): void <ide> { <ide> if (!$this->_hasSession() || $this->_isCLI) { <ide> return; <ide> public function renew() <ide> * <ide> * @return bool <ide> */ <del> protected function _timedOut() <add> protected function _timedOut(): bool <ide> { <ide> $time = $this->read('Config.time'); <ide> $result = false; <ide><path>src/Http/Session/CacheSession.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * Cache Session save handler. Allows saving session information into Cache. <ide> * <ide><path>src/Http/Session/DatabaseSession.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * Database Session save handler. Allows saving session information into a model. <ide> * <ide> public function __construct(array $config = []) <ide> * @param int $timeout The timeout duration. <ide> * @return $this <ide> */ <del> public function setTimeout($timeout) <add> public function setTimeout(int $timeout): self <ide> { <ide> $this->_timeout = $timeout; <ide> <ide><path>tests/TestCase/Http/Cookie/CookieTest.php <ide> public function testGetStringValue() <ide> $this->assertSame(json_encode($value), $cookie->getStringValue()); <ide> } <ide> <del> /** <del> * Test setting domain in cookies <del> * <del> * @return void <del> */ <del> public function testWithDomainInvalidConstructor() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `string` but `integer` given'); <del> new Cookie('cakephp', 'rocks', null, '', 1234); <del> } <del> <del> /** <del> * Test setting domain in cookies <del> * <del> * @return void <del> */ <del> public function testWithDomainInvalid() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `string` but `array` given'); <del> $cookie = new Cookie('cakephp', 'rocks'); <del> $cookie->withDomain(['oops']); <del> } <del> <ide> /** <ide> * Test setting domain in cookies <ide> * <ide> public function testWithDomain() <ide> $this->assertContains('domain=example.com', $new->toHeaderValue()); <ide> } <ide> <del> /** <del> * Test setting path in cookies <del> * <del> * @return void <del> */ <del> public function testWithPathInvalid() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `string` but `array` given'); <del> $cookie = new Cookie('cakephp', 'rocks'); <del> $cookie->withPath(['oops']); <del> } <del> <del> /** <del> * Test setting path in cookies <del> * <del> * @return void <del> */ <del> public function testWithPathInvalidConstructor() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `string` but `integer` given'); <del> new Cookie('cakephp', 'rocks', null, 123); <del> } <del> <ide> /** <ide> * Test setting path in cookies <ide> * <ide> public function testDefaultPath() <ide> $this->assertContains('path=/', $cookie->toHeaderValue()); <ide> } <ide> <del> /** <del> * Test setting httponly in cookies <del> * <del> * @return void <del> */ <del> public function testWithHttpOnlyInvalidConstructor() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `bool` but `string` given'); <del> new Cookie('cakephp', 'cakephp-rocks', null, '', '', false, 'invalid'); <del> } <del> <del> /** <del> * Test setting httponly in cookies <del> * <del> * @return void <del> */ <del> public function testWithHttpOnlyInvalid() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `bool` but `string` given'); <del> $cookie = new Cookie('cakephp', 'cakephp-rocks'); <del> $cookie->withHttpOnly('no'); <del> } <del> <ide> /** <ide> * Test setting httponly in cookies <ide> * <ide> public function testWithHttpOnly() <ide> $this->assertTrue($new->isHttpOnly()); <ide> } <ide> <del> /** <del> * Test setting secure in cookies <del> * <del> * @return void <del> */ <del> public function testWithSecureInvalidConstructor() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `bool` but `string` given'); <del> new Cookie('cakephp', 'cakephp-rocks', null, '', '', 'invalid'); <del> } <del> <del> /** <del> * Test setting secure in cookies <del> * <del> * @return void <del> */ <del> public function testWithSecureInvalid() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('The provided arg must be of type `bool` but `string` given'); <del> $cookie = new Cookie('cakephp', 'cakephp-rocks'); <del> $cookie->withSecure('no'); <del> } <del> <ide> /** <ide> * Test setting secure in cookies <ide> * <ide><path>tests/TestCase/Http/ResponseTest.php <ide> public function testConstruct() <ide> 'body' => 'This is the body', <ide> 'charset' => 'my-custom-charset', <ide> 'type' => 'mp3', <del> 'status' => '203', <add> 'status' => 203, <ide> ]; <ide> $response = new Response($options); <ide> $this->assertEquals('This is the body', (string)$response->getBody()); <ide> public function testWithStringBody() <ide> $this->assertNotSame($response, $newResponse); <ide> } <ide> <del> /** <del> * Test with string body with passed array. <del> * <del> * This should produce an "Array to string conversion" error <del> * which gets thrown as a \PHPUnit\Framework\Error\Error Exception by PHPUnit. <del> * <del> * @return void <del> */ <del> public function testWithStringBodyArray() <del> { <del> $this->expectException(\PHPUnit\Framework\Error\Error::class); <del> $this->expectExceptionMessage('Array to string conversion'); <del> $response = new Response(); <del> $newResponse = $response->withStringBody(['foo' => 'bar']); <del> $body = $newResponse->getBody(); <del> $this->assertSame('', (string)$body); <del> $this->assertNotSame($response, $newResponse); <del> } <del> <ide> /** <ide> * Test get Body. <ide> * <ide><path>tests/TestCase/Http/RunnerTest.php <ide> public function setUp() <ide> $this->pass = function ($req, $res, $next) { <ide> return $next($req, $res); <ide> }; <del> $this->noNext = function ($req, $res, $next) { <del> }; <ide> $this->fail = function ($req, $res, $next) { <ide> throw new RuntimeException('A bad thing'); <ide> }; <ide> public function testRunExceptionInMiddleware() <ide> $runner = new Runner(); <ide> $runner->run($this->stack, $req, $res); <ide> } <del> <del> /** <del> * Test that 'bad' middleware returns null. <del> * <del> * @return void <del> */ <del> public function testRunNextNotCalled() <del> { <del> $this->stack->add($this->noNext); <del> $req = $this->getMockBuilder('Psr\Http\Message\ServerRequestInterface')->getMock(); <del> $res = $this->getMockBuilder('Psr\Http\Message\ResponseInterface')->getMock(); <del> <del> $runner = new Runner(); <del> $result = $runner->run($this->stack, $req, $res); <del> $this->assertNull($result); <del> } <ide> } <ide><path>tests/TestCase/Http/ServerRequestTest.php <ide> public function testHeader() <ide> 'HTTP_HOST' => 'localhost', <ide> 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-ca) AppleWebKit/534.8+ (KHTML, like Gecko) Version/5.0 Safari/533.16', <ide> 'CONTENT_TYPE' => 'application/json', <del> 'CONTENT_LENGTH' => 1337, <add> 'CONTENT_LENGTH' => '1337', <ide> 'HTTP_CONTENT_MD5' => 'abc123', <ide> ]]); <ide> <ide> public function testGetHeaderLine() <ide> $request = new ServerRequest(['environment' => [ <ide> 'HTTP_HOST' => 'localhost', <ide> 'CONTENT_TYPE' => 'application/json', <del> 'CONTENT_LENGTH' => 1337, <add> 'CONTENT_LENGTH' => '1337', <ide> 'HTTP_CONTENT_MD5' => 'abc123', <ide> 'HTTP_DOUBLE' => ['a', 'b'], <ide> ]]); <ide><path>tests/TestCase/Http/ServerTest.php <ide> public function testRunMultipleMiddlewareSuccess() <ide> $this->assertSame('second', $res->getHeaderLine('X-Second')); <ide> } <ide> <del> /** <del> * Test middleware not creating a response. <del> * <del> * @return void <del> */ <del> public function testRunMiddlewareNoResponse() <del> { <del> $this->expectException(RuntimeException::class); <del> $this->expectExceptionMessage('Application did not create a response. Got "Not a response" instead.'); <del> $app = new BadResponseApplication($this->config); <del> $server = new Server($app); <del> $server->run(); <del> } <del> <ide> /** <ide> * Test that emit invokes the appropriate methods on the emitter. <ide> * <ide><path>tests/TestCase/Http/SessionTest.php <ide> protected function _writeSession() <ide> */ <ide> class TestWebSession extends Session <ide> { <del> protected function _hasSession() <add> protected function _hasSession(): bool <ide> { <ide> $isCLI = $this->_isCLI; <ide> $this->_isCLI = false; <ide> public function testConsume() <ide> $value = $session->consume(''); <ide> $this->assertNull($value); <ide> <del> $value = $session->consume(null); <del> $this->assertNull($value); <del> <ide> $value = $session->consume('Some.array'); <ide> $expected = ['key1' => 'value1', 'key2' => 'value2']; <ide> $this->assertEquals($expected, $value); <ide> public function testDelete() <ide> $session->write('Clearing.sale', 'everything must go'); <ide> $session->delete(''); <ide> $this->assertTrue($session->check('Clearing.sale')); <del> $session->delete(null); <del> $this->assertTrue($session->check('Clearing.sale')); <ide> <ide> $session->delete('Clearing'); <ide> $this->assertFalse($session->check('Clearing.sale')); <ide><path>tests/test_app/TestApp/Http/BadResponseApplication.php <ide> public function middleware($middleware) <ide> * @param callable $next The next middleware <ide> * @return \Psr\Http\Message\ResponseInterface <ide> */ <del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next): ResponseInterface <add> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface <ide> { <ide> return $res; <ide> } <ide><path>tests/test_app/TestApp/Http/EventApplication.php <ide> public function console($commands) <ide> return $commands->addMany(['ex' => DemoCommand::class]); <ide> } <ide> <del> public function __invoke(ServerRequestInterface $req, ResponseInterface $res, $next) <add> public function __invoke(ServerRequestInterface $req, ResponseInterface $res, callable $next): ResponseInterface <ide> { <ide> return $res; <ide> } <ide><path>tests/test_app/TestApp/Http/MiddlewareApplication.php <ide> public function middleware($middleware) <ide> * @param callable $next The next middleware <ide> * @return \Psr\Http\Message\ResponseInterface <ide> */ <del> public function __invoke(ServerRequestInterface $req, ResponseInterface $res, $next): ResponseInterface <add> public function __invoke(ServerRequestInterface $req, ResponseInterface $res, callable $next): ResponseInterface <ide> { <ide> return $res; <ide> }
46
Python
Python
remove utility script
909177589dcdbde1cd4770f9f744d4d57d08d7e0
<ide><path>spacy/tests/regression/util_add_marker.py <del>import re <del>from pathlib import Path <del>from typing import Optional <del> <del>import typer <del> <del> <del>def main( <del> filename: Path, out_file: Optional[Path] = typer.Option(None), dry_run: bool = False <del>): <del> """Add pytest issue markers on regression tests <del> <del> If --out-file is not used, it will overwrite the original file. You can set <del> the --dry-run flag to just see the changeset and not write to disk. <del> """ <del> lines = [] <del> with filename.open() as f: <del> lines = f.readlines() <del> <del> # Regex pattern for matching common regression formats (e.g. test_issue1234) <del> pattern = r"def test_issue\d{1,4}" <del> regex = re.compile(pattern) <del> <del> new_lines = [] <del> for line_text in lines: <del> if regex.search(line_text): # if match, append marker first <del> issue_num = int(re.findall(r"\d+", line_text)[0]) # Simple heuristic <del> typer.echo(f"Found: {line_text} with issue number: {issue_num}") <del> new_lines.append(f"@pytest.mark.issue({issue_num})\n") <del> new_lines.append(line_text) <del> <del> # Save to file <del> if not dry_run: <del> out = out_file or filename <del> with out.open("w") as f: <del> for new_line in new_lines: <del> f.write(new_line) <del> <del> <del>if __name__ == "__main__": <del> typer.run(main)
1
Go
Go
fix vet errors about formatting directives
a7ae7fed7311551975d2bccb7417c328be3ea478
<ide><path>daemon/utils_test.go <ide> func TestMergeLxcConfig(t *testing.T) { <ide> <ide> out, err := mergeLxcConfIntoOptions(hostConfig) <ide> if err != nil { <del> t.Fatalf("Failed to merge Lxc Config ", err) <add> t.Fatalf("Failed to merge Lxc Config: %s", err) <ide> } <ide> <ide> cpuset := out[0] <ide><path>integration-cli/docker_cli_attach_test.go <ide> func TestAttachTtyWithoutStdin(t *testing.T) { <ide> if out, _, err := runCommandWithOutput(cmd); err == nil { <ide> t.Fatal("attach should have failed") <ide> } else if !strings.Contains(out, expected) { <del> t.Fatal("attach failed with error %q: expected %q", out, expected) <add> t.Fatalf("attach failed with error %q: expected %q", out, expected) <ide> } <ide> }() <ide> <ide><path>integration-cli/docker_cli_build_test.go <ide> func TestBuildStderr(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> if stderr != "" { <del> t.Fatal("Stderr should have been empty, instead its: %q", stderr) <add> t.Fatalf("Stderr should have been empty, instead its: %q", stderr) <ide> } <ide> logDone("build - testing stderr") <ide> } <ide><path>integration-cli/docker_cli_exec_test.go <ide> func TestExecTtyWithoutStdin(t *testing.T) { <ide> if out, _, err := runCommandWithOutput(cmd); err == nil { <ide> t.Fatal("exec should have failed") <ide> } else if !strings.Contains(out, expected) { <del> t.Fatal("exec failed with error %q: expected %q", out, expected) <add> t.Fatalf("exec failed with error %q: expected %q", out, expected) <ide> } <ide> }() <ide> <ide><path>integration-cli/docker_cli_run_test.go <ide> func TestRunTtyWithPipe(t *testing.T) { <ide> if out, _, err := runCommandWithOutput(cmd); err == nil { <ide> t.Fatal("run should have failed") <ide> } else if !strings.Contains(out, expected) { <del> t.Fatal("run failed with error %q: expected %q", out, expected) <add> t.Fatalf("run failed with error %q: expected %q", out, expected) <ide> } <ide> }() <ide> <ide><path>pkg/symlink/fs_test.go <ide> func TestFollowSymlinkEmpty(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> if res != wd { <del> t.Fatal("expected %q got %q", wd, res) <add> t.Fatalf("expected %q got %q", wd, res) <ide> } <ide> } <ide>
6
Javascript
Javascript
update language code
b4d66c6f09b3210534bdb470edfb790cc8206cde
<ide><path>lang/ms-my.js <ide> // language : Bahasa Malaysia (ms-MY) <ide> // author : Weldan Jamili : https://github.com/weldan <ide> <del>require('../moment').lang('ms', { <add>require('../moment').lang('ms-my', { <ide> months : "Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"), <ide> monthsShort : "Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"), <ide> weekdays : "Minggu_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),
1
Javascript
Javascript
ensure preventdefault works for nested targets
fec74f99daebd07c38a647941afa6bf0e0b2306e
<ide><path>packages/react-dom/src/events/DOMEventResponderSystem.js <ide> const eventResponderContext: ReactResponderContext = { <ide> childTarget: Element | Document, <ide> parentTarget: Element | Document, <ide> ): boolean { <add> validateResponderContext(); <ide> const childFiber = getClosestInstanceFromNode(childTarget); <ide> const parentFiber = getClosestInstanceFromNode(parentTarget); <ide> <ide> const eventResponderContext: ReactResponderContext = { <ide> } <ide> }, <ide> getFocusableElementsInScope(): Array<HTMLElement> { <add> validateResponderContext(); <ide> const focusableElements = []; <ide> const eventComponentInstance = ((currentInstance: any): ReactEventComponentInstance); <ide> let node = ((eventComponentInstance.currentFiber: any): Fiber).child; <ide> const eventResponderContext: ReactResponderContext = { <ide> getEventPointerType( <ide> event: ReactResponderEvent, <ide> ): '' | 'mouse' | 'keyboard' | 'pen' | 'touch' { <add> validateResponderContext(); <ide> const nativeEvent: any = event.nativeEvent; <ide> const {type, pointerType} = nativeEvent; <ide> if (pointerType != null) { <ide> const eventResponderContext: ReactResponderContext = { <ide> return ''; <ide> }, <ide> getEventCurrentTarget(event: ReactResponderEvent): Element { <add> validateResponderContext(); <ide> const target: any = event.target; <ide> let currentTarget = target; <ide> while ( <ide> const eventResponderContext: ReactResponderContext = { <ide> return currentTarget; <ide> }, <ide> getTimeStamp(): number { <add> validateResponderContext(); <ide> return currentTimeStamp; <ide> }, <add> isTargetWithinHostComponent( <add> target: Element | Document, <add> elementType: string, <add> ): boolean { <add> validateResponderContext(); <add> let fiber = getClosestInstanceFromNode(target); <add> while (fiber !== null) { <add> if (fiber.stateNode === currentInstance) { <add> return false; <add> } <add> if (fiber.tag === HostComponent && fiber.type === elementType) { <add> return true; <add> } <add> fiber = fiber.return; <add> } <add> return false; <add> }, <ide> }; <ide> <ide> function isTargetWithinEventComponent(target: Element | Document): boolean { <ide><path>packages/react-events/src/Press.js <ide> function dispatchCancel( <ide> } <ide> } <ide> <del>function isAnchorTagElement(eventTarget: EventTarget): boolean { <del> return (eventTarget: any).nodeName === 'A'; <del>} <del> <ide> function isValidKeyPress(key: string): boolean { <ide> // Accessibility for keyboards. Space and Enter only. <ide> return key === ' ' || key === 'Enter'; <ide> const PressResponder = { <ide> } <ide> <ide> case 'click': { <del> if (isAnchorTagElement(target)) { <add> if (context.isTargetWithinHostComponent(target, 'a')) { <ide> const { <ide> altKey, <ide> ctrlKey, <ide><path>packages/react-events/src/__tests__/Press-test.internal.js <ide> describe('Event responder: Press', () => { <ide> expect(preventDefault).toBeCalled(); <ide> }); <ide> <add> it('prevents native behaviour by default with nested elements', () => { <add> const onPress = jest.fn(); <add> const preventDefault = jest.fn(); <add> const ref = React.createRef(); <add> const element = ( <add> <Press onPress={onPress}> <add> <a href="#"> <add> <div ref={ref} /> <add> </a> <add> </Press> <add> ); <add> ReactDOM.render(element, container); <add> <add> ref.current.dispatchEvent(createEvent('pointerdown')); <add> ref.current.dispatchEvent(createEvent('pointerup')); <add> ref.current.dispatchEvent(createEvent('click', {preventDefault})); <add> expect(preventDefault).toBeCalled(); <add> }); <add> <ide> it('uses native behaviour for interactions with modifier keys', () => { <ide> const onPress = jest.fn(); <ide> const preventDefault = jest.fn(); <ide><path>packages/shared/ReactTypes.js <ide> export type ReactResponderContext = { <ide> ): '' | 'mouse' | 'keyboard' | 'pen' | 'touch', <ide> getEventCurrentTarget(event: ReactResponderEvent): Element, <ide> getTimeStamp: () => number, <add> isTargetWithinHostComponent: ( <add> target: Element | Document, <add> elementType: string, <add> ) => boolean, <ide> };
4
Java
Java
fix warnings in disposablebeanadapter
8cafb7ee13b68ce8f21b01c49d2feba7a818b1ed
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java <ide> * @see org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor <ide> * @see AbstractBeanDefinition#getDestroyMethodName() <ide> */ <add>@SuppressWarnings("serial") <ide> class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable { <ide> <ide> private static final Log logger = LogFactory.getLog(DisposableBeanAdapter.class); <ide> public DisposableBeanAdapter(Object bean, String beanName, RootBeanDefinition be <ide> } <ide> } <ide> else { <del> Class[] paramTypes = this.destroyMethod.getParameterTypes(); <add> Class<?>[] paramTypes = this.destroyMethod.getParameterTypes(); <ide> if (paramTypes.length > 1) { <ide> throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + <ide> beanName + "' has more than one parameter - not supported as destroy method"); <ide> private Method findDestroyMethod() { <ide> * assuming a "force" parameter), else logging an error. <ide> */ <ide> private void invokeCustomDestroyMethod(final Method destroyMethod) { <del> Class[] paramTypes = destroyMethod.getParameterTypes(); <add> Class<?>[] paramTypes = destroyMethod.getParameterTypes(); <ide> final Object[] args = new Object[paramTypes.length]; <ide> if (paramTypes.length == 1) { <ide> args[0] = Boolean.TRUE;
1
PHP
PHP
use the table constants in the tests
ef1e73cd79ff249b99641bf5265630232c7aaf5b
<ide><path>src/Database/Schema/Table.php <ide> class Table <ide> protected $_temporary = false; <ide> <ide> /** <del> * Column length when using a `tiny` text column type <add> * Column length when using a `tiny` column type <ide> * <ide> * @var int <ide> */ <ide> const LENGTH_TINY = 255; <ide> <ide> /** <del> * Column length when using a `medium` text column type <add> * Column length when using a `medium` column type <ide> * <ide> * @var int <ide> */ <ide> const LENGTH_MEDIUM = 16777215; <ide> <ide> /** <del> * Column length when using a `long` text column type <add> * Column length when using a `long` column type <ide> * <ide> * @var int <ide> */ <ide><path>tests/TestCase/Database/Schema/MysqlSchemaTest.php <ide> public static function convertColumnProvider() <ide> ], <ide> [ <ide> 'TINYTEXT', <del> ['type' => 'text', 'length' => 255] <add> ['type' => 'text', 'length' => Table::LENGTH_TINY] <ide> ], <ide> [ <ide> 'MEDIUMTEXT', <del> ['type' => 'text', 'length' => 16777215] <add> ['type' => 'text', 'length' => Table::LENGTH_MEDIUM] <ide> ], <ide> [ <ide> 'LONGTEXT', <del> ['type' => 'text', 'length' => 4294967295] <add> ['type' => 'text', 'length' => Table::LENGTH_LONG] <ide> ], <ide> [ <ide> 'BLOB',
2
Go
Go
remove unneeded fmt.sprintf() in asserts
0fabf3e41ec3cc0ba5479ce91e278c1e7855eebd
<ide><path>integration-cli/docker_api_containers_test.go <ide> func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) { <ide> assert.NilError(c, err) <ide> <ide> _, err = os.Stat(source) <del> assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("expected to get ErrNotExist error, got %v", err)) <add> assert.Assert(c, os.IsNotExist(err), "expected to get ErrNotExist error, got %v", err) <ide> } <ide> <ide> // Regression test for https://github.com/docker/docker/issues/6231 <ide><path>integration-cli/docker_cli_attach_unix_test.go <ide> package main <ide> <ide> import ( <ide> "bufio" <del> "fmt" <ide> "io/ioutil" <ide> "os/exec" <ide> "strings" <ide> func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) { <ide> case err := <-errChan: <ide> tty.Close() <ide> out, _ := ioutil.ReadAll(pty) <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", string(out))) <add> assert.Assert(c, err == nil, "out: %v", string(out)) <ide> case <-time.After(attachWait): <ide> c.Fatal("timed out without attach returning") <ide> } <ide><path>integration-cli/docker_cli_build_test.go <ide> func (s *DockerSuite) TestBuildTagEvent(c *testing.T) { <ide> } <ide> } <ide> <del> assert.Assert(c, foundTag, fmt.Sprintf("No tag event found:\n%s", out)) <add> assert.Assert(c, foundTag, "No tag event found:\n%s", out) <ide> } <ide> <ide> // #15780 <ide><path>integration-cli/docker_cli_by_digest_test.go <ide> func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest1 <ide> re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`) <del> assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out)) <add> assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out) <ide> // setup image2 <ide> digest2, err := setupImageWithTag(c, "tag2") <ide> //error setting up image <ide> func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { <ide> out, _ = dockerCmd(c, "images", "--digests") <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest1 <del> assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out)) <add> assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out) <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest2 <ide> re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`) <del> assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out)) <add> assert.Assert(c, re2.MatchString(out), "expected %q: %s", re2.String(), out) <ide> <ide> // pull tag1 <ide> dockerCmd(c, "pull", repoName+":tag1") <ide> func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { <ide> <ide> // make sure image 1 has repo, tag, <none> AND repo, <none>, digest <ide> reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*tag1\s*` + digest1.String() + `\s`) <del> assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, reWithDigest1.MatchString(out), "expected %q: %s", reWithDigest1.String(), out) <ide> // make sure image 2 has repo, <none>, digest <del> assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out)) <add> assert.Assert(c, re2.MatchString(out), "expected %q: %s", re2.String(), out) <ide> <ide> // pull tag 2 <ide> dockerCmd(c, "pull", repoName+":tag2") <ide> func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { <ide> out, _ = dockerCmd(c, "images", "--digests") <ide> <ide> // make sure image 1 has repo, tag, digest <del> assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, reWithDigest1.MatchString(out), "expected %q: %s", reWithDigest1.String(), out) <ide> <ide> // make sure image 2 has repo, tag, digest <ide> reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*tag2\s*` + digest2.String() + `\s`) <del> assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out)) <add> assert.Assert(c, reWithDigest2.MatchString(out), "expected %q: %s", reWithDigest2.String(), out) <ide> <ide> // list images <ide> out, _ = dockerCmd(c, "images", "--digests") <ide> <ide> // make sure image 1 has repo, tag, digest <del> assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, reWithDigest1.MatchString(out), "expected %q: %s", reWithDigest1.String(), out) <ide> // make sure image 2 has repo, tag, digest <del> assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out)) <add> assert.Assert(c, reWithDigest2.MatchString(out), "expected %q: %s", reWithDigest2.String(), out) <ide> // make sure busybox has tag, but not digest <ide> busyboxRe := regexp.MustCompile(`\s*busybox\s*latest\s*<none>\s`) <del> assert.Assert(c, busyboxRe.MatchString(out), fmt.Sprintf("expected %q: %s", busyboxRe.String(), out)) <add> assert.Assert(c, busyboxRe.MatchString(out), "expected %q: %s", busyboxRe.String(), out) <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { <ide> func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest1 <ide> re1 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest1.String() + `\s`) <del> assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out)) <add> assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out) <ide> // setup image2 <ide> digest2, err := setupImageWithTag(c, "dangle2") <ide> //error setting up image <ide> func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { <ide> out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true") <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest1 <del> assert.Assert(c, re1.MatchString(out), fmt.Sprintf("expected %q: %s", re1.String(), out)) <add> assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out) <ide> <ide> // make sure repo shown, tag=<none>, digest = $digest2 <ide> re2 := regexp.MustCompile(`\s*` + repoName + `\s*<none>\s*` + digest2.String() + `\s`) <del> assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out)) <add> assert.Assert(c, re2.MatchString(out), "expected %q: %s", re2.String(), out) <ide> <ide> // pull dangle1 tag <ide> dockerCmd(c, "pull", repoName+":dangle1") <ide> func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { <ide> <ide> // make sure image 1 has repo, tag, <none> AND repo, <none>, digest <ide> reWithDigest1 := regexp.MustCompile(`\s*` + repoName + `\s*dangle1\s*` + digest1.String() + `\s`) <del> assert.Assert(c, !reWithDigest1.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, !reWithDigest1.MatchString(out), "unexpected %q: %s", reWithDigest1.String(), out) <ide> // make sure image 2 has repo, <none>, digest <del> assert.Assert(c, re2.MatchString(out), fmt.Sprintf("expected %q: %s", re2.String(), out)) <add> assert.Assert(c, re2.MatchString(out), "expected %q: %s", re2.String(), out) <ide> <ide> // pull dangle2 tag <ide> dockerCmd(c, "pull", repoName+":dangle2") <ide> func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { <ide> out, _ = dockerCmd(c, "images", "--digests") <ide> <ide> // make sure image 1 has repo, tag, digest <del> assert.Assert(c, reWithDigest1.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, reWithDigest1.MatchString(out), "expected %q: %s", reWithDigest1.String(), out) <ide> <ide> // make sure image 2 has repo, tag, digest <ide> reWithDigest2 := regexp.MustCompile(`\s*` + repoName + `\s*dangle2\s*` + digest2.String() + `\s`) <del> assert.Assert(c, reWithDigest2.MatchString(out), fmt.Sprintf("expected %q: %s", reWithDigest2.String(), out)) <add> assert.Assert(c, reWithDigest2.MatchString(out), "expected %q: %s", reWithDigest2.String(), out) <ide> <ide> // list images, no longer dangling, should not match <ide> out, _ = dockerCmd(c, "images", "--digests", "--filter=dangling=true") <ide> <ide> // make sure image 1 has repo, tag, digest <del> assert.Assert(c, !reWithDigest1.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest1.String(), out)) <add> assert.Assert(c, !reWithDigest1.MatchString(out), "unexpected %q: %s", reWithDigest1.String(), out) <ide> // make sure image 2 has repo, tag, digest <del> assert.Assert(c, !reWithDigest2.MatchString(out), fmt.Sprintf("unexpected %q: %s", reWithDigest2.String(), out)) <add> assert.Assert(c, !reWithDigest2.MatchString(out), "unexpected %q: %s", reWithDigest2.String(), out) <ide> } <ide> <ide> func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) { <ide> func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) { <ide> assert.Assert(c, exitStatus != 0, "expected a non-zero exit status") <ide> <ide> expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest) <del> assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out)) <add> assert.Assert(c, strings.Contains(out, expectedErrorMsg), "expected error message in output: %s", out) <ide> } <ide> <ide> // TestPullFailsWithAlteredLayer tests that a `docker pull` fails when <ide> func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) <ide> assert.Assert(c, exitStatus != 0, "expected a non-zero exit status") <ide> <ide> expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest) <del> assert.Assert(c, strings.Contains(out, expectedErrorMsg), fmt.Sprintf("expected error message in output: %s", out)) <add> assert.Assert(c, strings.Contains(out, expectedErrorMsg), "expected error message in output: %s", out) <ide> } <ide><path>integration-cli/docker_cli_commit_test.go <ide> package main <ide> <ide> import ( <del> "fmt" <ide> "strings" <ide> "testing" <ide> <ide> func (s *DockerSuite) TestCommitHardlink(c *testing.T) { <ide> chunks := strings.Split(strings.TrimSpace(firstOutput), " ") <ide> inode := chunks[0] <ide> chunks = strings.SplitAfterN(strings.TrimSpace(firstOutput), " ", 2) <del> assert.Assert(c, strings.Contains(chunks[1], chunks[0]), fmt.Sprintf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:])) <add> assert.Assert(c, strings.Contains(chunks[1], chunks[0]), "Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]) <ide> imageID, _ := dockerCmd(c, "commit", "hardlinks", "hardlinks") <ide> imageID = strings.TrimSpace(imageID) <ide> <ide> func (s *DockerSuite) TestCommitHardlink(c *testing.T) { <ide> chunks = strings.Split(strings.TrimSpace(secondOutput), " ") <ide> inode = chunks[0] <ide> chunks = strings.SplitAfterN(strings.TrimSpace(secondOutput), " ", 2) <del> assert.Assert(c, strings.Contains(chunks[1], chunks[0]), fmt.Sprintf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:])) <add> assert.Assert(c, strings.Contains(chunks[1], chunks[0]), "Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]) <ide> } <ide> <ide> func (s *DockerSuite) TestCommitTTY(c *testing.T) { <ide><path>integration-cli/docker_cli_cp_from_container_test.go <ide> package main <ide> <ide> import ( <del> "fmt" <ide> "os" <ide> "path/filepath" <ide> "testing" <ide> func (s *DockerSuite) TestCpFromCaseB(c *testing.T) { <ide> err := runDockerCp(c, srcPath, dstDir, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpDirNotExist(err), fmt.Sprintf("expected DirNotExists error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpDirNotExist(err), "expected DirNotExists error, but got %T: %s", err, err) <ide> } <ide> <ide> // C. SRC specifies a file and DST exists as a file. This should overwrite <ide> func (s *DockerSuite) TestCpFromCaseD(c *testing.T) { <ide> <ide> // Ensure that dstPath doesn't exist. <ide> _, err := os.Stat(dstPath) <del> assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("did not expect dstPath %q to exist", dstPath)) <add> assert.Assert(c, os.IsNotExist(err), "did not expect dstPath %q to exist", dstPath) <ide> <ide> assert.Assert(c, runDockerCp(c, srcPath, dstDir, nil) == nil) <ide> <ide> func (s *DockerSuite) TestCpFromCaseF(c *testing.T) { <ide> err := runDockerCp(c, srcDir, dstFile, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err) <ide> } <ide> <ide> // G. SRC specifies a directory and DST exists as a directory. This should copy <ide> func (s *DockerSuite) TestCpFromCaseI(c *testing.T) { <ide> err := runDockerCp(c, srcDir, dstFile, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err) <ide> } <ide> <ide> // J. SRC specifies a directory's contents only and DST exists as a directory. <ide><path>integration-cli/docker_cli_cp_to_container_test.go <ide> package main <ide> <ide> import ( <del> "fmt" <ide> "os" <ide> "testing" <ide> <ide> func (s *DockerSuite) TestCpToCaseB(c *testing.T) { <ide> err := runDockerCp(c, srcPath, dstDir, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpDirNotExist(err), fmt.Sprintf("expected DirNotExists error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpDirNotExist(err), "expected DirNotExists error, but got %T: %s", err, err) <ide> } <ide> <ide> // C. SRC specifies a file and DST exists as a file. This should overwrite <ide> func (s *DockerSuite) TestCpToCaseF(c *testing.T) { <ide> err := runDockerCp(c, srcDir, dstFile, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err) <ide> } <ide> <ide> // G. SRC specifies a directory and DST exists as a directory. This should copy <ide> func (s *DockerSuite) TestCpToCaseI(c *testing.T) { <ide> err := runDockerCp(c, srcDir, dstFile, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err) <ide> } <ide> <ide> // J. SRC specifies a directory's contents only and DST exists as a directory. <ide> func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) { <ide> err := runDockerCp(c, srcPath, dstPath, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrContainerRootfsReadonly error, but got %T: %s", err, err) <ide> <ide> // Ensure that dstPath doesn't exist. <ide> assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil) <ide> func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) { <ide> err := runDockerCp(c, srcPath, dstPath, nil) <ide> assert.ErrorContains(c, err, "") <ide> <del> assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrVolumeReadonly error, but got %T: %s", err, err)) <add> assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrVolumeReadonly error, but got %T: %s", err, err) <ide> <ide> // Ensure that dstPath doesn't exist. <ide> assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil) <ide><path>integration-cli/docker_cli_create_test.go <ide> func (s *DockerSuite) TestCreateArgs(c *testing.T) { <ide> } <ide> <ide> err := json.Unmarshal([]byte(out), &containers) <del> assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err)) <add> assert.Assert(c, err == nil, "Error inspecting the container: %s", err) <ide> assert.Equal(c, len(containers), 1) <ide> <ide> cont := containers[0] <ide> func (s *DockerSuite) TestCreateHostConfig(c *testing.T) { <ide> } <ide> <ide> err := json.Unmarshal([]byte(out), &containers) <del> assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err)) <add> assert.Assert(c, err == nil, "Error inspecting the container: %s", err) <ide> assert.Equal(c, len(containers), 1) <ide> <ide> cont := containers[0] <del> assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none")) <del> assert.Assert(c, cont.HostConfig.PublishAllPorts, fmt.Sprintf("Expected PublishAllPorts, got false")) <add> assert.Assert(c, cont.HostConfig != nil, "Expected HostConfig, got none") <add> assert.Assert(c, cont.HostConfig.PublishAllPorts, "Expected PublishAllPorts, got false") <ide> } <ide> <ide> func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) { <ide> func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) { <ide> } <ide> } <ide> err := json.Unmarshal([]byte(out), &containers) <del> assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err)) <add> assert.Assert(c, err == nil, "Error inspecting the container: %s", err) <ide> assert.Equal(c, len(containers), 1) <ide> <ide> cont := containers[0] <ide> <del> assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none")) <add> assert.Assert(c, cont.HostConfig != nil, "Expected HostConfig, got none") <ide> assert.Equal(c, len(cont.HostConfig.PortBindings), 4, fmt.Sprintf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings))) <ide> <ide> for k, v := range cont.HostConfig.PortBindings { <ide> func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) { <ide> } <ide> <ide> err := json.Unmarshal([]byte(out), &containers) <del> assert.Assert(c, err == nil, fmt.Sprintf("Error inspecting the container: %s", err)) <add> assert.Assert(c, err == nil, "Error inspecting the container: %s", err) <ide> assert.Equal(c, len(containers), 1) <ide> <ide> cont := containers[0] <del> assert.Assert(c, cont.HostConfig != nil, fmt.Sprintf("Expected HostConfig, got none")) <add> assert.Assert(c, cont.HostConfig != nil, "Expected HostConfig, got none") <ide> assert.Equal(c, len(cont.HostConfig.PortBindings), 65535) <ide> <ide> for k, v := range cont.HostConfig.PortBindings { <ide> func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) { <ide> dockerCmd(c, "create", "--name", name, "-v", prefix+slash+"foo", "busybox") <ide> <ide> dir, err := inspectMountSourceField(name, prefix+slash+"foo") <del> assert.Assert(c, err == nil, fmt.Sprintf("Error getting volume host path: %q", err)) <add> assert.Assert(c, err == nil, "Error getting volume host path: %q", err) <ide> <ide> if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) { <ide> c.Fatalf("Volume was not created") <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *testing.T) { <ide> var format string <ide> for name, shouldRun := range m { <ide> out, err := s.d.Cmd("ps") <del> assert.Assert(c, err == nil, fmt.Sprintf("run ps: %v", out)) <add> assert.Assert(c, err == nil, "run ps: %v", out) <ide> if shouldRun { <ide> format = "%scontainer %q is not running" <ide> } else { <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) { <ide> <ide> if newBasesizeBytes < oldBasesizeBytes { <ide> err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes)) <del> assert.Assert(c, err != nil, fmt.Sprintf("daemon should not have started as new base device size is less than existing base device size: %v", err)) <add> assert.Assert(c, err != nil, "daemon should not have started as new base device size is less than existing base device size: %v", err) <ide> // 'err != nil' is expected behaviour, no new daemon started, <ide> // so no need to stop daemon. <ide> if err != nil { <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T) <ide> } <ide> <ide> err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes)) <del> assert.Assert(c, err == nil, fmt.Sprintf("we should have been able to start the daemon with increased base device size: %v", err)) <add> assert.Assert(c, err == nil, "we should have been able to start the daemon with increased base device size: %v", err) <ide> <ide> basesizeAfterRestart := getBaseDeviceSize(c, s.d) <ide> newBasesize, err := convertBasesize(newBasesizeBytes) <del> assert.Assert(c, err == nil, fmt.Sprintf("Error in converting base device size: %v", err)) <add> assert.Assert(c, err == nil, "Error in converting base device size: %v", err) <ide> assert.Equal(c, newBasesize, basesizeAfterRestart, "Basesize passed is not equal to Basesize set") <ide> s.d.Stop(c) <ide> } <ide> func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T <ide> break <ide> } <ide> ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName) <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", ip)) <add> assert.Assert(c, err == nil, "%s", ip) <ide> <ide> assert.Assert(c, ip != bridgeIP) <ide> cont++ <ide> func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) { <ide> <ide> // pull a repository large enough to overfill the mounted filesystem <ide> pullOut, err := s.d.Cmd("pull", "debian:stretch") <del> assert.Assert(c, err != nil, fmt.Sprintf("%s", pullOut)) <add> assert.Assert(c, err != nil, "%s", pullOut) <ide> assert.Assert(c, strings.Contains(pullOut, "no space left on device")) <ide> } <ide> <ide> func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) { <ide> out, err := s.d.Cmd("run", "--name", name, "busybox", "cat", "/proc/self/cgroup") <ide> assert.NilError(c, err) <ide> cgroupPaths := ParseCgroupPaths(string(out)) <del> assert.Assert(c, len(cgroupPaths) != 0, fmt.Sprintf("unexpected output - %q", string(out))) <add> assert.Assert(c, len(cgroupPaths) != 0, "unexpected output - %q", string(out)) <ide> out, err = s.d.Cmd("inspect", "-f", "{{.Id}}", name) <ide> assert.NilError(c, err) <ide> id := strings.TrimSpace(string(out)) <ide> func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) { <ide> break <ide> } <ide> } <del> assert.Assert(c, found, fmt.Sprintf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths)) <add> assert.Assert(c, found, "Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths) <ide> } <ide> <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) { <ide> func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) { <ide> // the following check for mounts being cleared is pointless. <ide> skipMountCheck := false <ide> mountOut, err := ioutil.ReadFile("/proc/self/mountinfo") <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", mountOut)) <add> assert.Assert(c, err == nil, "Output: %s", mountOut) <ide> if !strings.Contains(string(mountOut), id) { <ide> skipMountCheck = true <ide> } <ide> func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) { <ide> } <ide> // Now, container mounts should be gone. <ide> mountOut, err = ioutil.ReadFile("/proc/self/mountinfo") <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", mountOut)) <add> assert.Assert(c, err == nil, "Output: %s", mountOut) <ide> comment := fmt.Sprintf("%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, s.d.Root, mountOut) <ide> assert.Equal(c, strings.Contains(string(mountOut), id), false, comment) <ide> } <ide> func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) <ide> out, err := s.d.Cmd("info") <ide> assert.NilError(c, err) <ide> <del> assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Store: consul://consuladdr:consulport/some/path"))) <del> assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Advertise: 192.168.56.100:0"))) <add> assert.Assert(c, strings.Contains(out, "Cluster Store: consul://consuladdr:consulport/some/path")) <add> assert.Assert(c, strings.Contains(out, "Cluster Advertise: 192.168.56.100:0")) <ide> } <ide> <ide> // Test for #21956 <ide> func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *testing.T) { <ide> <ide> expectedOutput := "nameserver 1.2.3.4" <ide> out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "/etc/resolv.conf") <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> expectedOutput = "search example.com" <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> expectedOutput = "options timeout:3" <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> } <ide> <ide> func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) { <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *testing. <ide> <ide> // top1 will exist after daemon restarts <ide> out, err := s.d.Cmd("run", "-d", "--name", "top1", "busybox:latest", "top") <del> assert.Assert(c, err == nil, fmt.Sprintf("run top1: %v", out)) <add> assert.Assert(c, err == nil, "run top1: %v", out) <ide> // top2 will be removed after daemon restarts <ide> out, err = s.d.Cmd("run", "-d", "--rm", "--name", "top2", "busybox:latest", "top") <del> assert.Assert(c, err == nil, fmt.Sprintf("run top2: %v", out)) <add> assert.Assert(c, err == nil, "run top2: %v", out) <ide> <ide> out, err = s.d.Cmd("ps") <ide> assert.NilError(c, err) <ide> func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *testing.T) { <ide> <ide> out1, err := s.d.Cmd("exec", "-u", "test", "top", "id") <ide> // uid=100(test) gid=101(test) groups=101(test) <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out1)) <add> assert.Assert(c, err == nil, "Output: %s", out1) <ide> <ide> // restart daemon. <ide> s.d.Restart(c, "--live-restore") <ide> <ide> out2, err := s.d.Cmd("exec", "-u", "test", "top", "id") <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out2)) <add> assert.Assert(c, err == nil, "Output: %s", out2) <ide> assert.Equal(c, out2, out1, fmt.Sprintf("Output: before restart '%s', after restart '%s'", out1, out2)) <ide> <ide> out, err = s.d.Cmd("stop", "top") <ide> func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *testing.T) { <ide> StartedAt time.Time <ide> } <ide> out, err = s.d.Cmd("inspect", "-f", "{{json .State}}", id) <del> assert.Assert(c, err == nil, fmt.Sprintf("output: %s", out)) <add> assert.Assert(c, err == nil, "output: %s", out) <ide> <ide> var origState state <ide> err = json.Unmarshal([]byte(strings.TrimSpace(out)), &origState) <ide> func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *testing.T) { <ide> } <ide> <ide> out, err := s.d.Cmd("inspect", "-f", "{{json .State}}", id) <del> assert.Assert(c, err == nil, fmt.Sprintf("output: %s", out)) <add> assert.Assert(c, err == nil, "output: %s", out) <ide> <ide> var newState state <ide> err = json.Unmarshal([]byte(strings.TrimSpace(out)), &newState) <ide><path>integration-cli/docker_cli_external_volume_driver_test.go <ide> func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *testing.T) <ide> p := hostVolumePath("external-volume-test") <ide> _, err = os.Lstat(p) <ide> assert.ErrorContains(c, err, "") <del> assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("Expected volume path in host to not exist: %s, %v\n", p, err)) <add> assert.Assert(c, os.IsNotExist(err), "Expected volume path in host to not exist: %s, %v\n", p, err) <ide> <ide> assert.Equal(c, s.ec.activations, 1) <ide> assert.Equal(c, s.ec.creations, 1) <ide><path>integration-cli/docker_cli_history_test.go <ide> func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) { <ide> sizeString := lines[i][startIndex:endIndex] <ide> <ide> _, err := strconv.Atoi(strings.TrimSpace(sizeString)) <del> assert.Assert(c, err == nil, fmt.Sprintf("The size '%s' was not an Integer", sizeString)) <add> assert.Assert(c, err == nil, "The size '%s' was not an Integer", sizeString) <ide> } <ide> } <ide> <ide><path>integration-cli/docker_cli_info_test.go <ide> func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) { <ide> } <ide> <ide> for _, linePrefix := range stringsToCheck { <del> assert.Assert(c, strings.Contains(out, linePrefix), fmt.Sprintf("couldn't find string %v in output", linePrefix)) <add> assert.Assert(c, strings.Contains(out, linePrefix), "couldn't find string %v in output", linePrefix) <ide> } <ide> } <ide> <ide><path>integration-cli/docker_cli_inspect_test.go <ide> func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) { <ide> dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") <ide> <ide> out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox") <del> assert.Assert(c, err != nil, fmt.Sprintf("%d", exitCode)) <add> assert.Assert(c, err != nil, "%d", exitCode) <ide> assert.Equal(c, exitCode, 1, fmt.Sprintf("%s", err)) <ide> assert.Assert(c, strings.Contains(out, "not a valid value for --type")) <ide> } <ide> func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) { <ide> out := inspectField(c, imageTest, "Size") <ide> <ide> size, err := strconv.Atoi(out) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect size of the image: %s, %v", out, err)) <add> assert.Assert(c, err == nil, "failed to inspect size of the image: %s, %v", out, err) <ide> <ide> //now see if the size turns out to be the same <ide> formatStr := fmt.Sprintf("--format={{eq .Size %d}}", size) <ide> func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) { <ide> out = inspectField(c, id, "State.ExitCode") <ide> <ide> exitCode, err := strconv.Atoi(out) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect exitcode of the container: %s, %v", out, err)) <add> assert.Assert(c, err == nil, "failed to inspect exitcode of the container: %s, %v", out, err) <ide> <ide> //now get the exit code to verify <ide> formatStr := fmt.Sprintf("--format={{eq .State.ExitCode %d}}", exitCode) <ide> func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) { <ide> deviceID := inspectField(c, imageTest, "GraphDriver.Data.DeviceId") <ide> <ide> _, err := strconv.Atoi(deviceID) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)) <add> assert.Assert(c, err == nil, "failed to inspect DeviceId of the image: %s, %v", deviceID, err) <ide> <ide> deviceSize := inspectField(c, imageTest, "GraphDriver.Data.DeviceSize") <ide> <ide> _, err = strconv.ParseUint(deviceSize, 10, 64) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) <add> assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) { <ide> func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) { <ide> assert.Assert(c, imageDeviceID != deviceID) <ide> <ide> _, err := strconv.Atoi(deviceID) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)) <add> assert.Assert(c, err == nil, "failed to inspect DeviceId of the image: %s, %v", deviceID, err) <ide> <ide> deviceSize := inspectField(c, out, "GraphDriver.Data.DeviceSize") <ide> <ide> _, err = strconv.ParseUint(deviceSize, 10, 64) <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) <add> assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) { <ide> func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) { <ide> out := inspectFieldJSON(c, "test", "HostConfig.LogConfig") <ide> <ide> err := json.NewDecoder(strings.NewReader(out)).Decode(&logConfig) <del> assert.Assert(c, err == nil, fmt.Sprintf("%v", out)) <add> assert.Assert(c, err == nil, "%v", out) <ide> <ide> assert.Equal(c, logConfig.Type, "json-file") <ide> assert.Equal(c, logConfig.Config["max-file"], "42", fmt.Sprintf("%v", logConfig)) <ide><path>integration-cli/docker_cli_links_test.go <ide> func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) { <ide> out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true") <ide> <ide> // an invalid container target should produce an error <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // an invalid container target should produce an error <ide> // note: convert the output to lowercase first as the error string <ide> // capitalization was changed after API version 1.32 <ide> func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) { <ide> getIP := func(hosts []byte, hostname string) string { <ide> re := regexp.MustCompile(fmt.Sprintf(`(\S*)\t%s`, regexp.QuoteMeta(hostname))) <ide> matches := re.FindSubmatch(hosts) <del> assert.Assert(c, matches != nil, fmt.Sprintf("Hostname %s have no matches in hosts", hostname)) <add> assert.Assert(c, matches != nil, "Hostname %s have no matches in hosts", hostname) <ide> return string(matches[1]) <ide> } <ide> ip := getIP(content, "one") <ide> func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) { <ide> out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") <ide> <ide> // Running container linking to a container with --net host should have failed <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // Running container linking to a container with --net host should have failed <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error())) <ide> } <ide><path>integration-cli/docker_cli_netmode_test.go <ide> package main <ide> <ide> import ( <del> "fmt" <ide> "strings" <ide> "testing" <ide> <ide> const stringCheckPS = "PID USER" <ide> // stop the tests. <ide> func dockerCmdWithFail(c *testing.T, args ...string) (string, int) { <ide> out, status, err := dockerCmdWithError(args...) <del> assert.Assert(c, err != nil, fmt.Sprintf("%v", out)) <add> assert.Assert(c, err != nil, "%v", out) <ide> return out, status <ide> } <ide> <ide><path>integration-cli/docker_cli_network_unix_test.go <ide> func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) { <ide> // contains active container, its deletion should fail. <ide> out, _, err := dockerCmdWithError("network", "rm", "testDelMulti0", "testDelMulti1", "testDelMulti2") <ide> // err should not be nil due to deleting testDelMulti2 failed. <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // testDelMulti2 should fail due to network has active endpoints <ide> assert.Assert(c, strings.Contains(out, "has active endpoints")) <ide> assertNwNotAvailable(c, "testDelMulti0") <ide> func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) { <ide> <ide> // Still it should fail to connect to the default network with a specified IP (whatever ip) <ide> out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) <ide> } <ide> <ide> func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T <ide> assertNwIsAvailable(c, "n0") <ide> <ide> out, _, err := dockerCmdWithError("run", "-d", "--ip", "172.28.99.88", "--net", "n0", "busybox", "top") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) <ide> out, _, err = dockerCmdWithError("run", "-d", "--ip6", "2001:db8:1234::9988", "--net", "n0", "busybox", "top") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) <ide> dockerCmd(c, "network", "rm", "n0") <ide> assertNwNotAvailable(c, "n0") <ide> } <ide> <ide> func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) { <ide> out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) <ide> } <ide> <ide> func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *testing.T) { <ide> dockerCmd(c, "start", containerName) <ide> assert.Assert(c, waitRun(containerName) == nil) <ide> networks := inspectField(c, containerName, "NetworkSettings.Networks") <del> assert.Assert(c, strings.Contains(networks, netWorkName1), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName1))) <del> assert.Assert(c, strings.Contains(networks, netWorkName2), fmt.Sprintf(fmt.Sprintf("Should contain '%s' network", netWorkName2))) <add> assert.Assert(c, strings.Contains(networks, netWorkName1), fmt.Sprintf("Should contain '%s' network", netWorkName1)) <add> assert.Assert(c, strings.Contains(networks, netWorkName2), fmt.Sprintf("Should contain '%s' network", netWorkName2)) <ide> assert.Assert(c, !strings.Contains(networks, "bridge"), "Should not contain 'bridge' network") <ide> } <ide> <ide> func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) <ide> <ide> // verify the alias option is rejected when running on predefined network <ide> out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) <ide> // verify the alias option is rejected when connecting to predefined network <ide> out, _, err = dockerCmdWithError("network", "connect", "--alias=any", "bridge", "first") <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) <ide> } <ide> <ide><path>integration-cli/docker_cli_plugins_test.go <ide> func (s *DockerSuite) TestPluginUpgrade(c *testing.T) { <ide> <ide> // make sure "v2" does not exists <ide> _, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2")) <del> assert.Assert(c, os.IsNotExist(err), fmt.Sprintf("%s", out)) <add> assert.Assert(c, os.IsNotExist(err), "%s", out) <ide> <ide> dockerCmd(c, "plugin", "disable", "-f", plugin) <ide> dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2) <ide><path>integration-cli/docker_cli_port_test.go <ide> func (s *DockerSuite) TestPortList(c *testing.T) { <ide> "-p", "9090-9092:80", <ide> "busybox", "top") <ide> // Exhausted port range did not return an error <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> <ide> for i := 0; i < 3; i++ { <ide> dockerCmd(c, "rm", "-f", IDs[i]) <ide> func (s *DockerSuite) TestPortList(c *testing.T) { <ide> "-p", invalidRange, <ide> "busybox", "top") <ide> // Port range should have returned an error <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> } <ide> <ide> // test host range:container range spec. <ide> func (s *DockerSuite) TestPortHostBinding(c *testing.T) { <ide> <ide> out, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "9876") <ide> // Port is still bound after the Container is removed <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> } <ide> <ide> func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) { <ide> func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) { <ide> out, _ = dockerCmd(c, "port", firstID, "80") <ide> <ide> _, exposedPort, err := net.SplitHostPort(out) <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err == nil, "out: %s", out) <ide> <ide> dockerCmd(c, "run", "--net=host", "busybox", <ide> "nc", "localhost", strings.TrimSpace(exposedPort)) <ide> func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) { <ide> out, _, err = dockerCmdWithError("run", "--net=host", "busybox", <ide> "nc", "localhost", strings.TrimSpace(exposedPort)) <ide> // Port is still bound after the Container is removed <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> } <ide> <ide> func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) { <ide><path>integration-cli/docker_cli_ps_test.go <ide> func (s *DockerSuite) TestPsListContainersSize(c *testing.T) { <ide> assert.Equal(c, foundID, id[:12], fmt.Sprintf("Expected id %s, got %s", id[:12], foundID)) <ide> expectedSize := fmt.Sprintf("%dB", 2+baseBytes) <ide> foundSize := lines[1][sizeIndex:] <del> assert.Assert(c, strings.Contains(foundSize, expectedSize), fmt.Sprintf("Expected size %q, got %q", expectedSize, foundSize)) <add> assert.Assert(c, strings.Contains(foundSize, expectedSize), "Expected size %q, got %q", expectedSize, foundSize) <ide> } <ide> <ide> func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) { <ide> func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) { <ide> secondZero, _ := dockerCmd(c, "run", "-d", "busybox", "true") <ide> <ide> out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false") <del> assert.Assert(c, err != nil, fmt.Sprintf("Should fail. out: %s", out)) <add> assert.Assert(c, err != nil, "Should fail. out: %s", out) <ide> firstNonZero := getIDByName(c, "nonzero1") <ide> <ide> out, _, err = dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false") <del> assert.Assert(c, err != nil, fmt.Sprintf("Should fail. out: %s", out)) <add> assert.Assert(c, err != nil, "Should fail. out: %s", out) <ide> secondNonZero := getIDByName(c, "nonzero2") <ide> <ide> // filter containers by exited=0 <ide> func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) { <ide> <ide> // Make sure it DOESN'T show up w/o a '-a' for normal 'ps' <ide> out, _ = dockerCmd(c, "ps", "-q") <del> assert.Assert(c, !strings.Contains(out, shortCID), fmt.Sprintf("Should have not seen '%s' in ps output:\n%s", shortCID, out)) <add> assert.Assert(c, !strings.Contains(out, shortCID), "Should have not seen '%s' in ps output:\n%s", shortCID, out) <ide> // Make sure it DOES show up as 'Created' for 'ps -a' <ide> out, _ = dockerCmd(c, "ps", "-a") <ide> <ide> func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) { <ide> continue <ide> } <ide> hits++ <del> assert.Assert(c, strings.Contains(line, "Created"), fmt.Sprintf("Missing 'Created' on '%s'", line)) <add> assert.Assert(c, strings.Contains(line, "Created"), "Missing 'Created' on '%s'", line) <ide> } <ide> <ide> assert.Equal(c, hits, 1, fmt.Sprintf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out)) <ide> func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) { <ide> out, _ = dockerCmd(c, "ps", "-l") <ide> lines = strings.Split(strings.TrimSpace(string(out)), "\n") <ide> fields = strings.Fields(lines[1]) <del> assert.Assert(c, fields[len(fields)-2] != expected, fmt.Sprintf("Should not got %v", expected)) <add> assert.Assert(c, fields[len(fields)-2] != expected, "Should not got %v", expected) <ide> } <ide> <ide> func (s *DockerSuite) TestPsShowMounts(c *testing.T) { <ide><path>integration-cli/docker_cli_rmi_test.go <ide> func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) { <ide> // Container is using image, should not be able to rmi <ide> assert.ErrorContains(c, err, "") <ide> // Container is using image, error message should contain errSubstr <del> assert.Assert(c, strings.Contains(out, errSubstr), fmt.Sprintf("Container: %q", cleanedContainerID)) <add> assert.Assert(c, strings.Contains(out, errSubstr), "Container: %q", cleanedContainerID) <ide> // make sure it didn't delete the busybox name <ide> images, _ := dockerCmd(c, "images") <ide> // The name 'busybox' should not have been removed from images <ide> func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) { <ide> <ide> imagesAfter = cli.DockerCmd(c, "images", "-a").Combined() <ide> // rmi -f failed, image still exists <del> assert.Assert(c, !strings.Contains(imagesAfter, imgID[:12]), fmt.Sprintf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter)) <add> assert.Assert(c, !strings.Contains(imagesAfter, imgID[:12]), "ImageID:%q; ImagesAfter: %q", imgID, imagesAfter) <ide> } <ide> <ide> func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) { <ide> func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) { <ide> assert.Assert(c, !strings.Contains(out, "Untagged: "+tag1)) <ide> // Check built image still exists <ide> images, _ := dockerCmd(c, "images", "-a") <del> assert.Assert(c, strings.Contains(images, imageName), fmt.Sprintf("Built image missing %q; Images: %q", imageName, images)) <add> assert.Assert(c, strings.Contains(images, imageName), "Built image missing %q; Images: %q", imageName, images) <ide> } <ide> <ide> func (s *DockerSuite) TestRmiBlank(c *testing.T) { <ide> out, _, err := dockerCmdWithError("rmi", " ") <ide> // Should have failed to delete ' ' image <ide> assert.ErrorContains(c, err, "") <ide> // Wrong error message generated <del> assert.Assert(c, !strings.Contains(out, "no such id"), fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, !strings.Contains(out, "no such id"), "out: %s", out) <ide> // Expected error message not generated <del> assert.Assert(c, strings.Contains(out, "image name cannot be blank"), fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, strings.Contains(out, "image name cannot be blank"), "out: %s", out) <ide> } <ide> <ide> func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) { <ide> func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) { <ide> out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0]) <ide> // The image of the running container should not be removed. <ide> assert.ErrorContains(c, err, "") <del> assert.Assert(c, strings.Contains(out, "image is being used by running container"), fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, strings.Contains(out, "image is being used by running container"), "out: %s", out) <ide> } <ide> <ide> // #13422 <ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) { <ide> assert.Assert(c, err != nil, "Expected docker run to fail!") <ide> <ide> containerID, err := inspectFieldWithError(name, "Id") <del> assert.Assert(c, err != nil, fmt.Sprintf("Expected not to have this container: %s!", containerID)) <add> assert.Assert(c, err != nil, "Expected not to have this container: %s!", containerID) <ide> assert.Equal(c, containerID, "", fmt.Sprintf("Expected not to have this container: %s!", containerID)) <ide> } <ide> <ide> func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) { <ide> // We will need the following `inspect` to diagnose the issue if test fails (#21247) <ide> out1, err1 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "test") <ide> out2, err2 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "fail") <del> assert.Assert(c, err != nil, fmt.Sprintf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2)) <add> assert.Assert(c, err != nil, "Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2) <ide> // check for windows error as well <ide> // TODO Windows Post TP5. Fix the error message string <ide> assert.Assert(c, strings.Contains(string(out), "port is already allocated") || <ide> func (s *DockerSuite) TestRunDNSInHostMode(c *testing.T) { <ide> expectedOutput2 := "search example.com" <ide> expectedOutput3 := "options timeout:3" <ide> out := cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--dns-search=example.com", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "/etc/resolv.conf").Combined() <del> assert.Assert(c, strings.Contains(out, expectedOutput1), fmt.Sprintf("Expected '%s', but got %q", expectedOutput1, out)) <del> assert.Assert(c, strings.Contains(out, expectedOutput2), fmt.Sprintf("Expected '%s', but got %q", expectedOutput2, out)) <del> assert.Assert(c, strings.Contains(out, expectedOutput3), fmt.Sprintf("Expected '%s', but got %q", expectedOutput3, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput1), "Expected '%s', but got %q", expectedOutput1, out) <add> assert.Assert(c, strings.Contains(out, expectedOutput2), "Expected '%s', but got %q", expectedOutput2, out) <add> assert.Assert(c, strings.Contains(out, expectedOutput3), "Expected '%s', but got %q", expectedOutput3, out) <ide> } <ide> <ide> // Test case for #21976 <ide> func (s *DockerSuite) TestRunAddHostInHostMode(c *testing.T) { <ide> <ide> expectedOutput := "1.2.3.4\textra" <ide> out, _ := dockerCmd(c, "run", "--add-host=extra:1.2.3.4", "--net=host", "busybox", "cat", "/etc/hosts") <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> } <ide> <ide> func (s *DockerSuite) TestRunRmAndWait(c *testing.T) { <ide> dockerCmd(c, "run", "--name=test", "--rm", "-d", "busybox", "sh", "-c", "sleep 3;exit 2") <ide> <ide> out, code, err := dockerCmdWithError("wait", "test") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %s; exit code: %d", out, code)) <add> assert.Assert(c, err == nil, "out: %s; exit code: %d", out, code) <ide> assert.Equal(c, out, "2\n", "exit code: %d", code) <ide> assert.Equal(c, code, 0) <ide> } <ide> func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) { <ide> <ide> out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true") <ide> assert.ErrorContains(c, err, "") <del> assert.Assert(c, strings.Contains(out, "failed to initialize logging driver"), fmt.Sprintf("error should be about logging driver, got output %s", out)) <add> assert.Assert(c, strings.Contains(out, "failed to initialize logging driver"), "error should be about logging driver, got output %s", out) <ide> // NGoroutines is not updated right away, so we need to wait before failing <ide> assert.Assert(c, waitForGoroutines(nroutines) == nil) <ide> } <ide> func (s *DockerSuite) TestRunCredentialSpecFailures(c *testing.T) { <ide> } <ide> for _, attempt := range attempts { <ide> _, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true") <del> assert.Assert(c, err != nil, fmt.Sprintf("%s expected non-nil err", attempt.value)) <del> assert.Assert(c, strings.Contains(err.Error(), attempt.expectedError), fmt.Sprintf("%s expected %s got %s", attempt.value, attempt.expectedError, err)) <add> assert.Assert(c, err != nil, "%s expected non-nil err", attempt.value) <add> assert.Assert(c, strings.Contains(err.Error(), attempt.expectedError), "%s expected %s got %s", attempt.value, attempt.expectedError, err) <ide> } <ide> } <ide> <ide> func (s *DockerSuite) TestRunMount(c *testing.T) { <ide> _, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName}, <ide> append(opts, []string{"busybox", "top"}...)...)...) <ide> if testCase.valid { <del> assert.Assert(c, err == nil, fmt.Sprintf("got error while creating a container with %v (%s)", opts, cName)) <del> assert.Assert(c, testCase.fn(cName) == nil, fmt.Sprintf("got error while executing test for %v (%s)", opts, cName)) <add> assert.Assert(c, err == nil, "got error while creating a container with %v (%s)", opts, cName) <add> assert.Assert(c, testCase.fn(cName) == nil, "got error while executing test for %v (%s)", opts, cName) <ide> dockerCmd(c, "rm", "-f", cName) <ide> } else { <del> assert.Assert(c, err != nil, fmt.Sprintf("got nil while creating a container with %v (%s)", opts, cName)) <add> assert.Assert(c, err != nil, "got nil while creating a container with %v (%s)", opts, cName) <ide> } <ide> } <ide> } <ide><path>integration-cli/docker_cli_run_unix_test.go <ide> func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) { <ide> <ide> // Create a temporary tmpfs mount. <ide> tmpfsDir := filepath.Join(tmpDir, "tmpfs") <del> assert.Assert(c, os.MkdirAll(tmpfsDir, 0777) == nil, fmt.Sprintf("failed to mkdir at %s", tmpfsDir)) <del> assert.Assert(c, mount.Mount("tmpfs", tmpfsDir, "tmpfs", "") == nil, fmt.Sprintf("failed to create a tmpfs mount at %s", tmpfsDir)) <add> assert.Assert(c, os.MkdirAll(tmpfsDir, 0777) == nil, "failed to mkdir at %s", tmpfsDir) <add> assert.Assert(c, mount.Mount("tmpfs", tmpfsDir, "tmpfs", "") == nil, "failed to create a tmpfs mount at %s", tmpfsDir) <ide> <ide> f, err := ioutil.TempFile(tmpfsDir, "touch-me") <ide> assert.NilError(c, err) <ide> func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) { <ide> out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true") <ide> assert.ErrorContains(c, err, "") <ide> expected := "Valid memory swappiness range is 0-100" <del> assert.Assert(c, strings.Contains(out, expected), fmt.Sprintf("Expected output to contain %q, not %q", out, expected)) <add> assert.Assert(c, strings.Contains(out, expected), "Expected output to contain %q, not %q", out, expected) <ide> out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true") <ide> assert.ErrorContains(c, err, "") <del> assert.Assert(c, strings.Contains(out, expected), fmt.Sprintf("Expected output to contain %q, not %q", out, expected)) <add> assert.Assert(c, strings.Contains(out, expected), "Expected output to contain %q, not %q", out, expected) <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) { <ide><path>integration-cli/docker_cli_save_load_test.go <ide> func (s *DockerSuite) TestSaveImageId(c *testing.T) { <ide> <ide> var err error <ide> tarCmd.Stdin, err = saveCmd.StdoutPipe() <del> assert.Assert(c, err == nil, fmt.Sprintf("cannot set stdout pipe for tar: %v", err)) <add> assert.Assert(c, err == nil, "cannot set stdout pipe for tar: %v", err) <ide> grepCmd := exec.Command("grep", cleanedLongImageID) <ide> grepCmd.Stdin, err = tarCmd.StdoutPipe() <del> assert.Assert(c, err == nil, fmt.Sprintf("cannot set stdout pipe for grep: %v", err)) <add> assert.Assert(c, err == nil, "cannot set stdout pipe for grep: %v", err) <ide> <del> assert.Assert(c, tarCmd.Start() == nil, fmt.Sprintf("tar failed with error: %v", err)) <del> assert.Assert(c, saveCmd.Start() == nil, fmt.Sprintf("docker save failed with error: %v", err)) <add> assert.Assert(c, tarCmd.Start() == nil, "tar failed with error: %v", err) <add> assert.Assert(c, saveCmd.Start() == nil, "docker save failed with error: %v", err) <ide> defer func() { <ide> saveCmd.Wait() <ide> tarCmd.Wait() <ide> func (s *DockerSuite) TestSaveImageId(c *testing.T) { <ide> <ide> out, _, err = runCommandWithOutput(grepCmd) <ide> <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to save repo with image ID: %s, %v", out, err)) <add> assert.Assert(c, err == nil, "failed to save repo with image ID: %s, %v", out, err) <ide> } <ide> <ide> // save a repo and try to load it using flags <ide> func (s *DockerSuite) TestSaveDirectoryPermissions(c *testing.T) { <ide> <ide> name := "save-directory-permissions" <ide> tmpDir, err := ioutil.TempDir("", "save-layers-with-directories") <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to create temporary directory: %s", err)) <add> assert.Assert(c, err == nil, "failed to create temporary directory: %s", err) <ide> extractionDirectory := filepath.Join(tmpDir, "image-extraction-dir") <ide> os.Mkdir(extractionDirectory, 0777) <ide> <ide><path>integration-cli/docker_cli_service_create_test.go <ide> func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *testing.T) { <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id)) <add> assert.Assert(c, id != "", "secrets: %s", id) <ide> <ide> out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top") <ide> assert.NilError(c, err, out) <ide> func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi <ide> }, <ide> Data: []byte("TESTINGDATA " + testName + " " + testTarget), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id)) <add> assert.Assert(c, id != "", "secrets: %s", id) <ide> <ide> secretFlags = append(secretFlags, "--secret", fmt.Sprintf("source=%s,target=%s", testName, testTarget)) <ide> } <ide> func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id)) <add> assert.Assert(c, id != "", "secrets: %s", id) <ide> <ide> serviceName := "svc" <ide> out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top") <ide> func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *testing.T) { <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id)) <add> assert.Assert(c, id != "", "configs: %s", id) <ide> <ide> out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top") <ide> assert.NilError(c, err, out) <ide> func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi <ide> }, <ide> Data: []byte("TESTINGDATA " + testName + " " + testTarget), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id)) <add> assert.Assert(c, id != "", "configs: %s", id) <ide> <ide> configFlags = append(configFlags, "--config", fmt.Sprintf("source=%s,target=%s", testName, testTarget)) <ide> } <ide> func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id)) <add> assert.Assert(c, id != "", "configs: %s", id) <ide> <ide> serviceName := "svc" <ide> out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top") <ide><path>integration-cli/docker_cli_start_test.go <ide> func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) { <ide> // Expect this to fail because the above container is stopped, this is what we want <ide> out, _, err := dockerCmdWithError("run", "--name", "test2", "--link", "test:test", "busybox") <ide> // err shouldn't be nil because container test2 try to link to stopped container <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> <ide> ch := make(chan error) <ide> go func() { <ide> func (s *DockerSuite) TestStartRecordError(c *testing.T) { <ide> // Expect this to fail and records error because of ports conflict <ide> out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top") <ide> // err shouldn't be nil because docker run will fail <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> <ide> stateErr = inspectField(c, "test2", "State.Error") <ide> assert.Assert(c, strings.Contains(stateErr, "port is already allocated")) <ide> func (s *DockerSuite) TestStartPausedContainer(c *testing.T) { <ide> <ide> out, _, err := dockerCmdWithError("start", "testing") <ide> // an error should have been shown that you cannot start paused container <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // an error should have been shown that you cannot start paused container <ide> assert.Assert(c, strings.Contains(strings.ToLower(out), "cannot start a paused container, try unpause instead")) <ide> } <ide> func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) { <ide> expErr := "failed to start containers: [child_first]" <ide> out, _, err := dockerCmdWithError("start", "child_first", "parent", "child_second") <ide> // err shouldn't be nil because start will fail <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // output does not correspond to what was expected <ide> if !(strings.Contains(out, expOut) || strings.Contains(err.Error(), expErr)) { <ide> c.Fatalf("Expected out: %v with err: %v but got out: %v with err: %v", expOut, expErr, out, err) <ide> func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) { <ide> for _, option := range []string{"-a", "-i", "-ai"} { <ide> out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3") <ide> // err shouldn't be nil because start will fail <del> assert.Assert(c, err != nil, fmt.Sprintf("out: %s", out)) <add> assert.Assert(c, err != nil, "out: %s", out) <ide> // output does not correspond to what was expected <ide> assert.Assert(c, strings.Contains(out, "you cannot start and attach multiple containers at once")) <ide> } <ide><path>integration-cli/docker_cli_swarm_test.go <ide> func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) { <ide> func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) { <ide> d := s.AddDaemon(c, true, true) <ide> hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", hostname)) <add> assert.Assert(c, err == nil, "%s", hostname) <ide> <ide> out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top") <ide> assert.NilError(c, err, out) <ide> func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *testing.T) { <ide> assert.NilError(c, err, out) <ide> lines := strings.Split(strings.Trim(out, "\n "), "\n") <ide> assert.Equal(c, len(lines), 1) <del> assert.Assert(c, lines[0] != bareID, fmt.Sprintf("Expected not %s, but got it for is-task label, output %q", bareID, out)) <add> assert.Assert(c, lines[0] != bareID, "Expected not %s, but got it for is-task label, output %q", bareID, out) <ide> } <ide> <ide> const globalNetworkPlugin = "global-network-plugin" <ide> func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) { <ide> <ide> out, err = d.Cmd("exec", id, "cat", "/status") <ide> assert.NilError(c, err, out) <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> // Remove service <ide> out, err = d.Cmd("service", "rm", name) <ide> assert.NilError(c, err, out) <ide> func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) { <ide> <ide> out, err = d.Cmd("exec", id, "cat", "/status") <ide> assert.NilError(c, err, out) <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> } <ide> <ide> func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *testing.T) { <ide> func (s *DockerSwarmSuite) TestDNSConfig(c *testing.T) { <ide> expectedOutput3 := "options timeout:3" <ide> out, err = d.Cmd("exec", id, "cat", "/etc/resolv.conf") <ide> assert.NilError(c, err, out) <del> assert.Assert(c, strings.Contains(out, expectedOutput1), fmt.Sprintf("Expected '%s', but got %q", expectedOutput1, out)) <del> assert.Assert(c, strings.Contains(out, expectedOutput2), fmt.Sprintf("Expected '%s', but got %q", expectedOutput2, out)) <del> assert.Assert(c, strings.Contains(out, expectedOutput3), fmt.Sprintf("Expected '%s', but got %q", expectedOutput3, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput1), "Expected '%s', but got %q", expectedOutput1, out) <add> assert.Assert(c, strings.Contains(out, expectedOutput2), "Expected '%s', but got %q", expectedOutput2, out) <add> assert.Assert(c, strings.Contains(out, expectedOutput3), "Expected '%s', but got %q", expectedOutput3, out) <ide> } <ide> <ide> func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *testing.T) { <ide> func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) { <ide> d := s.AddDaemon(c, false, false) <ide> <ide> outs, err := d.Cmd("swarm", "init", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> unlockKey := getUnlockKey(d, c, outs) <ide> <ide> assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) <ide> func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) { <ide> assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) <ide> <ide> outs, err = d.Cmd("node", "ls") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) <ide> outs, err = d.Cmd("swarm", "update", "--autolock=false") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> <ide> checkSwarmLockedToUnlocked(c, d) <ide> <ide> outs, err = d.Cmd("node", "ls") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) <ide> } <ide> <ide> func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) { <ide> d := s.AddDaemon(c, false, false) <ide> <ide> outs, err := d.Cmd("swarm", "init", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> <ide> // It starts off locked <ide> d.RestartNode(c) <ide> func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) { <ide> assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked.")) <ide> // It is OK for user to leave a locked swarm with --force <ide> outs, err = d.Cmd("swarm", "leave", "--force") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> <ide> info = d.SwarmInfo(c) <ide> assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive) <ide> <ide> outs, err = d.Cmd("swarm", "init") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> <ide> info = d.SwarmInfo(c) <ide> assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) <ide> func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) { <ide> <ide> // enable autolock <ide> outs, err := d1.Cmd("swarm", "update", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> unlockKey := getUnlockKey(d1, c, outs) <ide> <ide> // The ones that got the cluster update should be set to locked <ide> func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) { <ide> <ide> // leave it locked, and set the cluster to no longer autolock <ide> outs, err = d1.Cmd("swarm", "update", "--autolock=false") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> <ide> // the ones that got the update are now set to unlocked <ide> for _, d := range []*daemon.Daemon{d1, d3} { <ide> func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) { <ide> <ide> // enable autolock <ide> outs, err := d1.Cmd("swarm", "update", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> unlockKey := getUnlockKey(d1, c, outs) <ide> <ide> // joined workers start off unlocked <ide> func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) { <ide> d := s.AddDaemon(c, true, true) <ide> <ide> outs, err := d.Cmd("swarm", "update", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> unlockKey := getUnlockKey(d, c, outs) <ide> <ide> // Rotate multiple times <ide> for i := 0; i != 3; i++ { <ide> outs, err = d.Cmd("swarm", "unlock-key", "-q", "--rotate") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> // Strip \n <ide> newUnlockKey := outs[:len(outs)-1] <ide> assert.Assert(c, newUnlockKey != "") <ide> func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) { <ide> d3 := s.AddDaemon(c, true, true) <ide> <ide> outs, err := d1.Cmd("swarm", "update", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> unlockKey := getUnlockKey(d1, c, outs) <ide> <ide> // Rotate multiple times <ide> for i := 0; i != 3; i++ { <ide> outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> // Strip \n <ide> newUnlockKey := outs[:len(outs)-1] <ide> assert.Assert(c, newUnlockKey != "") <ide> func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) { <ide> continue <ide> } <ide> } <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", outs)) <add> assert.Assert(c, err == nil, "%s", outs) <ide> assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) <ide> break <ide> } <ide> func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) { <ide> for i := 0; i < 2; i++ { <ide> // set to lock <ide> outs, err := d.Cmd("swarm", "update", "--autolock") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> assert.Assert(c, strings.Contains(outs, "docker swarm unlock")) <ide> unlockKey := getUnlockKey(d, c, outs) <ide> <ide> func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) { <ide> assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive) <ide> <ide> outs, err = d.Cmd("swarm", "update", "--autolock=false") <del> assert.Assert(c, err == nil, fmt.Sprintf("out: %v", outs)) <add> assert.Assert(c, err == nil, "out: %v", outs) <ide> <ide> checkSwarmLockedToUnlocked(c, d) <ide> } <ide> func (s *DockerSwarmSuite) TestExtraHosts(c *testing.T) { <ide> expectedOutput := "1.2.3.4\texample.com" <ide> out, err = d.Cmd("exec", id, "cat", "/etc/hosts") <ide> assert.NilError(c, err, out) <del> assert.Assert(c, strings.Contains(out, expectedOutput), fmt.Sprintf("Expected '%s', but got %q", expectedOutput, out)) <add> assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out) <ide> } <ide> <ide> func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *testing.T) { <ide> func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *testing.T) { <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("secrets: %s", id)) <add> assert.Assert(c, id != "", "secrets: %s", id) <ide> <ide> waitForEvent(c, d, "0", "-f scope=swarm", "secret create "+id, defaultRetryCount) <ide> <ide> func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) { <ide> }, <ide> Data: []byte("TESTINGDATA"), <ide> }) <del> assert.Assert(c, id != "", fmt.Sprintf("configs: %s", id)) <add> assert.Assert(c, id != "", "configs: %s", id) <ide> <ide> waitForEvent(c, d, "0", "-f scope=swarm", "config create "+id, defaultRetryCount) <ide> <ide> func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) { <ide> <ide> func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string { <ide> unlockKey, err := d.Cmd("swarm", "unlock-key", "-q") <del> assert.Assert(c, err == nil, fmt.Sprintf("%s", unlockKey)) <add> assert.Assert(c, err == nil, "%s", unlockKey) <ide> unlockKey = strings.TrimSuffix(unlockKey, "\n") <ide> <ide> // Check that "docker swarm init --autolock" or "docker swarm update --autolock" <ide><path>integration-cli/docker_cli_userns_test.go <ide> func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) { <ide> assert.Equal(c, statNotExists.GID(), uint32(gid), "Created directory not owned by remapped root GID") <ide> <ide> pid, err := s.d.Cmd("inspect", "--format={{.State.Pid}}", "userns") <del> assert.Assert(c, err == nil, fmt.Sprintf("Could not inspect running container: out: %q", pid)) <add> assert.Assert(c, err == nil, "Could not inspect running container: out: %q", pid) <ide> // check the uid and gid maps for the PID to ensure root is remapped <ide> // (cmd = cat /proc/<pid>/uid_map | grep -E '0\s+9999\s+1') <ide> _, err = RunCommandPipelineWithOutput( <ide> func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) { <ide> <ide> // use host usernamespace <ide> out, err = s.d.Cmd("run", "-d", "--name", "userns_skip", "--userns", "host", "busybox", "sh", "-c", "touch /goofy/testfile; top") <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out)) <add> assert.Assert(c, err == nil, "Output: %s", out) <ide> user = s.findUser(c, "userns_skip") <ide> // userns are skipped, user is root <ide> assert.Equal(c, user, "root") <ide> func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) { <ide> // findUser finds the uid or name of the user of the first process that runs in a container <ide> func (s *DockerDaemonSuite) findUser(c *testing.T, container string) string { <ide> out, err := s.d.Cmd("top", container) <del> assert.Assert(c, err == nil, fmt.Sprintf("Output: %s", out)) <add> assert.Assert(c, err == nil, "Output: %s", out) <ide> rows := strings.Split(out, "\n") <ide> if len(rows) < 2 { <ide> // No process rows founds <ide><path>integration-cli/docker_cli_volume_test.go <ide> func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) { <ide> <ide> // Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output <ide> assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output") <del> assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected")) <del> assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected")) <add> assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), "volume 'testisinuse1' in output, but not expected") <add> assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), "volume 'testisinuse2' in output, but not expected") <ide> out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1") <ide> // Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1 <ide> assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output") <del> assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), fmt.Sprintf("volume 'testisinuse1' in output, but not expected")) <del> assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), fmt.Sprintf("volume 'testisinuse2' in output, but not expected")) <add> assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), "volume 'testisinuse1' in output, but not expected") <add> assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), "volume 'testisinuse2' in output, but not expected") <ide> out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0") <ide> // dangling=0 is same as dangling=false case <ide> assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), "expected volume 'testnotinuse1' in output") <ide> func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) { <ide> name := strings.TrimSpace(out) <ide> <ide> out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name) <del> assert.Assert(c, err != nil, fmt.Sprintf("Output: %s", out)) <add> assert.Assert(c, err != nil, "Output: %s", out) <ide> assert.Equal(c, exitCode, 1, fmt.Sprintf("Output: %s", out)) <ide> assert.Assert(c, strings.Contains(out, "Template parsing error")) <ide> } <ide> func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) { <ide> assert.Assert(c, strings.Contains(strings.TrimSpace(out), data1)) <ide> assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) <ide> out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-d", "busybox", "top") <del> assert.Assert(c, err == nil, fmt.Sprintf("Out: %s", out)) <add> assert.Assert(c, err == nil, "Out: %s", out) <ide> <ide> // Only the second volume will be referenced, this is backward compatible <ide> out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app") <ide> func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T <ide> assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) <ide> // /tmp/data is automatically created, because we are not using the modern mount API here <ide> out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-v", "/tmp/data:/tmp/data", "-d", "busybox", "top") <del> assert.Assert(c, err == nil, fmt.Sprintf("Out: %s", out)) <add> assert.Assert(c, err == nil, "Out: %s", out) <ide> <ide> // No volume will be referenced (mount is /tmp/data), this is backward compatible <ide> out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app") <ide><path>integration-cli/docker_hub_pull_suite_test.go <ide> package main <ide> <ide> import ( <del> "fmt" <ide> "os/exec" <ide> "strings" <ide> "testing" <ide> func (s *DockerHubPullSuite) TearDownTest(c *testing.T) { <ide> // output. The function fails the test when the command returns an error. <ide> func (s *DockerHubPullSuite) Cmd(c *testing.T, name string, arg ...string) string { <ide> out, err := s.CmdWithError(name, arg...) <del> assert.Assert(c, err == nil, fmt.Sprintf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err)) <add> assert.Assert(c, err == nil, "%q failed with errors: %s, %v", strings.Join(arg, " "), out, err) <ide> return out <ide> } <ide> <ide><path>integration-cli/docker_utils_test.go <ide> func inspectFieldAndUnmarshall(c *testing.T, name, field string, output interfac <ide> str := inspectFieldJSON(c, name, field) <ide> err := json.Unmarshal([]byte(str), output) <ide> if c != nil { <del> assert.Assert(c, err == nil, fmt.Sprintf("failed to unmarshal: %v", err)) <add> assert.Assert(c, err == nil, "failed to unmarshal: %v", err) <ide> } <ide> } <ide>
30
Python
Python
use exceptions intead of returning tuple
177afe7b135edec64c2f0cf0aa06637d85836284
<ide><path>airflow/hooks/hive_hooks.py <ide> def __init__( <ide> self.use_beeline = conn.extra_dejson.get('use_beeline', False) <ide> self.conn = conn <ide> <del> def run_cli(self, hql, schema=None, test=False): <add> def run_cli(self, hql, schema=None, verbose=True): <ide> """ <ide> Run an hql statement using the hive cli <ide> <ide> def run_cli(self, hql, schema=None, test=False): <ide> if self.hive_cli_params: <ide> hive_params_list = self.hive_cli_params.split() <ide> hive_cmd.extend(hive_params_list) <del> if not test: <add> if verbose: <ide> logging.info(" ".join(hive_cmd)) <ide> sp = subprocess.Popen( <ide> hive_cmd, <ide> stdout=subprocess.PIPE, <ide> stderr=subprocess.STDOUT, <ide> cwd=tmp_dir) <del> all_err = '' <ide> self.sp = sp <ide> stdout = '' <ide> for line in iter(sp.stdout.readline, ''): <ide> stdout += line <del> if not test: <add> if verbose: <ide> logging.info(line.strip()) <ide> sp.wait() <ide> <ide> if sp.returncode: <del> if not test: <del> raise AirflowException(all_err) <del> else: <del> return (False, stdout) <add> raise AirflowException(stdout) <add> <add> return stdout <ide> <del> if not test: <del> return stdout <del> else: <del> return (True, stdout) <ide> <ide> def test_hql(self, hql): <ide> """ <ide> def test_hql(self, hql): <ide> query = other + '; explain ' + query <ide> else: <ide> query = 'explain ' + query <del> success, output = self.run_cli(query, test=True) <del> if success: <del> logging.info("SUCCESS") <del> else: <del> failure_message = output.split('\n')[-2] <del> logging.info(failure_message) <del> line_number = re.search('(\d+):(\d+)', failure_message).group(1) <del> if line_number.isdigit(): <del> l = int(line_number) <del> begin = max(l-2, 0) <del> end = min(l+3, len(query.split('\n'))) <del> context = '\n'.join(query.split('\n')[begin:end]) <del> logging.info("Context :\n {0}".format(context)) <add> try: <add> self.run_cli(query, verbose=False) <add> except AirflowException as e: <add> failure_message = e.args[0].split('\n')[-2] <add> logging.info(failure_message) <add> line_number = re.search('(\d+):(\d+)', failure_message).group(1) <add> if line_number.isdigit(): <add> l = int(line_number) <add> begin = max(l-2, 0) <add> end = min(l+3, len(query.split('\n'))) <add> context = '\n'.join(query.split('\n')[begin:end]) <add> logging.info("Context :\n {0}".format(context)) <add> else: <add> logging.info("SUCCESS") <ide> <ide> <ide> def load_file(
1
Text
Text
fix numpy.zeros() dtype for doc.from_array
a6abdfbc3c5a298b9d0e547451701f6705fd09b7
<ide><path>website/docs/usage/linguistic-features.md <ide> doc = nlp.make_doc("London is a big city in the United Kingdom.") <ide> print("Before", doc.ents) # [] <ide> <ide> header = [ENT_IOB, ENT_TYPE] <del>attr_array = numpy.zeros((len(doc), len(header))) <add>attr_array = numpy.zeros((len(doc), len(header)), dtype="uint64") <ide> attr_array[0, 0] = 3 # B <ide> attr_array[0, 1] = doc.vocab.strings["GPE"] <ide> doc.from_array(header, attr_array)
1
Text
Text
fix the broken links
475e4310550a97d1b91a22648cae5aaa0bd9c5fe
<ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> <ide> **Date**: [13rd May 2015][3.1.2-milestone]. <ide> <del>* DateField to_representation can handle str and empty values. ([#2656](gh2656), [#2687](gh2687), [#2869](gh2869)) <del>* Use default reason phrases from HTTP standard. ([#2764](gh2764), [#2763](gh2763)) <del>* Raise error when ModelSerializer used with abstract model. ([#2757](gh2757), [#2630](gh2630)) <del>* Handle reversal of non-API view_name in HyperLinkedRelatedField ([#2724](gh2724), [#2711](gh2711)) <del>* Dont require pk strictly for related fields. ([#2745](gh2745), [#2754](gh2754)) <del>* Metadata detects null boolean field type. ([#2762](gh2762)) <del>* Proper handling of depth in nested serializers. ([#2798](gh2798)) <del>* Display viewset without paginator. ([#2807](gh2807)) <del>* Don't check for deprecated '.model' attribute in permissions ([#2818](gh2818)) <del>* Restrict integer field to integers and strings. ([#2835](gh2835), [#2836](gh2836)) <del>* Improve IntegerField to use compiled decimal regex. ([#2853](gh2853)) <del>* Prevent empty `queryset`s to raise AssertionError. ([#2862](gh2862)) <del>* DjangoModelPermissions rely on get_queryset. ([#2863](gh2863)) <del>* Check AcceptHeaderVersioning with content negotiation in place. ([#2868](gh2868)) <del>* Allow DjangoObjectPermissions to use views that define get_queryset ([#2905](gh2905)) <add>* DateField to_representation can handle str and empty values. ([#2656][gh2656], [#2687][gh2687], [#2869][gh2869]) <add>* Use default reason phrases from HTTP standard. ([#2764][gh2764], [#2763][gh2763]) <add>* Raise error when ModelSerializer used with abstract model. ([#2757][gh2757], [#2630][gh2630]) <add>* Handle reversal of non-API view_name in HyperLinkedRelatedField ([#2724][gh2724], [#2711][gh2711]) <add>* Dont require pk strictly for related fields. ([#2745](gh2745), [#2754][gh2754]) <add>* Metadata detects null boolean field type. ([#2762][gh2762]) <add>* Proper handling of depth in nested serializers. ([#2798][gh2798]) <add>* Display viewset without paginator. ([#2807][gh2807]) <add>* Don't check for deprecated '.model' attribute in permissions ([#2818][gh2818]) <add>* Restrict integer field to integers and strings. ([#2835](gh2835), [#2836][gh2836]) <add>* Improve IntegerField to use compiled decimal regex. ([#2853][gh2853]) <add>* Prevent empty `queryset`s to raise AssertionError. ([#2862][gh2862]) <add>* DjangoModelPermissions rely on get_queryset. ([#2863][gh2863]) <add>* Check AcceptHeaderVersioning with content negotiation in place. ([#2868][gh2868]) <add>* Allow DjangoObjectPermissions to use views that define get_queryset ([#2905][gh2905]) <ide> <ide> <ide> ### 3.1.1 <ide> <ide> **Date**: [23rd March 2015][3.1.1-milestone]. <ide> <ide> * **Security fix**: Escape tab switching cookie name in browsable API. <del>* Display input forms in browsable API if `serializer_class` is used, even when `get_serializer` method does not exist on the view. ([#2743](gh2743)) <del>* Use a password input for the AuthTokenSerializer. ([#2741](gh2741)) <add>* Display input forms in browsable API if `serializer_class` is used, even when `get_serializer` method does not exist on the view. ([#2743][gh2743]) <add>* Use a password input for the AuthTokenSerializer. ([#2741][gh2741]) <ide> * Fix missing anchor closing tag after next button. ([#2691][gh2691]) <ide> * Fix `lookup_url_kwarg` handling in viewsets. ([#2685][gh2685], [#2591][gh2591]) <ide> * Fix problem with importing `rest_framework.views` in `apps.py` ([#2678][gh2678])
1
Ruby
Ruby
move tests higher up the stack
c34b6b092ab0d5a620b10098f43f59d7cebb85a4
<ide><path>actionpack/test/journey/router_test.rb <ide> # frozen_string_literal: true <ide> <ide> require "abstract_unit" <add>require "rack/utils" <ide> <ide> module ActionDispatch <ide> module Journey <ide> def test_generate_id <ide> path, params = _generate( <ide> nil, { id: 1, controller: "tasks", action: "show" }, {}) <ide> assert_equal "/tasks/show", path <del> assert_equal({ id: 1 }, params) <add> assert_equal({ id: "1" }, params) <ide> end <ide> <ide> def test_generate_escapes <ide> def test_generate_extra_params <ide> relative_url_root: nil <ide> }, {}) <ide> assert_equal "/tasks/show", path <del> assert_equal({ id: 1, relative_url_root: nil }, params) <add> assert_equal({ id: "1" }, params) <ide> end <ide> <ide> def test_generate_missing_keys_no_matches_different_format_keys <ide> def test_eager_load_without_routes <ide> end <ide> <ide> private <del> def _generate(*args) <del> ActionDispatch::Routing::RouteSet::Generator.new(*args, @route_set).generate(nil).to_ary <add> def _generate(route_name, options, recall) <add> if recall <add> options = options.merge(:_recall => recall) <add> end <add> path = @route_set.path_for(options, route_name) <add> uri = URI.parse path <add> params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys <add> [uri.path, params] <ide> end <ide> <ide> def get(*args)
1
Javascript
Javascript
remove usage of public require('util')
a1330af6a3a6cae16bda0b2512033139f5e71d1a
<ide><path>lib/_tls_wrap.js <ide> <ide> 'use strict'; <ide> <del>require('internal/util').assertCrypto(); <add>const { <add> assertCrypto, <add> deprecate <add>} = require('internal/util'); <add> <add>assertCrypto(); <ide> <ide> const assert = require('internal/assert'); <ide> const crypto = require('crypto'); <ide> const net = require('net'); <ide> const tls = require('tls'); <del>const util = require('util'); <ide> const common = require('_tls_common'); <ide> const JSStreamSocket = require('internal/js_stream_socket'); <ide> const { Buffer } = require('buffer'); <del>const debug = util.debuglog('tls'); <add>const debug = require('internal/util/debuglog').debuglog('tls'); <ide> const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap'); <ide> const tls_wrap = internalBinding('tls_wrap'); <ide> const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); <ide> function TLSSocket(socket, opts) { <ide> // Read on next tick so the caller has a chance to setup listeners <ide> process.nextTick(initRead, this, socket); <ide> } <del>util.inherits(TLSSocket, net.Socket); <add>Object.setPrototypeOf(TLSSocket.prototype, net.Socket.prototype); <add>Object.setPrototypeOf(TLSSocket, net.Socket); <ide> exports.TLSSocket = TLSSocket; <ide> <ide> var proxiedMethods = [ <ide> function Server(options, listener) { <ide> } <ide> } <ide> <del>util.inherits(Server, net.Server); <add>Object.setPrototypeOf(Server.prototype, net.Server.prototype); <add>Object.setPrototypeOf(Server, net.Server); <ide> exports.Server = Server; <ide> exports.createServer = function createServer(options, listener) { <ide> return new Server(options, listener); <ide> Server.prototype.setTicketKeys = function setTicketKeys(keys) { <ide> }; <ide> <ide> <del>Server.prototype.setOptions = util.deprecate(function(options) { <add>Server.prototype.setOptions = deprecate(function(options) { <ide> this.requestCert = options.requestCert === true; <ide> this.rejectUnauthorized = options.rejectUnauthorized !== false; <ide>
1
Text
Text
add link to help repo in readme
7c3ab1d935755ca51050f4f6f8840819b82fda11
<ide><path>README.md <ide> If you need help using or installing Node.js, please use the <ide> ### Official Resources <ide> <ide> * [Website][] <add>* [Node.js Help][] <ide> * [Contributing to the project][] <ide> * IRC (node core development): [#node-dev on chat.freenode.net][] <ide> <ide> keys: <ide> <ide> [Website]: https://nodejs.org/en/ <ide> [Contributing to the project]: CONTRIBUTING.md <add>[Node.js Help]: https://github.com/nodejs/help <ide> [Node.js Moderation Policy]: https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md <ide> [#node.js on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4 <ide> [#node-dev on chat.freenode.net]: https://webchat.freenode.net?channels=node-dev&uio=d4
1
Text
Text
add an alternative way to control structures
39a9eec9e727214c0e5bfb6346685c10204e3a1c
<ide><path>client/src/pages/guide/english/php/if-else-statement/index.md <ide> For instance: <ide> <ide> Another important option to consider when using short If/Else statements is the ternary operator. <ide> <add>Also there is an alternative syntax for control structures <add>~~~~ <add> if (condition1): <add> statement1; <add> endif; <add> else <add> statement5; <add>~~~~ <add>For more information check out the following link: <add><a href='http://php.net/manual/en/control-structures.alternative-syntax.php' target='_blank' rel='nofollow'>PHP Alternative syntax for control structures</a> <add> <ide> For more information please check out the following link: <ide> [PHP: if](http://php.net/manual/en/control-structures.if.php)
1
PHP
PHP
update workcommand.php
e4108ee1ae35e76fd6dd896c67e4768a1f0e5c63
<ide><path>src/Illuminate/Queue/Console/WorkCommand.php <ide> class WorkCommand extends Command <ide> protected $worker; <ide> <ide> /** <del> * Create a new queue listen command. <add> * Create a new queue work command. <ide> * <ide> * @param \Illuminate\Queue\Worker $worker <ide> * @return void
1
Go
Go
enable add-host for buildkit
d46fa93cb637e7de964769717f3b5770f6732bee
<ide><path>builder/builder-next/builder.go <ide> package buildkit <ide> import ( <ide> "context" <ide> "io" <add> "net" <ide> "strings" <ide> "sync" <ide> "time" <ide> func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder. <ide> return nil, errors.Errorf("network mode %q not supported by buildkit", opt.Options.NetworkMode) <ide> } <ide> <add> extraHosts, err := toBuildkitExtraHosts(opt.Options.ExtraHosts) <add> if err != nil { <add> return nil, err <add> } <add> frontendAttrs["add-hosts"] = extraHosts <add> <ide> exporterAttrs := map[string]string{} <ide> <ide> if len(opt.Options.Tags) > 0 { <ide> func (j *buildJob) SetUpload(ctx context.Context, rc io.ReadCloser) error { <ide> return fn(rc) <ide> } <ide> } <add> <add>// toBuildkitExtraHosts converts hosts from docker key:value format to buildkit's csv format <add>func toBuildkitExtraHosts(inp []string) (string, error) { <add> if len(inp) == 0 { <add> return "", nil <add> } <add> hosts := make([]string, 0, len(inp)) <add> for _, h := range inp { <add> parts := strings.Split(h, ":") <add> if len(parts) != 2 || parts[0] == "" || net.ParseIP(parts[1]) == nil { <add> return "", errors.Errorf("invalid host %s", h) <add> } <add> hosts = append(hosts, parts[0]+"="+parts[1]) <add> } <add> return strings.Join(hosts, ","), nil <add>}
1
Python
Python
enable evaluation under distribution strategy
90d1a0bbbca309628e9e8ddc285ca1bf33913eff
<ide><path>research/object_detection/inputs.py <ide> def _eval_input_fn(params=None): <ide> <ide> <ide> def eval_input(eval_config, eval_input_config, model_config, <del> model=None, params=None): <add> model=None, params=None, input_context=None): <ide> """Returns `features` and `labels` tensor dictionaries for evaluation. <ide> <ide> Args: <ide> def eval_input(eval_config, eval_input_config, model_config, <ide> model: A pre-constructed Detection Model. <ide> If None, one will be created from the config. <ide> params: Parameter dictionary passed from the estimator. <add> input_context: optional, A tf.distribute.InputContext object used to <add> shard filenames and compute per-replica batch_size when this function <add> is being called per-replica. <ide> <ide> Returns: <ide> A tf.data.Dataset that holds (features, labels) tuple. <ide> def transform_and_pad_input_data_fn(tensor_dict): <ide> eval_input_config, <ide> batch_size=params['batch_size'] if params else eval_config.batch_size, <ide> transform_input_data_fn=transform_and_pad_input_data_fn, <add> input_context=input_context, <ide> reduce_to_frame_fn=reduce_to_frame_fn) <ide> return dataset <ide> <ide><path>research/object_detection/metrics/coco_evaluation.py <ide> def add_single_ground_truth_image_info(self, <ide> numpy array of keypoint visibilities with shape [num_gt_boxes, <ide> num_keypoints]. Integer is treated as an enum with 0=not labeled, <ide> 1=labeled but not visible and 2=labeled and visible. <del> InputDataFields.groundtruth_labeled_classes (optional): a dictionary of <del> image_id to groundtruth_labeled_class, where groundtruth_labeled_class <del> is a 1-indexed integer numpy array indicating which classes have been <del> annotated over the image. <add> InputDataFields.groundtruth_labeled_classes (optional): a tensor of <add> shape [num_classes + 1] containing the multi-hot tensor indicating the <add> classes that each image is labeled for. Note that the classes labels <add> are 1-indexed. <ide> """ <ide> if image_id in self._image_ids: <ide> tf.logging.warning('Ignoring ground truth with image id %s since it was ' <ide> def add_single_ground_truth_image_info(self, <ide> <ide> self._annotation_id += groundtruth_dict[standard_fields.InputDataFields. <ide> groundtruth_boxes].shape[0] <del> self._groundtruth_labeled_classes[image_id] = groundtruth_dict.get( <del> standard_fields.InputDataFields.groundtruth_labeled_classes) <add> if (standard_fields.InputDataFields.groundtruth_labeled_classes <add> ) in groundtruth_dict: <add> labeled_classes = groundtruth_dict[ <add> standard_fields.InputDataFields.groundtruth_labeled_classes] <add> if labeled_classes.shape != (len(self._category_id_set) + 1,): <add> raise ValueError('Invalid shape for groundtruth labeled classes: {}, ' <add> 'num_categories_including_background: {}'.format( <add> labeled_classes, <add> len(self._category_id_set) + 1)) <add> self._groundtruth_labeled_classes[image_id] = np.flatnonzero( <add> groundtruth_dict[standard_fields.InputDataFields <add> .groundtruth_labeled_classes] == 1).tolist() <add> <ide> # Boolean to indicate whether a detection has been added for this image. <ide> self._image_ids[image_id] = False <ide> <ide> def update_op(image_id_batched, groundtruth_boxes_batched, <ide> # detection_classes. This assumes that all predictions will be kept to <ide> # compute eval metrics. <ide> if groundtruth_labeled_classes is None: <del> groundtruth_labeled_classes = detection_classes <add> groundtruth_labeled_classes = tf.reduce_max( <add> tf.one_hot( <add> tf.cast(detection_classes, tf.int32), <add> len(self._category_id_set) + 1), <add> axis=-2) <ide> <ide> if not image_id.shape.as_list(): <ide> # Apply a batch dimension to all tensors. <ide><path>research/object_detection/metrics/coco_evaluation_test.py <ide> def testGetMAPWithSkipUnmatchedPredictions(self): <ide> np.array([1]), <ide> # Only class 1 is exhaustively labeled for image1. <ide> groundtruth_labeled_classes: <del> np.array([1]), <add> np.array([0., 1., 0., 0.]), <ide> detection_boxes: <ide> np.array([[100., 100., 200., 200.], [100., 100., 200., <ide> 200.]]), <ide> def testGetMAPWithSkipUnmatchedPredictions(self): <ide> image_id: 'image2', <ide> groundtruth_boxes: np.array([[50., 50., 100., 100.]]), <ide> groundtruth_classes: np.array([3]), <del> groundtruth_labeled_classes: np.array([3]), <add> groundtruth_labeled_classes: np.array([0., 0., 0., 1.]), <ide> detection_boxes: np.array([[50., 50., 100., 100.]]), <ide> detection_scores: np.array([.7]), <ide> detection_classes: np.array([3]) <ide> def testGetMAPWithSkipUnmatchedPredictions(self): <ide> image_id: 'image3', <ide> groundtruth_boxes: np.array([[25., 25., 50., 50.]]), <ide> groundtruth_classes: np.array([2]), <del> groundtruth_labeled_classes: np.array([2]), <add> groundtruth_labeled_classes: np.array([0., 0., 1., 0.]), <ide> detection_boxes: np.array([[25., 25., 50., 50.]]), <ide> detection_scores: np.array([.9]), <ide> detection_classes: np.array([2]) <ide><path>research/object_detection/model_lib.py <ide> def _prepare_groundtruth_for_eval(detection_model, class_agnostic, <ide> <ide> if detection_model.groundtruth_has_field( <ide> input_data_fields.groundtruth_labeled_classes): <del> labeled_classes_list = detection_model.groundtruth_lists( <del> input_data_fields.groundtruth_labeled_classes) <del> labeled_classes = [ <del> tf.where(x)[:, 0] + label_id_offset for x in labeled_classes_list <del> ] <del> if len(labeled_classes) > 1: <del> num_classes = labeled_classes_list[0].shape[0] <del> padded_labeled_classes = [] <del> for x in labeled_classes: <del> padding = num_classes - tf.shape(x)[0] <del> padded_labeled_classes.append(tf.pad(x, [[0, padding]])) <del> groundtruth[input_data_fields.groundtruth_labeled_classes] = tf.stack( <del> padded_labeled_classes) <del> else: <del> groundtruth[input_data_fields.groundtruth_labeled_classes] = tf.stack( <del> labeled_classes) <add> groundtruth[input_data_fields.groundtruth_labeled_classes] = tf.pad( <add> tf.stack( <add> detection_model.groundtruth_lists( <add> input_data_fields.groundtruth_labeled_classes)), <add> label_id_offset_paddings) <ide> <ide> groundtruth[input_data_fields.num_groundtruth_boxes] = ( <ide> tf.tile([max_number_of_boxes], multiples=[groundtruth_boxes_shape[0]])) <ide> def create_estimator_and_inputs(run_config, <ide> train_config=train_config, <ide> train_input_config=train_input_config, <ide> model_config=model_config) <del> eval_input_fns = [ <del> create_eval_input_fn( <del> eval_config=eval_config, <del> eval_input_config=eval_input_config, <del> model_config=model_config) for eval_input_config in eval_input_configs <del> ] <add> eval_input_fns = [] <add> for eval_input_config in eval_input_configs: <add> eval_input_fns.append( <add> create_eval_input_fn( <add> eval_config=eval_config, <add> eval_input_config=eval_input_config, <add> model_config=model_config)) <add> <ide> eval_input_names = [ <ide> eval_input_config.name for eval_input_config in eval_input_configs <ide> ] <ide><path>research/object_detection/model_lib_tf2_test.py <ide> def test_train_loop_then_eval_loop(self): <ide> config_kwarg_overrides = _get_config_kwarg_overrides() <ide> <ide> train_steps = 2 <del> strategy = tf2.distribute.OneDeviceStrategy(device='/cpu:0') <add> strategy = tf2.distribute.MirroredStrategy(['/cpu:0', '/cpu:1']) <ide> with strategy.scope(): <ide> model_lib_v2.train_loop( <ide> new_pipeline_config_path, <ide><path>research/object_detection/model_lib_v2.py <ide> from object_detection.utils import ops <ide> from object_detection.utils import visualization_utils as vutils <ide> <del># pylint: disable=g-import-not-at-top <del>try: <del> from tensorflow.contrib import tpu as contrib_tpu <del>except ImportError: <del> # TF 2.0 doesn't ship with contrib. <del> pass <del># pylint: enable=g-import-not-at-top <ide> <ide> MODEL_BUILD_UTIL_MAP = model_lib.MODEL_BUILD_UTIL_MAP <ide> <ide> def _dist_train_step(data_iterator): <ide> clean_temporary_directories(strategy, summary_writer_filepath) <ide> <ide> <add>def prepare_eval_dict(detections, groundtruth, features): <add> """Prepares eval dictionary containing detections and groundtruth. <add> <add> Takes in `detections` from the model, `groundtruth` and `features` returned <add> from the eval tf.data.dataset and creates a dictionary of tensors suitable <add> for detection eval modules. <add> <add> Args: <add> detections: A dictionary of tensors returned by `model.postprocess`. <add> groundtruth: `inputs.eval_input` returns an eval dataset of (features, <add> labels) tuple. `groundtruth` must be set to `labels`. <add> Please note that: <add> * fields.InputDataFields.groundtruth_classes must be 0-indexed and <add> in its 1-hot representation. <add> * fields.InputDataFields.groundtruth_verified_neg_classes must be <add> 0-indexed and in its multi-hot repesentation. <add> * fields.InputDataFields.groundtruth_not_exhaustive_classes must be <add> 0-indexed and in its multi-hot repesentation. <add> * fields.InputDataFields.groundtruth_labeled_classes must be <add> 0-indexed and in its multi-hot repesentation. <add> features: `inputs.eval_input` returns an eval dataset of (features, labels) <add> tuple. This argument must be set to a dictionary containing the following <add> keys and their corresponding values from `features` -- <add> * fields.InputDataFields.image <add> * fields.InputDataFields.original_image <add> * fields.InputDataFields.original_image_spatial_shape <add> * fields.InputDataFields.true_image_shape <add> * inputs.HASH_KEY <add> <add> Returns: <add> eval_dict: A dictionary of tensors to pass to eval module. <add> class_agnostic: Whether to evaluate detection in class agnostic mode. <add> """ <add> <add> groundtruth_boxes = groundtruth[fields.InputDataFields.groundtruth_boxes] <add> groundtruth_boxes_shape = tf.shape(groundtruth_boxes) <add> # For class-agnostic models, groundtruth one-hot encodings collapse to all <add> # ones. <add> class_agnostic = ( <add> fields.DetectionResultFields.detection_classes not in detections) <add> if class_agnostic: <add> groundtruth_classes_one_hot = tf.ones( <add> [groundtruth_boxes_shape[0], groundtruth_boxes_shape[1], 1]) <add> else: <add> groundtruth_classes_one_hot = groundtruth[ <add> fields.InputDataFields.groundtruth_classes] <add> label_id_offset = 1 # Applying label id offset (b/63711816) <add> groundtruth_classes = ( <add> tf.argmax(groundtruth_classes_one_hot, axis=2) + label_id_offset) <add> groundtruth[fields.InputDataFields.groundtruth_classes] = groundtruth_classes <add> <add> label_id_offset_paddings = tf.constant([[0, 0], [1, 0]]) <add> if fields.InputDataFields.groundtruth_verified_neg_classes in groundtruth: <add> groundtruth[ <add> fields.InputDataFields.groundtruth_verified_neg_classes] = tf.pad( <add> groundtruth[ <add> fields.InputDataFields.groundtruth_verified_neg_classes], <add> label_id_offset_paddings) <add> if fields.InputDataFields.groundtruth_not_exhaustive_classes in groundtruth: <add> groundtruth[ <add> fields.InputDataFields.groundtruth_not_exhaustive_classes] = tf.pad( <add> groundtruth[ <add> fields.InputDataFields.groundtruth_not_exhaustive_classes], <add> label_id_offset_paddings) <add> if fields.InputDataFields.groundtruth_labeled_classes in groundtruth: <add> groundtruth[fields.InputDataFields.groundtruth_labeled_classes] = tf.pad( <add> groundtruth[fields.InputDataFields.groundtruth_labeled_classes], <add> label_id_offset_paddings) <add> <add> use_original_images = fields.InputDataFields.original_image in features <add> if use_original_images: <add> eval_images = features[fields.InputDataFields.original_image] <add> true_image_shapes = features[fields.InputDataFields.true_image_shape][:, :3] <add> original_image_spatial_shapes = features[ <add> fields.InputDataFields.original_image_spatial_shape] <add> else: <add> eval_images = features[fields.InputDataFields.image] <add> true_image_shapes = None <add> original_image_spatial_shapes = None <add> <add> eval_dict = eval_util.result_dict_for_batched_example( <add> eval_images, <add> features[inputs.HASH_KEY], <add> detections, <add> groundtruth, <add> class_agnostic=class_agnostic, <add> scale_to_absolute=True, <add> original_image_spatial_shapes=original_image_spatial_shapes, <add> true_image_shapes=true_image_shapes) <add> <add> return eval_dict, class_agnostic <add> <add> <add>def concat_replica_results(tensor_dict): <add> new_tensor_dict = {} <add> for key, values in tensor_dict.items(): <add> new_tensor_dict[key] = tf.concat(values, axis=0) <add> return new_tensor_dict <add> <add> <ide> def eager_eval_loop( <ide> detection_model, <ide> configs, <ide> def eager_eval_loop( <ide> Returns: <ide> A dict of evaluation metrics representing the results of this evaluation. <ide> """ <add> del postprocess_on_cpu <ide> train_config = configs['train_config'] <ide> eval_input_config = configs['eval_input_config'] <ide> eval_config = configs['eval_config'] <ide> def compute_eval_dict(features, labels): <ide> unpad_groundtruth_tensors = (boxes_shape[1] is not None <ide> and not use_tpu <ide> and batch_size == 1) <add> groundtruth_dict = labels <ide> labels = model_lib.unstack_batch( <ide> labels, unpad_groundtruth_tensors=unpad_groundtruth_tensors) <ide> <ide> losses_dict, prediction_dict = _compute_losses_and_predictions_dicts( <ide> detection_model, features, labels, add_regularization_loss) <del> <del> def postprocess_wrapper(args): <del> return detection_model.postprocess(args[0], args[1]) <del> <del> # TODO(kaftan): Depending on how postprocessing will work for TPUS w/ <del> ## TPUStrategy, may be good to move wrapping to a utility method <del> if use_tpu and postprocess_on_cpu: <del> detections = contrib_tpu.outside_compilation( <del> postprocess_wrapper, <del> (prediction_dict, features[fields.InputDataFields.true_image_shape])) <del> else: <del> detections = postprocess_wrapper( <del> (prediction_dict, features[fields.InputDataFields.true_image_shape])) <del> <del> class_agnostic = ( <del> fields.DetectionResultFields.detection_classes not in detections) <del> # TODO(kaftan) (or anyone): move `_prepare_groundtruth_for_eval to eval_util <del> ## and call this from there. <del> groundtruth = model_lib._prepare_groundtruth_for_eval( # pylint: disable=protected-access <del> detection_model, class_agnostic, eval_input_config.max_number_of_boxes) <del> use_original_images = fields.InputDataFields.original_image in features <del> if use_original_images: <del> eval_images = features[fields.InputDataFields.original_image] <del> true_image_shapes = tf.slice( <del> features[fields.InputDataFields.true_image_shape], [0, 0], [-1, 3]) <del> original_image_spatial_shapes = features[ <del> fields.InputDataFields.original_image_spatial_shape] <del> else: <del> eval_images = features[fields.InputDataFields.image] <del> true_image_shapes = None <del> original_image_spatial_shapes = None <del> <del> keys = features[inputs.HASH_KEY] <del> if eval_input_config.include_source_id: <del> keys = features[fields.InputDataFields.source_id] <del> eval_dict = eval_util.result_dict_for_batched_example( <del> eval_images, <del> keys, <del> detections, <del> groundtruth, <del> class_agnostic=class_agnostic, <del> scale_to_absolute=True, <del> original_image_spatial_shapes=original_image_spatial_shapes, <del> true_image_shapes=true_image_shapes) <del> <del> return eval_dict, losses_dict, class_agnostic <add> prediction_dict = detection_model.postprocess( <add> prediction_dict, features[fields.InputDataFields.true_image_shape]) <add> eval_features = { <add> fields.InputDataFields.image: <add> features[fields.InputDataFields.image], <add> fields.InputDataFields.original_image: <add> features[fields.InputDataFields.original_image], <add> fields.InputDataFields.original_image_spatial_shape: <add> features[fields.InputDataFields.original_image_spatial_shape], <add> fields.InputDataFields.true_image_shape: <add> features[fields.InputDataFields.true_image_shape], <add> inputs.HASH_KEY: features[inputs.HASH_KEY], <add> } <add> return losses_dict, prediction_dict, groundtruth_dict, eval_features <ide> <ide> agnostic_categories = label_map_util.create_class_agnostic_category_index() <ide> per_class_categories = label_map_util.create_category_index_from_labelmap( <ide> eval_input_config.label_map_path) <ide> keypoint_edges = [ <ide> (kp.start, kp.end) for kp in eval_config.keypoint_edge] <ide> <del> for i, (features, labels) in enumerate(eval_dataset): <del> eval_dict, losses_dict, class_agnostic = compute_eval_dict(features, labels) <add> strategy = tf.compat.v2.distribute.get_strategy() <ide> <add> for i, (features, labels) in enumerate(eval_dataset): <add> try: <add> (losses_dict, prediction_dict, groundtruth_dict, <add> eval_features) = strategy.run( <add> compute_eval_dict, args=(features, labels)) <add> except: # pylint:disable=bare-except <add> tf.logging.info('A replica probably exhausted all examples. Skipping ' <add> 'pending examples on other replicas.') <add> break <add> (local_prediction_dict, local_groundtruth_dict, <add> local_eval_features) = tf.nest.map_structure( <add> strategy.experimental_local_results, <add> [prediction_dict, groundtruth_dict, eval_features]) <add> local_prediction_dict = concat_replica_results(local_prediction_dict) <add> local_groundtruth_dict = concat_replica_results(local_groundtruth_dict) <add> local_eval_features = concat_replica_results(local_eval_features) <add> <add> eval_dict, class_agnostic = prepare_eval_dict(local_prediction_dict, <add> local_groundtruth_dict, <add> local_eval_features) <add> for loss_key, loss_tensor in iter(losses_dict.items()): <add> losses_dict[loss_key] = strategy.reduce(tf.distribute.ReduceOp.MEAN, <add> loss_tensor, None) <ide> if class_agnostic: <ide> category_index = agnostic_categories <ide> else: <ide> def postprocess_wrapper(args): <ide> <ide> for loss_key, loss_tensor in iter(losses_dict.items()): <ide> if loss_key not in loss_metrics: <del> loss_metrics[loss_key] = tf.keras.metrics.Mean() <del> # Skip the loss with value equal or lower than 0.0 when calculating the <del> # average loss since they don't usually reflect the normal loss values <del> # causing spurious average loss value. <del> if loss_tensor <= 0.0: <del> continue <del> loss_metrics[loss_key].update_state(loss_tensor) <add> loss_metrics[loss_key] = [] <add> loss_metrics[loss_key].append(loss_tensor) <ide> <ide> eval_metrics = {} <ide> <ide> for evaluator in evaluators: <ide> eval_metrics.update(evaluator.evaluate()) <ide> for loss_key in loss_metrics: <del> eval_metrics[loss_key] = loss_metrics[loss_key].result() <add> eval_metrics[loss_key] = tf.reduce_mean(loss_metrics[loss_key]) <ide> <ide> eval_metrics = {str(k): v for k, v in eval_metrics.items()} <ide> tf.logging.info('Eval metrics at step %d', global_step) <ide> def eval_continuously( <ide> checkpoint_dir=None, <ide> wait_interval=180, <ide> timeout=3600, <del> eval_index=None, <add> eval_index=0, <ide> **kwargs): <ide> """Run continuous evaluation of a detection model eagerly. <ide> <ide> def eval_continuously( <ide> new checkpoint. <ide> timeout: The maximum number of seconds to wait for a checkpoint. Execution <ide> will terminate if no new checkpoints are found after these many seconds. <del> eval_index: int, optional If give, only evaluate the dataset at the given <del> index. <add> eval_index: int, If given, only evaluate the dataset at the given <add> index. By default, evaluates dataset at 0'th index. <ide> <ide> **kwargs: Additional keyword arguments for configuration override. <ide> """ <ide> def eval_continuously( <ide> if kwargs['use_bfloat16']: <ide> tf.compat.v2.keras.mixed_precision.experimental.set_policy('mixed_bfloat16') <ide> <del> detection_model = MODEL_BUILD_UTIL_MAP['detection_model_fn_base']( <del> model_config=model_config, is_training=True) <del> <del> # Create the inputs. <del> eval_inputs = [] <del> for eval_input_config in eval_input_configs: <del> next_eval_input = inputs.eval_input( <del> eval_config=eval_config, <del> eval_input_config=eval_input_config, <del> model_config=model_config, <del> model=detection_model) <del> eval_inputs.append((eval_input_config.name, next_eval_input)) <add> eval_input_config = eval_input_configs[eval_index] <add> strategy = tf.compat.v2.distribute.get_strategy() <add> with strategy.scope(): <add> detection_model = MODEL_BUILD_UTIL_MAP['detection_model_fn_base']( <add> model_config=model_config, is_training=True) <ide> <del> if eval_index is not None: <del> eval_inputs = [eval_inputs[eval_index]] <add> eval_input = strategy.experimental_distribute_dataset( <add> inputs.eval_input( <add> eval_config=eval_config, <add> eval_input_config=eval_input_config, <add> model_config=model_config, <add> model=detection_model)) <ide> <ide> global_step = tf.compat.v2.Variable( <ide> 0, trainable=False, dtype=tf.compat.v2.dtypes.int64) <ide> def eval_continuously( <ide> <ide> ckpt.restore(latest_checkpoint).expect_partial() <ide> <del> for eval_name, eval_input in eval_inputs: <del> summary_writer = tf.compat.v2.summary.create_file_writer( <del> os.path.join(model_dir, 'eval', eval_name)) <del> with summary_writer.as_default(): <del> eager_eval_loop( <del> detection_model, <del> configs, <del> eval_input, <del> use_tpu=use_tpu, <del> postprocess_on_cpu=postprocess_on_cpu, <del> global_step=global_step) <add> summary_writer = tf.compat.v2.summary.create_file_writer( <add> os.path.join(model_dir, 'eval', eval_input_config.name)) <add> with summary_writer.as_default(): <add> eager_eval_loop( <add> detection_model, <add> configs, <add> eval_input, <add> use_tpu=use_tpu, <add> postprocess_on_cpu=postprocess_on_cpu, <add> global_step=global_step)
6
PHP
PHP
fix many docblocks
7880ba75248c849e3137ae9832ec2220ca62d6c6
<ide><path>src/Illuminate/Auth/DatabaseUserProvider.php <ide> class DatabaseUserProvider implements UserProvider <ide> /** <ide> * Create a new database user provider. <ide> * <del> * @param \Illuminate\Database\ConnectionInterface $conn <add> * @param \Illuminate\Database\ConnectionInterface $connection <ide> * @param \Illuminate\Contracts\Hashing\Hasher $hasher <ide> * @param string $table <ide> * @return void <ide><path>src/Illuminate/Collections/Traits/EnumeratesValues.php <ide> public function whereNotNull($key = null) <ide> * <ide> * @param string $key <ide> * @param mixed $value <del> * @param bool $strict <ide> * @return static <ide> */ <ide> public function whereStrict($key, $value) <ide><path>src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php <ide> public function orWhereMorphedTo($relation, $model) <ide> * Add a "belongs to" relationship where clause to the query. <ide> * <ide> * @param \Illuminate\Database\Eloquent\Model $related <del> * @param string $relationship <add> * @param string|null $relationshipName <ide> * @param string $boolean <ide> * @return $this <ide> * <del> * @throws \RuntimeException <add> * @throws \Illuminate\Database\Eloquent\RelationNotFoundException <ide> */ <ide> public function whereBelongsTo($related, $relationshipName = null, $boolean = 'and') <ide> { <ide> public function whereBelongsTo($related, $relationshipName = null, $boolean = 'a <ide> * Add an "BelongsTo" relationship with an "or where" clause to the query. <ide> * <ide> * @param \Illuminate\Database\Eloquent\Model $related <del> * @param string $relationship <add> * @param string|null $relationshipName <ide> * @return $this <ide> * <ide> * @throws \RuntimeException <ide><path>src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php <ide> abstract public function getOneOfManySubQuerySelectColumns(); <ide> /** <ide> * Add join query constraints for one of many relationships. <ide> * <del> * @param \Illuminate\Database\Eloquent\JoinClause $join <add> * @param \Illuminate\Database\Query\JoinClause $join <ide> * @return void <ide> */ <ide> abstract public function addOneOfManyJoinSubQueryConstraints(JoinClause $join); <ide> public function ofMany($column = 'id', $aggregate = 'MAX', $relation = null) <ide> * Indicate that the relation is the latest single result of a larger one-to-many relationship. <ide> * <ide> * @param string|array|null $column <del> * @param string|Closure|null $aggregate <ide> * @param string|null $relation <ide> * @return $this <ide> */ <ide> public function latestOfMany($column = 'id', $relation = null) <ide> * Indicate that the relation is the oldest single result of a larger one-to-many relationship. <ide> * <ide> * @param string|array|null $column <del> * @param string|Closure|null $aggregate <ide> * @param string|null $relation <ide> * @return $this <ide> */ <ide> protected function addOneOfManyJoinSubQuery(Builder $parent, Builder $subQuery, <ide> /** <ide> * Merge the relationship query joins to the given query builder. <ide> * <del> * @param \Illuminate\Database\Eloquent\Builder $builder <add> * @param \Illuminate\Database\Eloquent\Builder $query <ide> * @return void <ide> */ <ide> protected function mergeOneOfManyJoinsTo(Builder $query) <ide><path>src/Illuminate/Database/Eloquent/Relations/HasOne.php <ide> public function getOneOfManySubQuerySelectColumns() <ide> /** <ide> * Add join query constraints for one of many relationships. <ide> * <del> * @param \Illuminate\Database\Eloquent\JoinClause $join <add> * @param \Illuminate\Database\Query\JoinClause $join <ide> * @return void <ide> */ <ide> public function addOneOfManyJoinSubQueryConstraints(JoinClause $join) <ide><path>src/Illuminate/Database/Eloquent/Relations/MorphOne.php <ide> public function getOneOfManySubQuerySelectColumns() <ide> /** <ide> * Add join query constraints for one of many relationships. <ide> * <del> * @param \Illuminate\Database\Eloquent\JoinClause $join <add> * @param \Illuminate\Database\Query\JoinClause $join <ide> * @return void <ide> */ <ide> public function addOneOfManyJoinSubQueryConstraints(JoinClause $join) <ide><path>src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php <ide> public function compileGetAllTables($searchPath) <ide> /** <ide> * Compile the SQL needed to retrieve all view names. <ide> * <del> * @param string|array $schema <add> * @param string|array $searchPath <ide> * @return string <ide> */ <ide> public function compileGetAllViews($searchPath) <ide><path>src/Illuminate/Filesystem/FilesystemAdapter.php <ide> public function get($path) <ide> * <ide> * @param string $path <ide> * @param string|null $name <del> * @param array|null $headers <add> * @param array $headers <ide> * @param string|null $disposition <ide> * @return \Symfony\Component\HttpFoundation\StreamedResponse <ide> */ <ide> public function response($path, $name = null, array $headers = [], $disposition <ide> * <ide> * @param string $path <ide> * @param string|null $name <del> * @param array|null $headers <ide> * @return \Symfony\Component\HttpFoundation\StreamedResponse <ide> */ <ide> public function download($path, $name = null, array $headers = []) <ide><path>src/Illuminate/Foundation/Console/RouteListCommand.php <ide> public static function getTerminalWidth() <ide> /** <ide> * Set a callback that should be used when resolving the terminal width. <ide> * <del> * @param \Closure|null $callback <add> * @param \Closure|null $resolver <ide> * @return void <ide> */ <ide> public static function resolveTerminalWidthUsing($resolver) <ide><path>src/Illuminate/Http/Request.php <ide> public function fullUrlWithQuery(array $query) <ide> /** <ide> * Get the full URL for the request without the given query string parameters. <ide> * <del> * @param array|string $query <add> * @param array|string $keys <ide> * @return string <ide> */ <ide> public function fullUrlWithoutQuery($keys) <ide><path>src/Illuminate/Queue/Middleware/ThrottlesExceptions.php <ide> class ThrottlesExceptions <ide> * <ide> * @param int $maxAttempts <ide> * @param int $decayMinutes <del> * @param string $key <ide> * @return void <ide> */ <ide> public function __construct($maxAttempts = 10, $decayMinutes = 10) <ide><path>src/Illuminate/Routing/Console/ControllerMakeCommand.php <ide> protected function buildFormRequestReplacements(array $replace, $modelClass) <ide> /** <ide> * Generate the form requests for the given model and classes. <ide> * <del> * @param string $modelName <add> * @param string $modelClass <ide> * @param string $storeRequestClass <ide> * @param string $updateRequestClass <ide> * @return array <ide><path>src/Illuminate/Testing/ParallelTesting.php <ide> public function __construct(Container $container) <ide> /** <ide> * Set a callback that should be used when resolving options. <ide> * <del> * @param \Closure|null $callback <add> * @param \Closure|null $resolver <ide> * @return void <ide> */ <ide> public function resolveOptionsUsing($resolver) <ide> public function resolveOptionsUsing($resolver) <ide> /** <ide> * Set a callback that should be used when resolving the unique process token. <ide> * <del> * @param \Closure|null $callback <add> * @param \Closure|null $resolver <ide> * @return void <ide> */ <ide> public function resolveTokenUsing($resolver) <ide><path>src/Illuminate/Validation/Concerns/ValidatesAttributes.php <ide> public function validateRequiredIf($attribute, $value, $parameters) <ide> * <ide> * @param string $attribute <ide> * @param mixed $value <del> * @param mixed $parameters <ide> * @return bool <ide> */ <ide> public function validateProhibited($attribute, $value) <ide><path>src/Illuminate/Validation/Validator.php <ide> protected function getPrimaryAttribute($attribute) <ide> * Replace each field parameter which has an escaped dot with the dot placeholder. <ide> * <ide> * @param array $parameters <del> * @param array $keys <ide> * @return array <ide> */ <ide> protected function replaceDotInParameters(array $parameters)
15
Text
Text
improve documentation for the vm module
5e1e460ac1d84b4b23a9c3a0280549b29af6ed1f
<ide><path>doc/api/vm.md <ide> <!--name=vm--> <ide> <ide> The `vm` module provides APIs for compiling and running code within V8 Virtual <del>Machine contexts. It can be accessed using: <add>Machine contexts. <add> <add>JavaScript code can be compiled and run immediately or <add>compiled, saved, and run later. <add> <add>A common use case is to run the code in a sandboxed environment. <add>The sandboxed code uses a different V8 Context, meaning that <add>it has a different global object than the rest of the code. <add> <add>One can provide the context by ["contextifying"][contextified] a sandbox <add>object. The sandboxed code treats any property on the sandbox like a <add>global variable. Any changes on global variables caused by the sandboxed <add>code are reflected in the sandbox object. <ide> <ide> ```js <ide> const vm = require('vm'); <del>``` <ide> <del>JavaScript code can be compiled and run immediately or compiled, saved, and run <del>later. <add>const x = 1; <add> <add>const sandbox = { x: 2 }; <add>vm.createContext(sandbox); // Contextify the sandbox. <add> <add>const code = 'x += 40; var y = 17;'; <add>// x and y are global variables in the sandboxed environment. <add>// Initially, x has the value 2 because that is the value of sandbox.x. <add>vm.runInContext(code, sandbox); <add> <add>console.log(sandbox.x); // 42 <add>console.log(sandbox.y); // 17 <add> <add>console.log(x); // 1; y is not defined. <add>``` <ide> <ide> *Note*: The vm module is not a security mechanism. <ide> **Do not use it to run untrusted code**.
1
Ruby
Ruby
add documentation for thread#freeze
cb12e0408a88ca128da9c7a8a46ff4c75b0c4dd9
<ide><path>activesupport/lib/active_support/core_ext/thread.rb <ide> def thread_variable?(key) <ide> _locals.has_key?(key.to_sym) <ide> end <ide> <add> # Freezes the thread so that thread local variables cannot be set via <add> # Thread#thread_variable_set, nor can fiber local variables be set. <add> # <add> # me = Thread.current <add> # me.freeze <add> # me.thread_variable_set(:oliver, "a") #=> RuntimeError: can't modify frozen thread locals <add> # me[:oliver] = "a" #=> RuntimeError: can't modify frozen thread locals <ide> def freeze <ide> _locals.freeze <ide> super
1
Python
Python
add a couple of simple unit-tests for bincount
60e53321fbb0a5e3ae630100eff32aec939a4434
<ide><path>numpy/lib/tests/test_function_base.py <ide> from numpy.core import * <ide> from numpy import matrix, asmatrix <ide> <add>import numpy as np <add> <ide> class TestAny(TestCase): <ide> def test_basic(self): <ide> y1 = [0,0,1,0] <ide> def test_0d(self): <ide> assert y.ndim == 0 <ide> assert y == 0 <ide> <add>class TestBincount(TestCase): <add> def test_simple(self): <add> y = np.bincount(np.arange(4)) <add> assert_array_equal(y, np.ones(4)) <add> <add> def test_simple2(self): <add> y = np.bincount(np.array([1, 5, 2, 4, 1])) <add> assert_array_equal(y, np.array([0, 2, 1, 0, 1, 1])) <add> <add> def test_simple_weight(self): <add> x = np.arange(4) <add> w = np.array([0.2, 0.3, 0.5, 0.1]) <add> y = np.bincount(x, w) <add> assert_array_equal(y, w) <add> <add> def test_simple_weight2(self): <add> x = np.array([1, 2, 4, 5, 2]) <add> w = np.array([0.2, 0.3, 0.5, 0.1, 0.2]) <add> y = np.bincount(x, w) <add> assert_array_equal(y, np.array([0, 0.2, 0.5, 0, 0.5, 0.1])) <add> <ide> def compare_results(res,desired): <ide> for i in range(len(desired)): <ide> assert_array_equal(res[i],desired[i])
1
Ruby
Ruby
remove call to object_id
37886a04e7248338522cbbf1fe7d31abb5cc46b8
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb <ide> def cache_notification_info(sql, name, binds) <ide> binds: binds, <ide> type_casted_binds: -> { type_casted_binds(binds) }, <ide> name: name, <del> connection_id: object_id, <ide> cached: true <ide> } <ide> end
1
Ruby
Ruby
remove redundant chdir
a45bfc87865dcd4aac640cc46fe0ef35a2b55d9c
<ide><path>Library/Homebrew/download_strategy.rb <ide> def stage <ide> Dir.chdir @clone do <ide> if @spec and @ref <ide> ohai "Checking out #{@spec} #{@ref}" <del> Dir.chdir @clone do <del> safe_system 'hg', 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst <del> end <add> safe_system 'hg', 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst <ide> else <ide> safe_system 'hg', 'archive', '--subrepos', '-y', '-t', 'files', dst <ide> end
1
Python
Python
use new exception style
c95fa81cb25fbdb7af3c8cc39cc45e49eff66c98
<ide><path>rest_framework/serializers.py <ide> def restore_object(self, attrs, instance=None): <ide> <ide> try: <ide> instance.full_clean(exclude=self.get_validation_exclusions()) <del> except ValidationError, err: <add> except ValidationError as err: <ide> self._errors = err.message_dict <ide> return None <ide>
1
Go
Go
add content type to push
3870ebee6db450efcebac81b829694a047583442
<ide><path>registry.go <ide> func (graph *Graph) PushImage(imgOrig *Image, authConfig *auth.AuthConfig) error <ide> if err != nil { <ide> return err <ide> } <add> req.Header.Add("Content-type", "application/json") <ide> req.SetBasicAuth(authConfig.Username, authConfig.Password) <ide> res, err := client.Do(req) <ide> if err != nil || res.StatusCode != 200 {
1
Javascript
Javascript
correct param names in jsdoc comments
1d34f0fefdd9947f791f1810b99596977a26e0e8
<ide><path>lib/fs.js <ide> function realpathSync(p, options) { <ide> <ide> /** <ide> * Returns the resolved pathname. <del> * @param {string | Buffer | URL} p <add> * @param {string | Buffer | URL} path <ide> * @param {string | { encoding?: string; }} [options] <ide> * @returns {string | Buffer} <ide> */ <ide> function realpath(p, options, callback) { <ide> /** <ide> * Asynchronously computes the canonical pathname by <ide> * resolving `.`, `..` and symbolic links. <del> * @param {string | Buffer | URL} p <add> * @param {string | Buffer | URL} path <ide> * @param {string | { encoding?: string; }} [options] <ide> * @param {( <ide> * err?: Error,
1
Javascript
Javascript
remove unnecessary process.nexttick()"
ba0dbaa1930db93a9e988ce1a525c8b2054a2970
<ide><path>lib/net.js <ide> function lookupAndConnect(self, options) { <ide> // If host is an IP, skip performing a lookup <ide> var addressType = cares.isIP(host); <ide> if (addressType) { <del> internalConnect(self, host, port, addressType, localAddress, localPort); <add> nextTick(self[async_id_symbol], function() { <add> if (self.connecting) <add> internalConnect(self, host, port, addressType, localAddress, localPort); <add> }); <ide> return; <ide> } <ide> <ide><path>test/async-hooks/test-tcpwrap.js <ide> const server = net <ide> { port: server.address().port, host: server.address().address }, <ide> common.mustCall(onconnected)); <ide> const tcps = hooks.activitiesOfTypes('TCPWRAP'); <del> const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); <ide> assert.strictEqual( <ide> tcps.length, 2, <ide> '2 TCPWRAPs present when client is connecting'); <del> assert.strictEqual( <del> tcpconnects.length, 1, <del> '1 TCPCONNECTWRAP present when client is connecting'); <add> process.nextTick(() => { <add> const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); <add> assert.strictEqual( <add> tcpconnects.length, 1, <add> '1 TCPCONNECTWRAP present when client is connecting'); <add> }); <add> <ide> tcp2 = tcps[1]; <ide> assert.strictEqual(tcps.length, 2, <ide> '2 TCPWRAP present when client is connecting');
2
Javascript
Javascript
remove runtime experimental warning
ad8442f1357fb736f899eda73dad3f88ec58fbc6
<ide><path>lib/test.js <ide> const { ObjectAssign } = primordials; <ide> const { test, describe, it, before, after, beforeEach, afterEach } = require('internal/test_runner/harness'); <ide> const { run } = require('internal/test_runner/runner'); <del>const { emitExperimentalWarning } = require('internal/util'); <del> <del>emitExperimentalWarning('The test runner'); <ide> <ide> module.exports = test; <ide> ObjectAssign(module.exports, {
1
Python
Python
add tests for custom cluster policy
6fe020e105531dd5a7097d8875eac0f317045298
<ide><path>tests/test_local_settings.py <ide> import unittest <ide> from unittest.mock import MagicMock, call <ide> <add>from airflow.exceptions import AirflowClusterPolicyViolation <add> <ide> SETTINGS_FILE_POLICY = """ <ide> def test_policy(task_instance): <ide> task_instance.run_as_user = "myself" <ide> def pod_mutation_hook(pod): <ide> pod.namespace = 'airflow-tests' <ide> """ <ide> <add>SETTINGS_FILE_CUSTOM_POLICY = """ <add>from airflow.models.baseoperator import BaseOperator <add>from airflow.exceptions import AirflowClusterPolicyViolation <add> <add>def task_must_have_owners(task: BaseOperator): <add> if not task.owner or task.owner.lower() == "airflow": <add> raise AirflowClusterPolicyViolation( <add> f'''Task must have non-None non-'airflow' owner. <add> Current value: {task.owner}''' <add> ) <add>""" <add> <ide> <ide> class SettingsContext: <ide> def __init__(self, content: str, module_name: str): <ide> def test_pod_mutation_hook(self): <ide> settings.pod_mutation_hook(pod) <ide> <ide> assert pod.namespace == 'airflow-tests' <add> <add> def test_custom_policy(self): <add> with SettingsContext(SETTINGS_FILE_CUSTOM_POLICY, "airflow_local_settings"): <add> from airflow import settings <add> settings.import_local_settings() <add> <add> task_instance = MagicMock() <add> task_instance.owner = 'airflow' <add> with self.assertRaises(AirflowClusterPolicyViolation): <add> settings.task_must_have_owners(task_instance) # pylint: disable=no-member
1
Python
Python
add support for input tensors in inputlayer
ca467cc50ee49776140830e297dd52b3f26c8f76
<ide><path>keras/engine/topology.py <ide> class InputLayer(Layer): <ide> '''TODO: dosctring <ide> ''' <ide> def __init__(self, input_shape=None, batch_input_shape=None, <del> input_dtype=None, name=None): <add> input_dtype=None, input_tensor=None, name=None): <ide> self.input_spec = None <ide> self.supports_masking = False <ide> self.uses_learning_phase = False <ide> def __init__(self, input_shape=None, batch_input_shape=None, <ide> name = prefix + '_' + str(K.get_uid(prefix)) <ide> self.name = name <ide> <add> if input_shape and batch_input_shape: <add> raise ValueError('Only provide the input_shape OR ' <add> 'batch_input_shape argument to ' <add> 'InputLayer, not both at the same time.') <add> if input_tensor is not None: <add> if not input_shape and not batch_input_shape: <add> # attempt automatic input shape inference <add> try: <add> batch_input_shape = K.int_shape(input_tensor) <add> except: <add> raise ValueError('InputLayer was provided an input_tensor argument, ' <add> 'but its input shape cannot be automatically inferred. ' <add> 'You should pass an input_shape or batch_input_shape ' <add> 'argument.') <ide> if not batch_input_shape: <del> assert input_shape, 'An Input layer should be passed either a `batch_input_shape` or an `input_shape`.' <del> batch_input_shape = (None,) + tuple(input_shape) <add> if not input_shape: <add> raise ValueError('An Input layer should be passed either ' <add> 'a `batch_input_shape` or an `input_shape`.') <add> else: <add> batch_input_shape = (None,) + tuple(input_shape) <ide> else: <ide> batch_input_shape = tuple(batch_input_shape) <add> <ide> if not input_dtype: <del> input_dtype = K.floatx() <add> if input_tensor is None: <add> input_dtype = K.floatx() <add> else: <add> input_dtype = K.dtype(input_tensor) <ide> <ide> self.batch_input_shape = batch_input_shape <ide> self.input_dtype = input_dtype <ide> <del> input_tensor = K.placeholder(shape=batch_input_shape, <del> dtype=input_dtype, <del> name=self.name) <add> if input_tensor is None: <add> input_tensor = K.placeholder(shape=batch_input_shape, <add> dtype=input_dtype, <add> name=self.name) <add> else: <add> input_tensor._keras_shape = batch_input_shape <ide> # create an input node to add to self.outbound_node <ide> # and set output_tensors' _keras_history <ide> input_tensor._uses_learning_phase = False <ide> input_tensor._keras_history = (self, 0, 0) <del> shape = input_tensor._keras_shape <ide> Node(self, <ide> inbound_layers=[], <ide> node_indices=[], <ide> def __init__(self, input_shape=None, batch_input_shape=None, <ide> output_tensors=[input_tensor], <ide> input_masks=[None], <ide> output_masks=[None], <del> input_shapes=[shape], <del> output_shapes=[shape]) <add> input_shapes=[batch_input_shape], <add> output_shapes=[batch_input_shape]) <ide> <ide> def get_config(self): <ide> config = {'batch_input_shape': self.batch_input_shape, <ide> def get_config(self): <ide> <ide> <ide> def Input(shape=None, batch_shape=None, <del> name=None, dtype=K.floatx()): <add> name=None, dtype=K.floatx(), <add> tensor=None): <ide> '''`Input()` is used to instantiate a Keras tensor. <ide> A Keras tensor is a tensor object from the underlying backend <ide> (Theano or TensorFlow), which we augment with certain <ide> def Input(shape=None, batch_shape=None, <ide> model = Model(input=a, output=b) <ide> ``` <ide> ''' <del> if not batch_shape: <add> if not batch_shape and tensor is None: <ide> assert shape, ('Please provide to Input either a `shape`' + <ide> ' or a `batch_shape` argument. Note that ' + <ide> '`shape` does not include the batch ' <ide> 'dimension.') <ide> batch_shape = (None,) + tuple(shape) <ide> input_layer = InputLayer(batch_input_shape=batch_shape, <del> name=name, input_dtype=dtype) <add> name=name, input_dtype=dtype, <add> input_tensor=tensor) <ide> # return tensor including _keras_shape and _keras_history <ide> # note that in this case train_output and test_output are the same pointer. <ide> outputs = input_layer.inbound_nodes[0].output_tensors <ide><path>tests/keras/engine/test_topology.py <ide> import json <ide> import numpy as np <ide> <del>from keras.layers import Dense, Dropout <add>from keras.layers import Dense, Dropout, InputLayer <ide> from keras.engine import merge, Input, get_source_inputs <ide> from keras.models import Model <ide> from keras import backend as K <ide> def test_recursion(): <ide> # test merge <ide> o_tf = merge([j_tf, k_tf], mode='concat', concat_axis=1) <ide> <add> # test tensor input <add> x = tf.placeholder(shape=(None, 2), dtype=K.floatx()) <add> input_layer = InputLayer(input_tensor=x) <add> <add> x = Input(tensor=x) <add> y = Dense(2)(x) <add> <ide> <ide> def test_functional_guide(): <ide> # MNIST
2
Mixed
Python
remove duplicated branch in if/else-if statement
2b14997b68e2a737d9569926c3b13ee0870b4d76
<ide><path>.github/contributors/leicmi.md <add># spaCy contributor agreement <add> <add>This spaCy Contributor Agreement (**"SCA"**) is based on the <add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). <add>The SCA applies to any contribution that you make to any product or project <add>managed by us (the **"project"**), and sets out the intellectual property rights <add>you grant to us in the contributed materials. The term **"us"** shall mean <add>[ExplosionAI GmbH](https://explosion.ai/legal). The term <add>**"you"** shall mean the person or entity identified below. <add> <add>If you agree to be bound by these terms, fill in the information requested <add>below and include the filled-in version with your first pull request, under the <add>folder [`.github/contributors/`](/.github/contributors/). The name of the file <add>should be your GitHub username, with the extension `.md`. For example, the user <add>example_user would create the file `.github/contributors/example_user.md`. <add> <add>Read this agreement carefully before signing. These terms and conditions <add>constitute a binding legal agreement. <add> <add>## Contributor Agreement <add> <add>1. The term "contribution" or "contributed materials" means any source code, <add>object code, patch, tool, sample, graphic, specification, manual, <add>documentation, or any other material posted or submitted by you to the project. <add> <add>2. With respect to any worldwide copyrights, or copyright applications and <add>registrations, in your contribution: <add> <add> * you hereby assign to us joint ownership, and to the extent that such <add> assignment is or becomes invalid, ineffective or unenforceable, you hereby <add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, <add> royalty-free, unrestricted license to exercise all rights under those <add> copyrights. This includes, at our option, the right to sublicense these same <add> rights to third parties through multiple levels of sublicensees or other <add> licensing arrangements; <add> <add> * you agree that each of us can do all things in relation to your <add> contribution as if each of us were the sole owners, and if one of us makes <add> a derivative work of your contribution, the one who makes the derivative <add> work (or has it made will be the sole owner of that derivative work; <add> <add> * you agree that you will not assert any moral rights in your contribution <add> against us, our licensees or transferees; <add> <add> * you agree that we may register a copyright in your contribution and <add> exercise all ownership rights associated with it; and <add> <add> * you agree that neither of us has any duty to consult with, obtain the <add> consent of, pay or render an accounting to the other for any use or <add> distribution of your contribution. <add> <add>3. With respect to any patents you own, or that you can license without payment <add>to any third party, you hereby grant to us a perpetual, irrevocable, <add>non-exclusive, worldwide, no-charge, royalty-free license to: <add> <add> * make, have made, use, sell, offer to sell, import, and otherwise transfer <add> your contribution in whole or in part, alone or in combination with or <add> included in any product, work or materials arising out of the project to <add> which your contribution was submitted, and <add> <add> * at our option, to sublicense these same rights to third parties through <add> multiple levels of sublicensees or other licensing arrangements. <add> <add>4. Except as set out above, you keep all right, title, and interest in your <add>contribution. The rights that you grant to us under these terms are effective <add>on the date you first submitted a contribution to us, even if your submission <add>took place before the date you sign these terms. <add> <add>5. You covenant, represent, warrant and agree that: <add> <add> * Each contribution that you submit is and shall be an original work of <add> authorship and you can legally grant the rights set out in this SCA; <add> <add> * to the best of your knowledge, each contribution will not violate any <add> third party's copyrights, trademarks, patents, or other intellectual <add> property rights; and <add> <add> * each contribution shall be in compliance with U.S. export control laws and <add> other applicable export and import laws. You agree to notify us if you <add> become aware of any circumstance which would make any of the foregoing <add> representations inaccurate in any respect. We may publicly disclose your <add> participation in the project, including the fact that you have signed the SCA. <add> <add>6. This SCA is governed by the laws of the State of California and applicable <add>U.S. Federal law. Any choice of law rules will not apply. <add> <add>7. Please place an “x” on one of the applicable statement below. Please do NOT <add>mark both statements: <add> <add> * [x] I am signing on behalf of myself as an individual and no other person <add> or entity, including my employer, has or will have rights with respect to my <add> contributions. <add> <add> * [ ] I am signing on behalf of my employer or a legal entity and I have the <add> actual authority to contractually bind that entity. <add> <add>## Contributor Details <add> <add>| Field | Entry | <add>|------------------------------- | -------------------- | <add>| Name | Michael Leichtfried | <add>| Company name (if applicable) | | <add>| Title or role (if applicable) | | <add>| Date | 30.03.2020 | <add>| GitHub username | leicmi | <add>| Website (optional) | | <ide><path>spacy/lemmatizer.py <ide> def is_base_form(self, univ_pos, morphology=None): <ide> return True <ide> elif morphology.get("VerbForm") == "none": <ide> return True <del> elif morphology.get("VerbForm") == "inf": <del> return True <ide> elif morphology.get("Degree") == "pos": <ide> return True <ide> else:
2
Javascript
Javascript
fix typing of resolver options
b1132a91ab1b19ed20276b75b107c959b77efd1f
<ide><path>packager/react-packager/src/JSTransformer/index.js <ide> const workerFarm = require('worker-farm'); <ide> const debug = require('debug')('ReactNativePackager:JStransformer'); <ide> <ide> import type {Data as TransformData, Options as TransformOptions} from './worker/worker'; <add>import type {SourceMap} from '../lib/SourceMap'; <ide> <ide> // Avoid memory leaks caused in workers. This number seems to be a good enough number <ide> // to avoid any memory leak while not slowing down initial builds. <ide> class Transformer { <ide> minify: ( <ide> filename: string, <ide> code: string, <del> sourceMap: string, <del> ) => Promise<mixed>; <add> sourceMap: SourceMap, <add> ) => Promise<{code: string, map: SourceMap}>; <ide> <ide> constructor(options: Options) { <ide> const opts = this._opts = validateOpts(options); <ide><path>packager/react-packager/src/Resolver/index.js <ide> import type Module from '../node-haste/Module'; <ide> import type {SourceMap} from '../lib/SourceMap'; <ide> import type {Options as TransformOptions} from '../JSTransformer/worker/worker'; <ide> import type {Reporter} from '../lib/reporting'; <del> <del>const validateOpts = declareOpts({ <del> projectRoots: { <del> type: 'array', <del> required: true, <del> }, <del> blacklistRE: { <del> type: 'object', // typeof regex is object <del> }, <del> polyfillModuleNames: { <del> type: 'array', <del> default: [], <del> }, <del> moduleFormat: { <del> type: 'string', <del> default: 'haste', <del> }, <del> watch: { <del> type: 'boolean', <del> default: false, <del> }, <del> assetExts: { <del> type: 'array', <del> required: true, <del> }, <del> platforms: { <del> type: 'array', <del> required: true, <del> }, <del> cache: { <del> type: 'object', <del> required: true, <del> }, <del> transformCode: { <del> type: 'function', <del> }, <del> transformCacheKey: { <del> type: 'string', <del> }, <del> extraNodeModules: { <del> type: 'object', <del> required: false, <del> }, <del> minifyCode: { <del> type: 'function', <del> }, <del> resetCache: { <del> type: 'boolean', <del> default: false, <del> }, <del> reporter: { <del> type: 'object', <del> }, <del>}); <add>import type {TransformCode} from '../node-haste/Module'; <add>import type Cache from '../node-haste/Cache'; <add> <add>type MinifyCode = (filePath: string, code: string, map: SourceMap) => <add> Promise<{code: string, map: SourceMap}>; <add> <add>type Options = { <add> assetExts: Array<string>, <add> blacklistRE?: RegExp, <add> cache: Cache, <add> extraNodeModules?: {}, <add> minifyCode: MinifyCode, <add> platforms: Array<string>, <add> polyfillModuleNames?: Array<string>, <add> projectRoots: Array<string>, <add> reporter: Reporter, <add> resetCache: boolean, <add> transformCacheKey: string, <add> transformCode: TransformCode, <add> watch?: boolean, <add>}; <ide> <ide> const getDependenciesValidateOpts = declareOpts({ <ide> dev: { <ide> const getDependenciesValidateOpts = declareOpts({ <ide> class Resolver { <ide> <ide> _depGraph: DependencyGraph; <del> _minifyCode: (filePath: string, code: string, map: SourceMap) => <del> Promise<{code: string, map: SourceMap}>; <add> _minifyCode: MinifyCode; <ide> _polyfillModuleNames: Array<string>; <ide> <del> constructor(options: { <del> reporter: Reporter, <del> resetCache: boolean, <del> }) { <del> const opts = validateOpts(options); <del> <add> constructor(opts: Options) { <ide> this._depGraph = new DependencyGraph({ <ide> assetDependencies: ['react-native/Libraries/Image/AssetRegistry'], <ide> assetExts: opts.assetExts, <ide> cache: opts.cache, <ide> extraNodeModules: opts.extraNodeModules, <ide> ignoreFilePath: function(filepath) { <ide> return filepath.indexOf('__tests__') !== -1 || <del> (opts.blacklistRE && opts.blacklistRE.test(filepath)); <add> (opts.blacklistRE != null && opts.blacklistRE.test(filepath)); <ide> }, <ide> moduleOptions: { <ide> cacheTransformResults: true, <del> resetCache: options.resetCache, <add> resetCache: opts.resetCache, <ide> }, <ide> platforms: opts.platforms, <ide> preferNativePlatform: true, <ide> providesModuleNodeModules: defaults.providesModuleNodeModules, <del> reporter: options.reporter, <del> resetCache: options.resetCache, <add> reporter: opts.reporter, <add> resetCache: opts.resetCache, <ide> roots: opts.projectRoots, <ide> transformCacheKey: opts.transformCacheKey, <ide> transformCode: opts.transformCode, <del> watch: opts.watch, <add> watch: opts.watch || false, <ide> }); <ide> <ide> this._minifyCode = opts.minifyCode; <ide><path>packager/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js <ide> type DirExistsFn = (filePath: string) => boolean; <ide> type Options = { <ide> dirExists: DirExistsFn, <ide> entryPath: string, <del> extraNodeModules: Object, <add> extraNodeModules: ?Object, <ide> hasteFS: HasteFS, <ide> hasteMap: HasteMap, <ide> helpers: DependencyGraphHelpers, <ide> type Options = { <ide> class ResolutionRequest { <ide> _dirExists: DirExistsFn; <ide> _entryPath: string; <del> _extraNodeModules: Object; <add> _extraNodeModules: ?Object; <ide> _hasteFS: HasteFS; <ide> _hasteMap: HasteMap; <ide> _helpers: DependencyGraphHelpers; <ide> class ResolutionRequest { <ide> } <ide> <ide> if (this._extraNodeModules) { <add> const {_extraNodeModules} = this; <ide> const bits = toModuleName.split('/'); <ide> const packageName = bits[0]; <del> if (this._extraNodeModules[packageName]) { <del> bits[0] = this._extraNodeModules[packageName]; <add> if (_extraNodeModules[packageName]) { <add> bits[0] = _extraNodeModules[packageName]; <ide> searchQueue.push(path.join.apply(path, bits)); <ide> } <ide> } <ide><path>packager/react-packager/src/node-haste/index.js <ide> class DependencyGraph { <ide> _opts: {| <ide> assetExts: Array<string>, <ide> extensions: Array<string>, <del> extraNodeModules: Object, <add> extraNodeModules: ?Object, <ide> forceNodeFilesystemAPI: boolean, <ide> ignoreFilePath: (filePath: string) => boolean, <ide> maxWorkers: ?number, <ide> class DependencyGraph { <ide> assetExts: Array<string>, <ide> cache: Cache, <ide> extensions?: ?Array<string>, <del> extraNodeModules: Object, <add> extraNodeModules: ?Object, <ide> forceNodeFilesystemAPI?: boolean, <ide> ignoreFilePath: (filePath: string) => boolean, <ide> maxWorkers?: ?number,
4
PHP
PHP
expire jobs after 90 seconds
d3aff652bdebe006442a575df647d59baddee903
<ide><path>config/queue.php <ide> 'driver' => 'database', <ide> 'table' => 'jobs', <ide> 'queue' => 'default', <del> 'expire' => 60, <add> 'expire' => 90, <ide> ], <ide> <ide> 'beanstalkd' => [ <ide> 'driver' => 'beanstalkd', <ide> 'host' => 'localhost', <ide> 'queue' => 'default', <del> 'ttr' => 60, <add> 'ttr' => 90, <ide> ], <ide> <ide> 'sqs' => [ <ide> 'driver' => 'redis', <ide> 'connection' => 'default', <ide> 'queue' => 'default', <del> 'expire' => 60, <add> 'expire' => 90, <ide> ], <ide> <ide> ],
1
Javascript
Javascript
use emitter.listenercount() in test-http-connect
2b090c1bd09b7dfff2a329717154b25ba6a786c2
<ide><path>test/parallel/test-http-connect.js <ide> server.on('connect', common.mustCall((req, socket, firstBodyChunk) => { <ide> assert.strictEqual(req.url, 'google.com:443'); <ide> <ide> // Make sure this socket has detached. <del> assert.strictEqual(socket.listeners('close').length, 0); <del> assert.strictEqual(socket.listeners('drain').length, 0); <del> assert.strictEqual(socket.listeners('data').length, 0); <del> assert.strictEqual(socket.listeners('end').length, 1); <del> assert.strictEqual(socket.listeners('error').length, 0); <add> assert.strictEqual(socket.listenerCount('close'), 0); <add> assert.strictEqual(socket.listenerCount('drain'), 0); <add> assert.strictEqual(socket.listenerCount('data'), 0); <add> assert.strictEqual(socket.listenerCount('end'), 1); <add> assert.strictEqual(socket.listenerCount('error'), 0); <ide> <ide> socket.write('HTTP/1.1 200 Connection established\r\n\r\n'); <ide> <ide> server.listen(0, common.mustCall(() => { <ide> assert(!socket.ondata); <ide> assert(!socket.onend); <ide> assert.strictEqual(socket._httpMessage, null); <del> assert.strictEqual(socket.listeners('connect').length, 0); <del> assert.strictEqual(socket.listeners('data').length, 0); <del> assert.strictEqual(socket.listeners('drain').length, 0); <del> assert.strictEqual(socket.listeners('end').length, 1); <del> assert.strictEqual(socket.listeners('free').length, 0); <del> assert.strictEqual(socket.listeners('close').length, 0); <del> assert.strictEqual(socket.listeners('error').length, 0); <del> assert.strictEqual(socket.listeners('agentRemove').length, 0); <add> assert.strictEqual(socket.listenerCount('connect'), 0); <add> assert.strictEqual(socket.listenerCount('data'), 0); <add> assert.strictEqual(socket.listenerCount('drain'), 0); <add> assert.strictEqual(socket.listenerCount('end'), 1); <add> assert.strictEqual(socket.listenerCount('free'), 0); <add> assert.strictEqual(socket.listenerCount('close'), 0); <add> assert.strictEqual(socket.listenerCount('error'), 0); <add> assert.strictEqual(socket.listenerCount('agentRemove'), 0); <ide> <ide> let data = firstBodyChunk.toString(); <ide> socket.on('data', (buf) => {
1
Text
Text
update support readme for webpack1 wiki
736ac2645d83a31c5400c3640089af5a142cdcb2
<ide><path>README.md <ide> We consider webpack to be a low-level tool used not only individually but also l <ide> <ide> If you're just getting started, take a look at [our new docs and concepts page](https://webpack.js.org/concepts/). This has a high level overview that is great for beginners!! <ide> <add>Looking for webpack1 docs? Please check out the old [wiki](https://github.com/webpack/docs/wiki/contents), but note that this deprecated version is no longer supported. <add> <ide> If you want to discuss something or just need help, [here is our Gitter room](https://gitter.im/webpack/webpack) where there are always individuals looking to help out! <ide> <ide> If you are still having difficulty, we would love for you to post
1
Javascript
Javascript
fix bug in spotlighthelper
62778396082a830f695cdd2ca17efbe14c8703f5
<ide><path>src/extras/helpers/SpotLightHelper.js <ide> THREE.SpotLightHelper = function ( light, sphereSize ) { <ide> this.targetLine = new THREE.Line( lineGeometry, lineMaterial ); <ide> this.targetLine.properties.isGizmo = true; <ide> <add> } <add> else { <add> <add> this.targetSphere = null; <add> <ide> } <ide> <ide> // <ide> THREE.SpotLightHelper.prototype.update = function () { <ide> this.lightRays.material.color.copy( this.color ); <ide> this.lightCone.material.color.copy( this.color ); <ide> <del> this.targetSphere.material.color.copy( this.color ); <del> this.targetLine.material.color.copy( this.color ); <add> // Only update targetSphere and targetLine if available <add> if ( this.targetSphere ) { <ide> <del> // update target line vertices <add> this.targetSphere.material.color.copy( this.color ); <add> this.targetLine.material.color.copy( this.color ); <ide> <del> this.targetLine.geometry.vertices[ 0 ].copy( this.light.position ); <del> this.targetLine.geometry.vertices[ 1 ].copy( this.light.target.position ); <add> // update target line vertices <ide> <del> this.targetLine.geometry.computeLineDistances(); <del> this.targetLine.geometry.verticesNeedUpdate = true; <add> this.targetLine.geometry.vertices[ 0 ].copy( this.light.position ); <add> this.targetLine.geometry.vertices[ 1 ].copy( this.light.target.position ); <add> <add> this.targetLine.geometry.computeLineDistances(); <add> this.targetLine.geometry.verticesNeedUpdate = true; <add> <add> } <ide> <ide> };
1
Python
Python
remove `request' from response instance while
7df7dadccdba83d87fcc1ec6b5977fde26aab881
<ide><path>rest_framework/tests/renderers.py <ide> def _get_pickling_errors(cls, obj, seen=None): <ide> def http_resp(self, http_method, url): <ide> """ <ide> Simple wrapper for Client http requests <del> Removes the `client' attribute from the response as an instance <del> of `django.test.client.Client' is not pickable <add> Removes the `client' and `request' attributes from as they are <add> added by django.test.client.Client and not part of caching <add> responses outside of tests. <ide> """ <ide> method = getattr(self.client, http_method) <ide> resp = method(url) <del> del resp.client <add> del resp.client, resp.request <ide> return resp <ide> <ide> def test_obj_pickling(self):
1
Python
Python
change dict.iteritems() to dict.items()
e2ea9eb4e2ab0fecc9adfabbec838dbfd114be29
<ide><path>research/object_detection/model_lib.py <ide> def tpu_scaffold(): <ide> if img_summary is not None: <ide> eval_metric_ops['Detections_Left_Groundtruth_Right'] = ( <ide> img_summary, tf.no_op()) <del> eval_metric_ops = {str(k): v for k, v in eval_metric_ops.iteritems()} <add> eval_metric_ops = {str(k): v for k, v in eval_metric_ops.items()} <ide> <ide> if eval_config.use_moving_averages: <ide> variable_averages = tf.train.ExponentialMovingAverage(0.0)
1
Text
Text
update contributing guidelines
56d4bc40ea33d1b29191d04a1caf49e10569cbbb
<ide><path>CONTRIBUTING.md <ide> Do this prior to every time you create a branch for a PR: <ide> <ide> 1. Make sure you are on the `staging` branch <ide> <del> > ```shell <del> > $ git status <del> > On branch staging <del> > Your branch is up-to-date with 'origin/staging'. <del> > ``` <add> ```shell <add> $ git status <add> On branch staging <add> Your branch is up-to-date with 'origin/staging'. <add> ``` <add> If your aren't on `staging`, resolve outstanding files / commits and checkout the `staging` branch <ide> <del> > If your aren't on `staging`, resolve outstanding files / commits and checkout the `staging` branch <del> <del> > ```shell <del> > $ git checkout staging <del> > ``` <add> ```shell <add> $ git checkout staging <add> ``` <ide> <ide> 2. Do a pull with rebase against `upstream` <ide> <del> > ```shell <del> > $ git pull --rebase upstream staging <del> > ``` <add> ```shell <add> $ git pull --rebase upstream staging <add> ``` <ide> <del> > This will pull down all of the changes to the official staging branch, without making an additional commit in your local repo. <add> This will pull down all of the changes to the official staging branch, without making an additional commit in your local repo. <ide> <ide> 3. (_Optional_) Force push your updated staging branch to your GitHub fork <ide> <del> > ```shell <del> > $ git push origin staging --force <del> > ``` <add> ```shell <add> $ git push origin staging --force <add> ``` <ide> <del> > This will overwrite the staging branch of your fork. <add> This will overwrite the staging branch of your fork. <ide> <ide> ### Create A Branch <ide>
1
Python
Python
fix regression in pool metrics
0367a92881e88df36dabb81ef837e5256f3db89d
<ide><path>airflow/jobs/scheduler_job.py <ide> def _executable_task_instances_to_queued(self, max_tis: int, session: Session = <ide> starved_pools.add(pool_name) <ide> continue <ide> <add> # Make sure to emit metrics if pool has no starving tasks <add> pool_num_starving_tasks.setdefault(pool_name, 0) <add> <ide> pool_total = pool_stats["total"] <ide> open_slots = pool_stats["open"] <ide> <ide> def _executable_task_instances_to_queued(self, max_tis: int, session: Session = <ide> pool_name, <ide> ) <ide> <add> pool_num_starving_tasks[pool_name] += 1 <add> num_starving_tasks_total += 1 <ide> starved_tasks.add((task_instance.dag_id, task_instance.task_id)) <ide> continue <ide> <ide><path>tests/jobs/test_scheduler_job.py <ide> def test_find_executable_task_instances_not_enough_task_concurrency_for_first(se <ide> <ide> session.rollback() <ide> <add> @mock.patch('airflow.jobs.scheduler_job.Stats.gauge') <add> def test_emit_pool_starving_tasks_metrics(self, mock_stats_gauge, dag_maker): <add> self.scheduler_job = SchedulerJob(subdir=os.devnull) <add> session = settings.Session() <add> <add> dag_id = 'SchedulerJobTest.test_emit_pool_starving_tasks_metrics' <add> with dag_maker(dag_id=dag_id): <add> op = DummyOperator(task_id='op', pool_slots=2) <add> <add> dr = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED) <add> <add> ti = dr.get_task_instance(op.task_id, session) <add> ti.state = State.SCHEDULED <add> <add> set_default_pool_slots(1) <add> session.flush() <add> <add> res = self.scheduler_job._executable_task_instances_to_queued(max_tis=32, session=session) <add> assert 0 == len(res) <add> <add> mock_stats_gauge.assert_has_calls( <add> [ <add> mock.call('scheduler.tasks.starving', 1), <add> mock.call(f'pool.starving_tasks.{Pool.DEFAULT_POOL_NAME}', 1), <add> ], <add> any_order=True, <add> ) <add> mock_stats_gauge.reset_mock() <add> <add> set_default_pool_slots(2) <add> session.flush() <add> <add> res = self.scheduler_job._executable_task_instances_to_queued(max_tis=32, session=session) <add> assert 1 == len(res) <add> <add> mock_stats_gauge.assert_has_calls( <add> [ <add> mock.call('scheduler.tasks.starving', 0), <add> mock.call(f'pool.starving_tasks.{Pool.DEFAULT_POOL_NAME}', 0), <add> ], <add> any_order=True, <add> ) <add> <add> session.rollback() <add> session.close() <add> <ide> def test_enqueue_task_instances_with_queued_state(self, dag_maker): <ide> dag_id = 'SchedulerJobTest.test_enqueue_task_instances_with_queued_state' <ide> task_id_1 = 'dummy'
2
Go
Go
fix race in locker call to `dec()`
985175fd8f8f662d5067bd62a89330e9a437375c
<ide><path>pkg/locker/locker.go <ide> type Locker struct { <ide> type lockCtr struct { <ide> mu sync.Mutex <ide> // waiters is the number of waiters waiting to acquire the lock <del> waiters uint32 <add> // this is int32 instead of uint32 so we can add `-1` in `dec()` <add> waiters int32 <ide> } <ide> <ide> // inc increments the number of waiters waiting for the lock <ide> func (l *lockCtr) inc() { <del> atomic.AddUint32(&l.waiters, 1) <add> atomic.AddInt32(&l.waiters, 1) <ide> } <ide> <ide> // dec decrements the number of waiters wating on the lock <ide> func (l *lockCtr) dec() { <del> atomic.AddUint32(&l.waiters, ^uint32(l.waiters-1)) <add> atomic.AddInt32(&l.waiters, -1) <ide> } <ide> <ide> // count gets the current number of waiters <del>func (l *lockCtr) count() uint32 { <del> return atomic.LoadUint32(&l.waiters) <add>func (l *lockCtr) count() int32 { <add> return atomic.LoadInt32(&l.waiters) <ide> } <ide> <ide> // Lock locks the mutex <ide><path>pkg/locker/locker_test.go <ide> package locker <ide> <ide> import ( <add> "sync" <ide> "testing" <ide> "time" <ide> ) <ide> func TestLockerUnlock(t *testing.T) { <ide> t.Fatalf("lock should not be blocked") <ide> } <ide> } <add> <add>func TestLockerConcurrency(t *testing.T) { <add> l := New() <add> <add> var wg sync.WaitGroup <add> for i := 0; i <= 10000; i++ { <add> wg.Add(1) <add> go func() { <add> l.Lock("test") <add> // if there is a concurrency issue, will very likely panic here <add> l.Unlock("test") <add> wg.Done() <add> }() <add> } <add> <add> chDone := make(chan struct{}) <add> go func() { <add> wg.Wait() <add> close(chDone) <add> }() <add> <add> select { <add> case <-chDone: <add> case <-time.After(10 * time.Second): <add> t.Fatal("timeout waiting for locks to complete") <add> } <add> <add> // Since everything has unlocked this should not exist anymore <add> if ctr, exists := l.locks["test"]; exists { <add> t.Fatalf("lock should not exist: %v", ctr) <add> } <add>}
2
Python
Python
fix italian tag map
975e1042ffb943d645d1d42cf0b121ae220f3e8d
<ide><path>spacy/lang/it/tag_map.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <add>from ...symbols import POS, PUNCT, SYM, ADJ, NUM, DET, ADV, ADP, X, VERB <add>from ...symbols import NOUN, PROPN, PART, INTJ, SPACE, PRON, SCONJ, AUX, CONJ <add> <ide> <ide> TAG_MAP = { <del> "AP__Gender=Fem|Number=Plur|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Gender=Masc|Number=Plur|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Gender=Masc|Number=Sing|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Gender=Masc|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Number=Sing|Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "AP__Poss=Yes|PronType=Prs": {"pos": "DET"}, <del> "A__Degree=Abs|Gender=Fem|Number=Plur": {"pos": "ADJ"}, <del> "A__Degree=Abs|Gender=Fem|Number=Sing": {"pos": "ADJ"}, <del> "A__Degree=Abs|Gender=Masc|Number=Plur": {"pos": "ADJ"}, <del> "A__Degree=Abs|Gender=Masc|Number=Sing": {"pos": "ADJ"}, <del> "A__Degree=Cmp": {"pos": "ADJ"}, <del> "A__Degree=Cmp|Number=Plur": {"pos": "ADJ"}, <del> "A__Degree=Cmp|Number=Sing": {"pos": "ADJ"}, <del> "A__Gender=Fem|Number=Plur": {"pos": "ADJ"}, <del> "A__Gender=Fem|Number=Sing": {"pos": "ADJ"}, <del> "A__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {"pos": "ADJ"}, <del> "A__Gender=Masc": {"pos": "ADJ"}, <del> "A__Gender=Masc|Number=Plur": {"pos": "ADJ"}, <del> "A__Gender=Masc|Number=Sing": {"pos": "ADJ"}, <del> "A__Number=Plur": {"pos": "ADJ"}, <del> "A__Number=Sing": {"pos": "ADJ"}, <del> "A___": {"pos": "ADJ"}, <del> "BN__PronType=Neg": {"pos": "ADV"}, <del> "B__Degree=Abs": {"pos": "ADV"}, <del> "B__Degree=Abs|Gender=Masc|Number=Sing": {"pos": "ADV"}, <del> "B___": {"pos": "ADV"}, <del> "CC___": {"pos": "CONJ"}, <del> "CS___": {"pos": "SCONJ"}, <del> "DD__Gender=Fem|Number=Plur|PronType=Dem": {"pos": "DET"}, <del> "DD__Gender=Fem|Number=Sing|PronType=Dem": {"pos": "DET"}, <del> "DD__Gender=Masc|Number=Plur|PronType=Dem": {"pos": "DET"}, <del> "DD__Gender=Masc|Number=Sing|PronType=Dem": {"pos": "DET"}, <del> "DD__Gender=Masc|PronType=Dem": {"pos": "DET"}, <del> "DD__Number=Plur|PronType=Dem": {"pos": "DET"}, <del> "DD__Number=Sing|PronType=Dem": {"pos": "DET"}, <del> "DE__PronType=Exc": {"pos": "DET"}, <del> "DI__Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "DI__Gender=Fem|Number=Plur": {"pos": "DET"}, <del> "DI__Gender=Fem|Number=Plur|PronType=Ind": {"pos": "DET"}, <del> "DI__Gender=Fem|Number=Sing|PronType=Ind": {"pos": "DET"}, <del> "DI__Gender=Masc|Number=Plur": {"pos": "DET"}, <del> "DI__Gender=Masc|Number=Plur|PronType=Ind": {"pos": "DET"}, <del> "DI__Gender=Masc|Number=Sing|PronType=Ind": {"pos": "DET"}, <del> "DI__Number=Sing|PronType=Art": {"pos": "DET"}, <del> "DI__Number=Sing|PronType=Ind": {"pos": "DET"}, <del> "DI__PronType=Ind": {"pos": "DET"}, <del> "DQ__Gender=Fem|Number=Plur|PronType=Int": {"pos": "DET"}, <del> "DQ__Gender=Fem|Number=Sing|PronType=Int": {"pos": "DET"}, <del> "DQ__Gender=Masc|Number=Plur|PronType=Int": {"pos": "DET"}, <del> "DQ__Gender=Masc|Number=Sing|PronType=Int": {"pos": "DET"}, <del> "DQ__Number=Plur|PronType=Int": {"pos": "DET"}, <del> "DQ__Number=Sing|PronType=Int": {"pos": "DET"}, <del> "DQ__PronType=Int": {"pos": "DET"}, <del> "DQ___": {"pos": "DET"}, <del> "DR__Number=Plur|PronType=Rel": {"pos": "DET"}, <del> "DR__PronType=Rel": {"pos": "DET"}, <del> "E__Gender=Masc|Number=Sing": {"pos": "ADP"}, <del> "E___": {"pos": "ADP"}, <del> "FB___": {"pos": "PUNCT"}, <del> "FC___": {"pos": "PUNCT"}, <del> "FF___": {"pos": "PUNCT"}, <del> "FS___": {"pos": "PUNCT"}, <del> "I__Polarity=Neg": {"pos": "INTJ"}, <del> "I__Polarity=Pos": {"pos": "INTJ"}, <del> "I___": {"pos": "INTJ"}, <del> "NO__Gender=Fem|Number=Plur|NumType=Ord": {"pos": "ADJ"}, <del> "NO__Gender=Fem|Number=Sing|NumType=Ord": {"pos": "ADJ"}, <del> "NO__Gender=Masc|Number=Plur": {"pos": "ADJ"}, <del> "NO__Gender=Masc|Number=Plur|NumType=Ord": {"pos": "ADJ"}, <del> "NO__Gender=Masc|Number=Sing|NumType=Ord": {"pos": "ADJ"}, <del> "NO__NumType=Ord": {"pos": "ADJ"}, <del> "NO__Number=Sing|NumType=Ord": {"pos": "ADJ"}, <del> "NO___": {"pos": "ADJ"}, <del> "N__Gender=Masc|Number=Sing": {"pos": "NUM"}, <del> "N__NumType=Card": {"pos": "NUM"}, <del> "N__NumType=Range": {"pos": "NUM"}, <del> "N___": {"pos": "NUM"}, <del> "PART___": {"pos": "PART"}, <del> "PC__Clitic=Yes|Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Fem|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Fem|Number=Plur|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Fem|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Fem|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Masc|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Masc|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Gender=Masc|Number=Sing|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Plur|Person=1|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Plur|Person=2|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Plur|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Sing|Person=1|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Sing|Person=2|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PC__Clitic=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PD__Gender=Fem|Number=Plur|PronType=Dem": {"pos": "PRON"}, <del> "PD__Gender=Fem|Number=Sing|PronType=Dem": {"pos": "PRON"}, <del> "PD__Gender=Masc|Number=Plur|PronType=Dem": {"pos": "PRON"}, <del> "PD__Gender=Masc|Number=Sing|PronType=Dem": {"pos": "PRON"}, <del> "PD__Number=Plur|PronType=Dem": {"pos": "PRON"}, <del> "PD__Number=Sing|PronType=Dem": {"pos": "PRON"}, <del> "PD__PronType=Dem": {"pos": "PRON"}, <del> "PE__Gender=Fem|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Gender=Fem|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Gender=Masc|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Gender=Masc|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Plur|Person=1|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Plur|Person=2|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Sing|Person=1|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Sing|Person=2|PronType=Prs": {"pos": "PRON"}, <del> "PE__Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__Person=3|PronType=Prs": {"pos": "PRON"}, <del> "PE__PronType=Prs": {"pos": "PRON"}, <del> "PI__Gender=Fem|Number=Plur|PronType=Ind": {"pos": "PRON"}, <del> "PI__Gender=Fem|Number=Sing|PronType=Ind": {"pos": "PRON"}, <del> "PI__Gender=Masc|Number=Plur|PronType=Ind": {"pos": "PRON"}, <del> "PI__Gender=Masc|Number=Sing": {"pos": "PRON"}, <del> "PI__Gender=Masc|Number=Sing|PronType=Ind": {"pos": "PRON"}, <del> "PI__Number=Plur|PronType=Ind": {"pos": "PRON"}, <del> "PI__Number=Sing|PronType=Ind": {"pos": "PRON"}, <del> "PI__PronType=Ind": {"pos": "PRON"}, <del> "PP__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PP__Gender=Masc|Number=Plur|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PP__Gender=Masc|Number=Sing|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PP__Number=Plur|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PP__Number=Sing|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <del> "PQ__Gender=Fem|Number=Plur|PronType=Int": {"pos": "PRON"}, <del> "PQ__Gender=Fem|Number=Sing|PronType=Int": {"pos": "PRON"}, <del> "PQ__Gender=Masc|Number=Plur|PronType=Int": {"pos": "PRON"}, <del> "PQ__Gender=Masc|Number=Sing|PronType=Int": {"pos": "PRON"}, <del> "PQ__Number=Plur|PronType=Int": {"pos": "PRON"}, <del> "PQ__Number=Sing|PronType=Int": {"pos": "PRON"}, <del> "PQ__PronType=Int": {"pos": "PRON"}, <del> "PR__Gender=Masc|Number=Plur|PronType=Rel": {"pos": "PRON"}, <del> "PR__Gender=Masc|Number=Sing|PronType=Rel": {"pos": "PRON"}, <del> "PR__Gender=Masc|PronType=Rel": {"pos": "PRON"}, <del> "PR__Number=Plur|PronType=Rel": {"pos": "PRON"}, <del> "PR__Number=Sing|PronType=Rel": {"pos": "PRON"}, <del> "PR__Person=3|PronType=Rel": {"pos": "PRON"}, <del> "PR__PronType=Rel": {"pos": "PRON"}, <del> "RD__Definite=Def": {"pos": "DET"}, <del> "RD__Definite=Def|Gender=Fem": {"pos": "DET"}, <del> "RD__Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|Gender=Fem|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|Gender=Masc|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|Gender=Masc|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RD__Definite=Def|PronType=Art": {"pos": "DET"}, <del> "RD__Gender=Fem|Number=Sing": {"pos": "DET"}, <del> "RD__Gender=Masc|Number=Sing": {"pos": "DET"}, <del> "RD__Number=Sing": {"pos": "DET"}, <del> "RD__Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|Gender=Fem|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|Gender=Fem|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|Gender=Masc|Number=Plur|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|Gender=Masc|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|Number=Sing|PronType=Art": {"pos": "DET"}, <del> "RI__Definite=Ind|PronType=Art": {"pos": "DET"}, <del> "SP__Gender=Fem|Number=Plur": {"pos": "PROPN"}, <del> "SP__NumType=Card": {"pos": "PROPN"}, <del> "SP___": {"pos": "PROPN"}, <del> "SW__Foreign=Yes": {"pos": "X"}, <del> "SW__Foreign=Yes|Gender=Masc": {"pos": "X"}, <del> "SW__Foreign=Yes|Number=Sing": {"pos": "X"}, <del> "SYM___": {"pos": "SYM"}, <del> "S__Gender=Fem": {"pos": "NOUN"}, <del> "S__Gender=Fem|Number=Plur": {"pos": "NOUN"}, <del> "S__Gender=Fem|Number=Sing": {"pos": "NOUN"}, <del> "S__Gender=Masc": {"pos": "NOUN"}, <del> "S__Gender=Masc|Number=Plur": {"pos": "NOUN"}, <del> "S__Gender=Masc|Number=Sing": {"pos": "NOUN"}, <del> "S__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "NOUN"}, <del> "S__Number=Plur": {"pos": "NOUN"}, <del> "S__Number=Sing": {"pos": "NOUN"}, <del> "S___": {"pos": "NOUN"}, <del> "Sw___": {"pos": "X"}, <del> "T__Gender=Fem|Number=Plur|PronType=Tot": {"pos": "DET"}, <del> "T__Gender=Fem|Number=Sing": {"pos": "DET"}, <del> "T__Gender=Fem|Number=Sing|PronType=Tot": {"pos": "DET"}, <del> "T__Gender=Masc|Number=Plur|PronType=Tot": {"pos": "DET"}, <del> "T__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "DET"}, <del> "T__Number=Plur|PronType=Tot": {"pos": "DET"}, <del> "T__PronType=Tot": {"pos": "DET"}, <del> "VA__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VA__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VA__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VA__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VA__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Past|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VA__VerbForm=Ger": {"pos": "AUX"}, <del> "VA__VerbForm=Inf": {"pos": "AUX"}, <del> "VM__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VM__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Imp|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "AUX"}, <del> "VM__VerbForm=Ger": {"pos": "AUX"}, <del> "VM__VerbForm=Inf": {"pos": "AUX"}, <del> "V__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <del> "V__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <del> "V__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <del> "V__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Imp|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Imp|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Imp|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=1|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=1|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Ind|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Mood=Sub|Number=Sing|Person=3|VerbForm=Fin": {"pos": "VERB"}, <del> "V__Number=Plur|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <del> "V__Number=Sing|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <del> "V__Tense=Past|VerbForm=Part": {"pos": "VERB"}, <del> "V__VerbForm=Ger": {"pos": "VERB"}, <del> "V__VerbForm=Inf": {"pos": "VERB"}, <del> "X___": {"pos": "X"}, <del> "_SP": {"pos": "SPACE"} <add> "AP__Gender=Fem|Number=Plur|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Gender=Masc|Number=Plur|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Gender=Masc|Number=Sing|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Gender=Masc|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Number=Sing|Poss=Yes|PronType=Prs": {POS: DET}, <add> "AP__Poss=Yes|PronType=Prs": {POS: DET}, <add> "A__Degree=Abs|Gender=Fem|Number=Plur": {POS: ADJ}, <add> "A__Degree=Abs|Gender=Fem|Number=Sing": {POS: ADJ}, <add> "A__Degree=Abs|Gender=Masc|Number=Plur": {POS: ADJ}, <add> "A__Degree=Abs|Gender=Masc|Number=Sing": {POS: ADJ}, <add> "A__Degree=Cmp": {POS: ADJ}, <add> "A__Degree=Cmp|Number=Plur": {POS: ADJ}, <add> "A__Degree=Cmp|Number=Sing": {POS: ADJ}, <add> "A__Gender=Fem|Number=Plur": {POS: ADJ}, <add> "A__Gender=Fem|Number=Sing": {POS: ADJ}, <add> "A__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {POS: ADJ}, <add> "A__Gender=Masc": {POS: ADJ}, <add> "A__Gender=Masc|Number=Plur": {POS: ADJ}, <add> "A__Gender=Masc|Number=Sing": {POS: ADJ}, <add> "A__Number=Plur": {POS: ADJ}, <add> "A__Number=Sing": {POS: ADJ}, <add> "A___": {POS: ADJ}, <add> "BN__PronType=Neg": {POS: ADV}, <add> "B__Degree=Abs": {POS: ADV}, <add> "B__Degree=Abs|Gender=Masc|Number=Sing": {POS: ADV}, <add> "B___": {POS: ADV}, <add> "CC___": {POS: CONJ}, <add> "CS___": {POS: SCONJ}, <add> "DD__Gender=Fem|Number=Plur|PronType=Dem": {POS: DET}, <add> "DD__Gender=Fem|Number=Sing|PronType=Dem": {POS: DET}, <add> "DD__Gender=Masc|Number=Plur|PronType=Dem": {POS: DET}, <add> "DD__Gender=Masc|Number=Sing|PronType=Dem": {POS: DET}, <add> "DD__Gender=Masc|PronType=Dem": {POS: DET}, <add> "DD__Number=Plur|PronType=Dem": {POS: DET}, <add> "DD__Number=Sing|PronType=Dem": {POS: DET}, <add> "DE__PronType=Exc": {POS: DET}, <add> "DI__Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {POS: DET}, <add> "DI__Gender=Fem|Number=Plur": {POS: DET}, <add> "DI__Gender=Fem|Number=Plur|PronType=Ind": {POS: DET}, <add> "DI__Gender=Fem|Number=Sing|PronType=Ind": {POS: DET}, <add> "DI__Gender=Masc|Number=Plur": {POS: DET}, <add> "DI__Gender=Masc|Number=Plur|PronType=Ind": {POS: DET}, <add> "DI__Gender=Masc|Number=Sing|PronType=Ind": {POS: DET}, <add> "DI__Number=Sing|PronType=Art": {POS: DET}, <add> "DI__Number=Sing|PronType=Ind": {POS: DET}, <add> "DI__PronType=Ind": {POS: DET}, <add> "DQ__Gender=Fem|Number=Plur|PronType=Int": {POS: DET}, <add> "DQ__Gender=Fem|Number=Sing|PronType=Int": {POS: DET}, <add> "DQ__Gender=Masc|Number=Plur|PronType=Int": {POS: DET}, <add> "DQ__Gender=Masc|Number=Sing|PronType=Int": {POS: DET}, <add> "DQ__Number=Plur|PronType=Int": {POS: DET}, <add> "DQ__Number=Sing|PronType=Int": {POS: DET}, <add> "DQ__PronType=Int": {POS: DET}, <add> "DQ___": {POS: DET}, <add> "DR__Number=Plur|PronType=Rel": {POS: DET}, <add> "DR__PronType=Rel": {POS: DET}, <add> "E__Gender=Masc|Number=Sing": {POS: ADP}, <add> "E___": {POS: ADP}, <add> "FB___": {POS: PUNCT}, <add> "FC___": {POS: PUNCT}, <add> "FF___": {POS: PUNCT}, <add> "FS___": {POS: PUNCT}, <add> "I__Polarity=Neg": {POS: INTJ}, <add> "I__Polarity=Pos": {POS: INTJ}, <add> "I___": {POS: INTJ}, <add> "NO__Gender=Fem|Number=Plur|NumType=Ord": {POS: ADJ}, <add> "NO__Gender=Fem|Number=Sing|NumType=Ord": {POS: ADJ}, <add> "NO__Gender=Masc|Number=Plur": {POS: ADJ}, <add> "NO__Gender=Masc|Number=Plur|NumType=Ord": {POS: ADJ}, <add> "NO__Gender=Masc|Number=Sing|NumType=Ord": {POS: ADJ}, <add> "NO__NumType=Ord": {POS: ADJ}, <add> "NO__Number=Sing|NumType=Ord": {POS: ADJ}, <add> "NO___": {POS: ADJ}, <add> "N__Gender=Masc|Number=Sing": {POS: NUM}, <add> "N__NumType=Card": {POS: NUM}, <add> "N__NumType=Range": {POS: NUM}, <add> "N___": {POS: NUM}, <add> "PART___": {POS: PART}, <add> "PC__Clitic=Yes|Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Fem|Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Fem|Number=Plur|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Fem|Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Fem|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Masc|Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Masc|Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Gender=Masc|Number=Sing|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Plur|Person=1|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Plur|Person=2|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Plur|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Sing|Person=1|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Sing|Person=2|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|Person=3|PronType=Prs": {POS: PRON}, <add> "PC__Clitic=Yes|PronType=Prs": {POS: PRON}, <add> "PD__Gender=Fem|Number=Plur|PronType=Dem": {POS: PRON}, <add> "PD__Gender=Fem|Number=Sing|PronType=Dem": {POS: PRON}, <add> "PD__Gender=Masc|Number=Plur|PronType=Dem": {POS: PRON}, <add> "PD__Gender=Masc|Number=Sing|PronType=Dem": {POS: PRON}, <add> "PD__Number=Plur|PronType=Dem": {POS: PRON}, <add> "PD__Number=Sing|PronType=Dem": {POS: PRON}, <add> "PD__PronType=Dem": {POS: PRON}, <add> "PE__Gender=Fem|Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Gender=Fem|Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Gender=Masc|Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Gender=Masc|Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Number=Plur|Person=1|PronType=Prs": {POS: PRON}, <add> "PE__Number=Plur|Person=2|PronType=Prs": {POS: PRON}, <add> "PE__Number=Plur|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Number=Sing|Person=1|PronType=Prs": {POS: PRON}, <add> "PE__Number=Sing|Person=2|PronType=Prs": {POS: PRON}, <add> "PE__Number=Sing|Person=3|PronType=Prs": {POS: PRON}, <add> "PE__Person=3|PronType=Prs": {POS: PRON}, <add> "PE__PronType=Prs": {POS: PRON}, <add> "PI__Gender=Fem|Number=Plur|PronType=Ind": {POS: PRON}, <add> "PI__Gender=Fem|Number=Sing|PronType=Ind": {POS: PRON}, <add> "PI__Gender=Masc|Number=Plur|PronType=Ind": {POS: PRON}, <add> "PI__Gender=Masc|Number=Sing": {POS: PRON}, <add> "PI__Gender=Masc|Number=Sing|PronType=Ind": {POS: PRON}, <add> "PI__Number=Plur|PronType=Ind": {POS: PRON}, <add> "PI__Number=Sing|PronType=Ind": {POS: PRON}, <add> "PI__PronType=Ind": {POS: PRON}, <add> "PP__Gender=Fem|Number=Sing|Poss=Yes|PronType=Prs": {POS: PRON}, <add> "PP__Gender=Masc|Number=Plur|Poss=Yes|PronType=Prs": {POS: PRON}, <add> "PP__Gender=Masc|Number=Sing|Poss=Yes|PronType=Prs": {POS: PRON}, <add> "PP__Number=Plur|Poss=Yes|PronType=Prs": {POS: PRON}, <add> "PP__Number=Sing|Poss=Yes|PronType=Prs": {POS: PRON}, <add> "PQ__Gender=Fem|Number=Plur|PronType=Int": {POS: PRON}, <add> "PQ__Gender=Fem|Number=Sing|PronType=Int": {POS: PRON}, <add> "PQ__Gender=Masc|Number=Plur|PronType=Int": {POS: PRON}, <add> "PQ__Gender=Masc|Number=Sing|PronType=Int": {POS: PRON}, <add> "PQ__Number=Plur|PronType=Int": {POS: PRON}, <add> "PQ__Number=Sing|PronType=Int": {POS: PRON}, <add> "PQ__PronType=Int": {POS: PRON}, <add> "PR__Gender=Masc|Number=Plur|PronType=Rel": {POS: PRON}, <add> "PR__Gender=Masc|Number=Sing|PronType=Rel": {POS: PRON}, <add> "PR__Gender=Masc|PronType=Rel": {POS: PRON}, <add> "PR__Number=Plur|PronType=Rel": {POS: PRON}, <add> "PR__Number=Sing|PronType=Rel": {POS: PRON}, <add> "PR__Person=3|PronType=Rel": {POS: PRON}, <add> "PR__PronType=Rel": {POS: PRON}, <add> "RD__Definite=Def": {POS: DET}, <add> "RD__Definite=Def|Gender=Fem": {POS: DET}, <add> "RD__Definite=Def|Gender=Fem|Number=Plur|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|Gender=Fem|Number=Sing|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|Gender=Masc|Number=Plur|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|Gender=Masc|Number=Sing|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|Number=Plur|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|Number=Sing|PronType=Art": {POS: DET}, <add> "RD__Definite=Def|PronType=Art": {POS: DET}, <add> "RD__Gender=Fem|Number=Sing": {POS: DET}, <add> "RD__Gender=Masc|Number=Sing": {POS: DET}, <add> "RD__Number=Sing": {POS: DET}, <add> "RD__Number=Sing|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|Gender=Fem|Number=Plur|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|Gender=Fem|Number=Sing|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|Gender=Masc|Number=Plur|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|Gender=Masc|Number=Sing|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|Number=Sing|PronType=Art": {POS: DET}, <add> "RI__Definite=Ind|PronType=Art": {POS: DET}, <add> "SP__Gender=Fem|Number=Plur": {POS: PROPN}, <add> "SP__NumType=Card": {POS: PROPN}, <add> "SP___": {POS: PROPN}, <add> "SW__Foreign=Yes": {POS: X}, <add> "SW__Foreign=Yes|Gender=Masc": {POS: X}, <add> "SW__Foreign=Yes|Number=Sing": {POS: X}, <add> "SYM___": {POS: SYM}, <add> "S__Gender=Fem": {POS: NOUN}, <add> "S__Gender=Fem|Number=Plur": {POS: NOUN}, <add> "S__Gender=Fem|Number=Sing": {POS: NOUN}, <add> "S__Gender=Masc": {POS: NOUN}, <add> "S__Gender=Masc|Number=Plur": {POS: NOUN}, <add> "S__Gender=Masc|Number=Sing": {POS: NOUN}, <add> "S__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: NOUN}, <add> "S__Number=Plur": {POS: NOUN}, <add> "S__Number=Sing": {POS: NOUN}, <add> "S___": {POS: NOUN}, <add> "Sw___": {POS: X}, <add> "T__Gender=Fem|Number=Plur|PronType=Tot": {POS: DET}, <add> "T__Gender=Fem|Number=Sing": {POS: DET}, <add> "T__Gender=Fem|Number=Sing|PronType=Tot": {POS: DET}, <add> "T__Gender=Masc|Number=Plur|PronType=Tot": {POS: DET}, <add> "T__Gender=Masc|Number=Sing|PronType=Tot": {POS: DET}, <add> "T__Number=Plur|PronType=Tot": {POS: DET}, <add> "T__PronType=Tot": {POS: DET}, <add> "VA__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VA__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VA__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VA__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VA__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Past|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VA__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VA__VerbForm=Ger": {POS: AUX}, <add> "VA__VerbForm=Inf": {POS: AUX}, <add> "VM__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VM__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Imp|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: AUX}, <add> "VM__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: AUX}, <add> "VM__VerbForm=Ger": {POS: AUX}, <add> "VM__VerbForm=Inf": {POS: AUX}, <add> "V__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {POS: VERB}, <add> "V__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {POS: VERB}, <add> "V__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Fin": {POS: VERB}, <add> "V__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {POS: VERB}, <add> "V__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: VERB}, <add> "V__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Cnd|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Imp|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Imp|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Imp|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=1|Tense=Past|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=1|Tense=Past|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=2|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Ind|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB}, <add> "V__Mood=Sub|Number=Sing|Person=3|VerbForm=Fin": {POS: VERB}, <add> "V__Number=Plur|Tense=Pres|VerbForm=Part": {POS: VERB}, <add> "V__Number=Sing|Tense=Pres|VerbForm=Part": {POS: VERB}, <add> "V__Tense=Past|VerbForm=Part": {POS: VERB}, <add> "V__VerbForm=Ger": {POS: VERB}, <add> "V__VerbForm=Inf": {POS: VERB}, <add> "X___": {POS: X}, <add> "_SP": {POS: SPACE} <ide> }
1
Java
Java
add @override annotations to main sources
3b40ce76bf751d788f57064bb692ceb8804a58af
<ide><path>spring-aop/src/main/java/org/springframework/aop/TargetSource.java <ide> public interface TargetSource extends TargetClassAware { <ide> * target class. <ide> * @return the type of targets returned by this {@link TargetSource} <ide> */ <add> @Override <ide> Class<?> getTargetClass(); <ide> <ide> /** <ide><path>spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java <ide> class TrueClassFilter implements ClassFilter, Serializable { <ide> private TrueClassFilter() { <ide> } <ide> <add> @Override <ide> public boolean matches(Class clazz) { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java <ide> class TrueMethodMatcher implements MethodMatcher, Serializable { <ide> private TrueMethodMatcher() { <ide> } <ide> <add> @Override <ide> public boolean isRuntime() { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return true; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> // Should never be invoked as isRuntime returns false. <ide> throw new UnsupportedOperationException(); <ide><path>spring-aop/src/main/java/org/springframework/aop/TruePointcut.java <ide> class TruePointcut implements Pointcut, Serializable { <ide> private TruePointcut() { <ide> } <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return ClassFilter.TRUE; <ide> } <ide> <add> @Override <ide> public MethodMatcher getMethodMatcher() { <ide> return MethodMatcher.TRUE; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java <ide> public final ClassLoader getAspectClassLoader() { <ide> return this.aspectInstanceFactory.getAspectClassLoader(); <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.aspectInstanceFactory.getOrder(); <ide> } <ide> public void setAspectName(String name) { <ide> this.aspectName = name; <ide> } <ide> <add> @Override <ide> public String getAspectName() { <ide> return this.aspectName; <ide> } <ide> public void setDeclarationOrder(int order) { <ide> this.declarationOrder = order; <ide> } <ide> <add> @Override <ide> public int getDeclarationOrder() { <ide> return this.declarationOrder; <ide> } <ide> public AdviceExcludingMethodMatcher(Method adviceMethod) { <ide> this.adviceMethod = adviceMethod; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return !this.adviceMethod.equals(method); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java <ide> public void setThrowingName(String throwingName) { <ide> * @param method the target {@link Method} <ide> * @return the parameter names <ide> */ <add> @Override <ide> public String[] getParameterNames(Method method) { <ide> this.argumentTypes = method.getParameterTypes(); <ide> this.numberOfRemainingUnboundArguments = this.argumentTypes.length; <ide> public String[] getParameterNames(Method method) { <ide> * @throws UnsupportedOperationException if <ide> * {@link #setRaiseExceptions(boolean) raiseExceptions} has been set to {@code true} <ide> */ <add> @Override <ide> public String[] getParameterNames(Constructor ctor) { <ide> if (this.raiseExceptions) { <ide> throw new UnsupportedOperationException("An advice method can never be a constructor"); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterAdvice.java <ide> public AspectJAfterAdvice( <ide> super(aspectJBeforeAdviceMethod, pointcut, aif); <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> try { <ide> return mi.proceed(); <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> } <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java <ide> public AspectJAfterReturningAdvice( <ide> super(aspectJBeforeAdviceMethod, pointcut, aif); <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> return true; <ide> } <ide> public void setReturningName(String name) { <ide> setReturningNameNoCheck(name); <ide> } <ide> <add> @Override <ide> public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { <ide> if (shouldInvokeOnReturnValueOf(method, returnValue)) { <ide> invokeAdviceMethod(getJoinPointMatch(), returnValue, null); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterThrowingAdvice.java <ide> public AspectJAfterThrowingAdvice( <ide> super(aspectJBeforeAdviceMethod, pointcut, aif); <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> return true; <ide> } <ide> public void setThrowingName(String name) { <ide> setThrowingNameNoCheck(name); <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> try { <ide> return mi.proceed(); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java <ide> public AspectJAroundAdvice( <ide> super(aspectJAroundAdviceMethod, pointcut, aif); <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> return false; <ide> } <ide> protected boolean supportsProceedingJoinPoint() { <ide> } <ide> <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> if (!(mi instanceof ProxyMethodInvocation)) { <ide> throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java <ide> public void setParameterTypes(Class[] types) { <ide> this.pointcutParameterTypes = types; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> checkReadyToMatch(); <ide> return this; <ide> } <ide> <add> @Override <ide> public MethodMatcher getMethodMatcher() { <ide> checkReadyToMatch(); <ide> return this; <ide> public PointcutExpression getPointcutExpression() { <ide> return this.pointcutExpression; <ide> } <ide> <add> @Override <ide> public boolean matches(Class targetClass) { <ide> checkReadyToMatch(); <ide> try { <ide> public boolean matches(Class targetClass) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) { <ide> checkReadyToMatch(); <ide> Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); <ide> else if (shadowMatch.neverMatches()) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return matches(method, targetClass, false); <ide> } <ide> <add> @Override <ide> public boolean isRuntime() { <ide> checkReadyToMatch(); <ide> return this.pointcutExpression.mayNeedDynamicTest(); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> checkReadyToMatch(); <ide> ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method); <ide> private class BeanNamePointcutDesignatorHandler implements PointcutDesignatorHan <ide> <ide> private static final String BEAN_DESIGNATOR_NAME = "bean"; <ide> <add> @Override <ide> public String getDesignatorName() { <ide> return BEAN_DESIGNATOR_NAME; <ide> } <ide> <add> @Override <ide> public ContextBasedMatcher parse(String expression) { <ide> return new BeanNameContextMatcher(expression); <ide> } <ide> public BeanNameContextMatcher(String expression) { <ide> this.expressionPattern = new NamePattern(expression); <ide> } <ide> <add> @Override <ide> public boolean couldMatchJoinPointsInType(Class someClass) { <ide> return (contextMatch(someClass) == FuzzyBoolean.YES); <ide> } <ide> <add> @Override <ide> public boolean couldMatchJoinPointsInType(Class someClass, MatchingContext context) { <ide> return (contextMatch(someClass) == FuzzyBoolean.YES); <ide> } <ide> <add> @Override <ide> public boolean matchesDynamically(MatchingContext context) { <ide> return true; <ide> } <ide> <add> @Override <ide> public FuzzyBoolean matchesStatically(MatchingContext context) { <ide> return contextMatch(null); <ide> } <ide> <add> @Override <ide> public boolean mayNeedDynamicTest() { <ide> return false; <ide> } <ide> public DefensiveShadowMatch(ShadowMatch primary, ShadowMatch other) { <ide> this.other = other; <ide> } <ide> <add> @Override <ide> public boolean alwaysMatches() { <ide> return primary.alwaysMatches(); <ide> } <ide> <add> @Override <ide> public boolean maybeMatches() { <ide> return primary.maybeMatches(); <ide> } <ide> <add> @Override <ide> public boolean neverMatches() { <ide> return primary.neverMatches(); <ide> } <ide> <add> @Override <ide> public JoinPointMatch matchesJoinPoint(Object thisObject, <ide> Object targetObject, Object[] args) { <ide> try { <ide> public JoinPointMatch matchesJoinPoint(Object thisObject, <ide> } <ide> } <ide> <add> @Override <ide> public void setMatchingContext(MatchingContext aMatchContext) { <ide> primary.setMatchingContext(aMatchContext); <ide> other.setMatchingContext(aMatchContext); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java <ide> public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv <ide> private final AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); <ide> <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJMethodBeforeAdvice.java <ide> public AspectJMethodBeforeAdvice( <ide> super(aspectJBeforeAdviceMethod, pointcut, aif); <ide> } <ide> <add> @Override <ide> public void before(Method method, Object[] args, Object target) throws Throwable { <ide> invokeAdviceMethod(getJoinPointMatch(), null, null); <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> return true; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> return false; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java <ide> public void setOrder(int order) { <ide> } <ide> <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> return true; <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> return this.advice; <ide> } <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> if (this.order != null) { <ide> return this.order; <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java <ide> public class AspectJWeaverMessageHandler implements IMessageHandler { <ide> private static final Log LOGGER = LogFactory.getLog("AspectJ Weaver"); <ide> <ide> <add> @Override <ide> public boolean handleMessage(IMessage message) throws AbortException { <ide> Kind messageKind = message.getKind(); <ide> <ide> private String makeMessageFor(IMessage aMessage) { <ide> return AJ_ID + aMessage.getMessage(); <ide> } <ide> <add> @Override <ide> public boolean isIgnoring(Kind messageKind) { <ide> // We want to see everything, and allow configuration of log levels dynamically. <ide> return false; <ide> } <ide> <add> @Override <ide> public void dontIgnore(Kind messageKind) { <ide> // We weren't ignoring anything anyway... <ide> } <ide> <add> @Override <ide> public void ignore(Kind kind) { <ide> // We weren't ignoring anything anyway... <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/DeclareParentsAdvisor.java <ide> private DeclareParentsAdvisor(Class interfaceType, String typePattern, Class imp <ide> <ide> // Excludes methods implemented. <ide> ClassFilter exclusion = new ClassFilter() { <add> @Override <ide> public boolean matches(Class clazz) { <ide> return !(introducedInterface.isAssignableFrom(clazz)); <ide> } <ide> public boolean matches(Class clazz) { <ide> } <ide> <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this.typePatternClassFilter; <ide> } <ide> <add> @Override <ide> public void validateInterfaces() throws IllegalArgumentException { <ide> // Do nothing <ide> } <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> return true; <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> return this.advice; <ide> } <ide> <add> @Override <ide> public Class[] getInterfaces() { <ide> return new Class[] {this.introducedInterface}; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java <ide> public MethodInvocationProceedingJoinPoint(ProxyMethodInvocation methodInvocatio <ide> this.methodInvocation = methodInvocation; <ide> } <ide> <add> @Override <ide> public void set$AroundClosure(AroundClosure aroundClosure) { <ide> throw new UnsupportedOperationException(); <ide> } <ide> <add> @Override <ide> public Object proceed() throws Throwable { <ide> return this.methodInvocation.invocableClone().proceed(); <ide> } <ide> <add> @Override <ide> public Object proceed(Object[] arguments) throws Throwable { <ide> Assert.notNull(arguments, "Argument array passed to proceed cannot be null"); <ide> if (arguments.length != this.methodInvocation.getArguments().length) { <ide> public Object proceed(Object[] arguments) throws Throwable { <ide> /** <ide> * Returns the Spring AOP proxy. Cannot be {@code null}. <ide> */ <add> @Override <ide> public Object getThis() { <ide> return this.methodInvocation.getProxy(); <ide> } <ide> <ide> /** <ide> * Returns the Spring AOP target. May be {@code null} if there is no target. <ide> */ <add> @Override <ide> public Object getTarget() { <ide> return this.methodInvocation.getThis(); <ide> } <ide> <add> @Override <ide> public Object[] getArgs() { <ide> if (this.defensiveCopyOfArgs == null) { <ide> Object[] argsSource = this.methodInvocation.getArguments(); <ide> public Object[] getArgs() { <ide> return this.defensiveCopyOfArgs; <ide> } <ide> <add> @Override <ide> public Signature getSignature() { <ide> if (this.signature == null) { <ide> this.signature = new MethodSignatureImpl(); <ide> } <ide> return signature; <ide> } <ide> <add> @Override <ide> public SourceLocation getSourceLocation() { <ide> if (this.sourceLocation == null) { <ide> this.sourceLocation = new SourceLocationImpl(); <ide> } <ide> return this.sourceLocation; <ide> } <ide> <add> @Override <ide> public String getKind() { <ide> return ProceedingJoinPoint.METHOD_EXECUTION; <ide> } <ide> <add> @Override <ide> public int getId() { <ide> // TODO: It's just an adapter but returning 0 might still have side effects... <ide> return 0; <ide> } <ide> <add> @Override <ide> public JoinPoint.StaticPart getStaticPart() { <ide> return this; <ide> } <ide> <add> @Override <ide> public String toShortString() { <ide> return "execution(" + getSignature().toShortString() + ")"; <ide> } <ide> <add> @Override <ide> public String toLongString() { <ide> return "execution(" + getSignature().toLongString() + ")"; <ide> } <ide> private class MethodSignatureImpl implements MethodSignature { <ide> <ide> private volatile String[] parameterNames; <ide> <add> @Override <ide> public String getName() { <ide> return methodInvocation.getMethod().getName(); <ide> } <ide> <add> @Override <ide> public int getModifiers() { <ide> return methodInvocation.getMethod().getModifiers(); <ide> } <ide> <add> @Override <ide> public Class getDeclaringType() { <ide> return methodInvocation.getMethod().getDeclaringClass(); <ide> } <ide> <add> @Override <ide> public String getDeclaringTypeName() { <ide> return methodInvocation.getMethod().getDeclaringClass().getName(); <ide> } <ide> <add> @Override <ide> public Class getReturnType() { <ide> return methodInvocation.getMethod().getReturnType(); <ide> } <ide> <add> @Override <ide> public Method getMethod() { <ide> return methodInvocation.getMethod(); <ide> } <ide> <add> @Override <ide> public Class[] getParameterTypes() { <ide> return methodInvocation.getMethod().getParameterTypes(); <ide> } <ide> <add> @Override <ide> public String[] getParameterNames() { <ide> if (this.parameterNames == null) { <ide> this.parameterNames = (new LocalVariableTableParameterNameDiscoverer()).getParameterNames(getMethod()); <ide> } <ide> return this.parameterNames; <ide> } <ide> <add> @Override <ide> public Class[] getExceptionTypes() { <ide> return methodInvocation.getMethod().getExceptionTypes(); <ide> } <ide> <add> @Override <ide> public String toShortString() { <ide> return toString(false, false, false, false); <ide> } <ide> <add> @Override <ide> public String toLongString() { <ide> return toString(true, true, true, true); <ide> } <ide> private void appendType(StringBuilder sb, Class<?> type, boolean useLongTypeName <ide> */ <ide> private class SourceLocationImpl implements SourceLocation { <ide> <add> @Override <ide> public Class getWithinType() { <ide> if (methodInvocation.getThis() == null) { <ide> throw new UnsupportedOperationException("No source location joinpoint available: target is null"); <ide> } <ide> return methodInvocation.getThis().getClass(); <ide> } <ide> <add> @Override <ide> public String getFileName() { <ide> throw new UnsupportedOperationException(); <ide> } <ide> <add> @Override <ide> public int getLine() { <ide> throw new UnsupportedOperationException(); <ide> } <ide> <add> @Override <ide> public int getColumn() { <ide> throw new UnsupportedOperationException(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java <ide> private static class TestVisitorAdapter implements ITestVisitor { <ide> protected static final int AT_TARGET_VAR = 4; <ide> protected static final int AT_ANNOTATION_VAR = 8; <ide> <add> @Override <ide> public void visit(And e) { <ide> e.getLeft().accept(this); <ide> e.getRight().accept(this); <ide> } <ide> <add> @Override <ide> public void visit(Or e) { <ide> e.getLeft().accept(this); <ide> e.getRight().accept(this); <ide> } <ide> <add> @Override <ide> public void visit(Not e) { <ide> e.getBody().accept(this); <ide> } <ide> <add> @Override <ide> public void visit(Instanceof i) { <ide> } <ide> <add> @Override <ide> public void visit(Literal literal) { <ide> } <ide> <add> @Override <ide> public void visit(Call call) { <ide> } <ide> <add> @Override <ide> public void visit(FieldGetCall fieldGetCall) { <ide> } <ide> <add> @Override <ide> public void visit(HasAnnotation hasAnnotation) { <ide> } <ide> <add> @Override <ide> public void visit(MatchingContextBasedTest matchingContextTest) { <ide> } <ide> <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java <ide> public final Class getAspectClass() { <ide> } <ide> <ide> <add> @Override <ide> public final Object getAspectInstance() { <ide> try { <ide> return this.aspectClass.newInstance(); <ide> public final Object getAspectInstance() { <ide> } <ide> } <ide> <add> @Override <ide> public ClassLoader getAspectClassLoader() { <ide> return this.aspectClass.getClassLoader(); <ide> } <ide> public ClassLoader getAspectClassLoader() { <ide> * @see org.springframework.core.Ordered <ide> * @see #getOrderForAspectClass <ide> */ <add> @Override <ide> public int getOrder() { <ide> return getOrderForAspectClass(this.aspectClass); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/SingletonAspectInstanceFactory.java <ide> public SingletonAspectInstanceFactory(Object aspectInstance) { <ide> } <ide> <ide> <add> @Override <ide> public final Object getAspectInstance() { <ide> return this.aspectInstance; <ide> } <ide> <add> @Override <ide> public ClassLoader getAspectClassLoader() { <ide> return this.aspectInstance.getClass().getClassLoader(); <ide> } <ide> public ClassLoader getAspectClassLoader() { <ide> * @see org.springframework.core.Ordered <ide> * @see #getOrderForAspectClass <ide> */ <add> @Override <ide> public int getOrder() { <ide> if (this.aspectInstance instanceof Ordered) { <ide> return ((Ordered) this.aspectInstance).getOrder(); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java <ide> public String getTypePattern() { <ide> * @return whether the advice should apply to this candidate target class <ide> * @throws IllegalStateException if no {@link #setTypePattern(String)} has been set <ide> */ <add> @Override <ide> public boolean matches(Class clazz) { <ide> if (this.aspectJTypePatternMatcher == null) { <ide> throw new IllegalStateException("No 'typePattern' has been set via ctor/setter."); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java <ide> protected AbstractAspectJAdvisorFactory() { <ide> * is that aspects written in the code-style (AspectJ language) also have the annotation present <ide> * when compiled by ajc with the -1.5 flag, yet they cannot be consumed by Spring AOP. <ide> */ <add> @Override <ide> public boolean isAspect(Class<?> clazz) { <ide> return (hasAspectAnnotation(clazz) && !compiledByAjc(clazz)); <ide> } <ide> private boolean compiledByAjc(Class<?> clazz) { <ide> return false; <ide> } <ide> <add> @Override <ide> public void validate(Class<?> aspectClass) throws AopConfigException { <ide> // If the parent has the annotation and isn't abstract it's an error <ide> if (aspectClass.getSuperclass().getAnnotation(Aspect.class) != null && <ide> public String toString() { <ide> */ <ide> private static class AspectJAnnotationParameterNameDiscoverer implements ParameterNameDiscoverer { <ide> <add> @Override <ide> public String[] getParameterNames(Method method) { <ide> if (method.getParameterTypes().length == 0) { <ide> return new String[0]; <ide> public String[] getParameterNames(Method method) { <ide> } <ide> } <ide> <add> @Override <ide> public String[] getParameterNames(Constructor ctor) { <ide> throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice"); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java <ide> public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Cl <ide> } <ide> <ide> <add> @Override <ide> public Object getAspectInstance() { <ide> return this.beanFactory.getBean(this.name); <ide> } <ide> <add> @Override <ide> public ClassLoader getAspectClassLoader() { <ide> if (this.beanFactory instanceof ConfigurableBeanFactory) { <ide> return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader(); <ide> public ClassLoader getAspectClassLoader() { <ide> } <ide> } <ide> <add> @Override <ide> public AspectMetadata getAspectMetadata() { <ide> return this.aspectMetadata; <ide> } <ide> public AspectMetadata getAspectMetadata() { <ide> * @see org.springframework.core.Ordered <ide> * @see org.springframework.core.annotation.Order <ide> */ <add> @Override <ide> public int getOrder() { <ide> Class<?> type = this.beanFactory.getType(this.name); <ide> if (type != null) { <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java <ide> public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, Asp <ide> * The pointcut for Spring AOP to use. Actual behaviour of the pointcut will change <ide> * depending on the state of the advice. <ide> */ <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide> public Pointcut getPointcut() { <ide> * are much richer. In AspectJ terminology, all a return of {@code true} <ide> * means here is that the aspect is not a SINGLETON. <ide> */ <add> @Override <ide> public boolean isPerInstance() { <ide> return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON); <ide> } <ide> public AspectMetadata getAspectMetadata() { <ide> /** <ide> * Lazily instantiate advice if necessary. <ide> */ <add> @Override <ide> public synchronized Advice getAdvice() { <ide> if (this.instantiatedAdvice == null) { <ide> this.instantiatedAdvice = instantiateAdvice(this.declaredPointcut); <ide> } <ide> return this.instantiatedAdvice; <ide> } <ide> <add> @Override <ide> public boolean isLazy() { <ide> return this.lazy; <ide> } <ide> <add> @Override <ide> public synchronized boolean isAdviceInstantiated() { <ide> return (this.instantiatedAdvice != null); <ide> } <ide> public AspectJExpressionPointcut getDeclaredPointcut() { <ide> return this.declaredPointcut; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.aspectInstanceFactory.getOrder(); <ide> } <ide> <add> @Override <ide> public String getAspectName() { <ide> return this.aspectName; <ide> } <ide> <add> @Override <ide> public int getDeclarationOrder() { <ide> return this.declarationOrder; <ide> } <ide> <add> @Override <ide> public boolean isBeforeAdvice() { <ide> if (this.isBeforeAdvice == null) { <ide> determineAdviceType(); <ide> } <ide> return this.isBeforeAdvice; <ide> } <ide> <add> @Override <ide> public boolean isAfterAdvice() { <ide> if (this.isAfterAdvice == null) { <ide> determineAdviceType(); <ide> public boolean matches(Method method, Class targetClass) { <ide> this.preInstantiationPointcut.getMethodMatcher().matches(method, targetClass); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> // This can match only on declared pointcut. <ide> return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/LazySingletonAspectInstanceFactoryDecorator.java <ide> public LazySingletonAspectInstanceFactoryDecorator(MetadataAwareAspectInstanceFa <ide> } <ide> <ide> <add> @Override <ide> public synchronized Object getAspectInstance() { <ide> if (this.materialized == null) { <ide> synchronized (this) { <ide> public boolean isMaterialized() { <ide> return (this.materialized != null); <ide> } <ide> <add> @Override <ide> public ClassLoader getAspectClassLoader() { <ide> return this.maaif.getAspectClassLoader(); <ide> } <ide> <add> @Override <ide> public AspectMetadata getAspectMetadata() { <ide> return this.maaif.getAspectMetadata(); <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.maaif.getOrder(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java <ide> public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto <ide> new InstanceComparator<Annotation>( <ide> Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class), <ide> new Converter<Method, Annotation>() { <add> @Override <ide> public Annotation convert(Method method) { <ide> AspectJAnnotation<?> annotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method); <ide> return annotation == null ? null : annotation.getAnnotation(); <ide> } <ide> })); <ide> comparator.addComparator(new ConvertingComparator<Method, String>( <ide> new Converter<Method, String>() { <add> @Override <ide> public String convert(Method method) { <ide> return method.getName(); <ide> } <ide> public String convert(Method method) { <ide> } <ide> <ide> <add> @Override <ide> public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory maaif) { <ide> final Class<?> aspectClass = maaif.getAspectMetadata().getAspectClass(); <ide> final String aspectName = maaif.getAspectMetadata().getAspectName(); <ide> public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory maaif) { <ide> private List<Method> getAdvisorMethods(Class<?> aspectClass) { <ide> final List<Method> methods = new LinkedList<Method>(); <ide> ReflectionUtils.doWithMethods(aspectClass, new ReflectionUtils.MethodCallback() { <add> @Override <ide> public void doWith(Method method) throws IllegalArgumentException { <ide> // Exclude pointcuts <ide> if (AnnotationUtils.getAnnotation(method, Pointcut.class) == null) { <ide> private Advisor getDeclareParentsAdvisor(Field introductionField) { <ide> } <ide> <ide> <add> @Override <ide> public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aif, <ide> int declarationOrderInAspect, String aspectName) { <ide> <ide> private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Clas <ide> } <ide> <ide> <add> @Override <ide> public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut ajexp, <ide> MetadataAwareAspectInstanceFactory aif, int declarationOrderInAspect, String aspectName) { <ide> <ide> protected static class SyntheticInstantiationAdvisor extends DefaultPointcutAdvi <ide> <ide> public SyntheticInstantiationAdvisor(final MetadataAwareAspectInstanceFactory aif) { <ide> super(aif.getAspectMetadata().getPerClausePointcut(), new MethodBeforeAdvice() { <add> @Override <ide> public void before(Method method, Object[] args, Object target) { <ide> // Simply instantiate the aspect <ide> aif.getAspectInstance(); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java <ide> public SimpleMetadataAwareAspectInstanceFactory(Class aspectClass, String aspect <ide> } <ide> <ide> <add> @Override <ide> public final AspectMetadata getAspectMetadata() { <ide> return this.metadata; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SingletonMetadataAwareAspectInstanceFactory.java <ide> public SingletonMetadataAwareAspectInstanceFactory(Object aspectInstance, String <ide> } <ide> <ide> <add> @Override <ide> public final AspectMetadata getAspectMetadata() { <ide> return this.metadata; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java <ide> public PartiallyComparableAdvisorHolder(Advisor advisor, Comparator<Advisor> com <ide> this.comparator = comparator; <ide> } <ide> <add> @Override <ide> public int compareTo(Object obj) { <ide> Advisor otherAdvisor = ((PartiallyComparableAdvisorHolder) obj).advisor; <ide> return this.comparator.compare(this.advisor, otherAdvisor); <ide> } <ide> <add> @Override <ide> public int fallbackCompareTo(Object obj) { <ide> return 0; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java <ide> public AspectJPrecedenceComparator(Comparator<? super Advisor> advisorComparator <ide> } <ide> <ide> <add> @Override <ide> public int compare(Object o1, Object o2) { <ide> if (!(o1 instanceof Advisor && o2 instanceof Advisor)) { <ide> throw new IllegalArgumentException( <ide><path>spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java <ide> */ <ide> public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implements BeanDefinitionDecorator { <ide> <add> @Override <ide> public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definitionHolder, ParserContext parserContext) { <ide> BeanDefinitionRegistry registry = parserContext.getRegistry(); <ide> <ide><path>spring-aop/src/main/java/org/springframework/aop/config/AdvisorComponentDefinition.java <ide> private String buildDescription(BeanReference adviceReference, BeanReference poi <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.advisorBeanName; <ide> } <ide> public BeanReference[] getBeanReferences() { <ide> return this.beanReferences; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.advisorDefinition.getSource(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceHandler.java <ide> public class AopNamespaceHandler extends NamespaceHandlerSupport { <ide> * '{@code config}', '{@code spring-configured}', '{@code aspectj-autoproxy}' <ide> * and '{@code scoped-proxy}' tags. <ide> */ <add> @Override <ide> public void init() { <ide> // In 2.0 XSD as well as in 2.1 XSD. <ide> registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser()); <ide><path>spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java <ide> */ <ide> class AspectJAutoProxyBeanDefinitionParser implements BeanDefinitionParser { <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> AopNamespaceUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(parserContext, element); <ide> extendBeanDefinition(element, parserContext); <ide><path>spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java <ide> class ConfigBeanDefinitionParser implements BeanDefinitionParser { <ide> private ParseState parseState = new ParseState(); <ide> <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> CompositeComponentDefinition compositeDef = <ide> new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element)); <ide><path>spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java <ide> public void setMethodName(String methodName) { <ide> this.methodName = methodName; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (!StringUtils.hasText(this.targetBeanName)) { <ide> throw new IllegalArgumentException("Property 'targetBeanName' is required"); <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> } <ide> <ide> <add> @Override <ide> public Method getObject() throws Exception { <ide> return this.method; <ide> } <ide> <add> @Override <ide> public Class<Method> getObjectType() { <ide> return Method.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/config/PointcutComponentDefinition.java <ide> public PointcutComponentDefinition(String pointcutBeanName, BeanDefinition point <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.pointcutBeanName; <ide> } <ide> public BeanDefinition[] getBeanDefinitions() { <ide> return new BeanDefinition[] {this.pointcutDefinition}; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.pointcutDefinition.getSource(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java <ide> class ScopedProxyBeanDefinitionDecorator implements BeanDefinitionDecorator { <ide> private static final String PROXY_TARGET_CLASS = "proxy-target-class"; <ide> <ide> <add> @Override <ide> public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) { <ide> boolean proxyTargetClass = true; <ide> if (node instanceof Element) { <ide><path>spring-aop/src/main/java/org/springframework/aop/config/SimpleBeanFactoryAwareAspectInstanceFactory.java <ide> public void setAspectBeanName(String aspectBeanName) { <ide> this.aspectBeanName = aspectBeanName; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> if (!StringUtils.hasText(this.aspectBeanName)) { <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> * Look up the aspect bean from the {@link BeanFactory} and returns it. <ide> * @see #setAspectBeanName <ide> */ <add> @Override <ide> public Object getAspectInstance() { <ide> return this.beanFactory.getBean(this.aspectBeanName); <ide> } <ide> <add> @Override <ide> public ClassLoader getAspectClassLoader() { <ide> if (this.beanFactory instanceof ConfigurableBeanFactory) { <ide> return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader(); <ide> public ClassLoader getAspectClassLoader() { <ide> } <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> if (this.beanFactory.isSingleton(this.aspectBeanName) && <ide> this.beanFactory.isTypeMatch(this.aspectBeanName, Ordered.class)) { <ide><path>spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java <ide> class SpringConfiguredBeanDefinitionParser implements BeanDefinitionParser { <ide> "org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"; <ide> <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) { <ide> RootBeanDefinition def = new RootBeanDefinition(); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor.java <ide> public abstract class AbstractAdvisingBeanPostProcessor extends ProxyConfig <ide> private final Map<String, Boolean> eligibleBeans = new ConcurrentHashMap<String, Boolean>(64); <ide> <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) { <ide> if (bean instanceof AopInfrastructureBean) { <ide> // Ignore AOP infrastructure such as scoped proxies. <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java <ide> public void setProxyClassLoader(ClassLoader classLoader) { <ide> this.proxyClassLoader = classLoader; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> if (this.proxyClassLoader == null) { <ide> this.proxyClassLoader = classLoader; <ide> } <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.target == null) { <ide> throw new IllegalArgumentException("Property 'target' is required"); <ide> protected TargetSource createTargetSource(Object target) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() { <ide> if (this.proxy == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> } <ide> return this.proxy; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> if (this.proxy != null) { <ide> return this.proxy.getClass(); <ide> public Class<?> getObjectType() { <ide> return null; <ide> } <ide> <add> @Override <ide> public final boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java <ide> public void setTarget(Object target) { <ide> setTargetSource(new SingletonTargetSource(target)); <ide> } <ide> <add> @Override <ide> public void setTargetSource(TargetSource targetSource) { <ide> this.targetSource = (targetSource != null ? targetSource : EMPTY_TARGET_SOURCE); <ide> } <ide> <add> @Override <ide> public TargetSource getTargetSource() { <ide> return this.targetSource; <ide> } <ide> public void setTargetClass(Class targetClass) { <ide> this.targetSource = EmptyTargetSource.forClass(targetClass); <ide> } <ide> <add> @Override <ide> public Class<?> getTargetClass() { <ide> return this.targetSource.getTargetClass(); <ide> } <ide> <add> @Override <ide> public void setPreFiltered(boolean preFiltered) { <ide> this.preFiltered = preFiltered; <ide> } <ide> <add> @Override <ide> public boolean isPreFiltered() { <ide> return this.preFiltered; <ide> } <ide> public boolean removeInterface(Class intf) { <ide> return this.interfaces.remove(intf); <ide> } <ide> <add> @Override <ide> public Class[] getProxiedInterfaces() { <ide> return this.interfaces.toArray(new Class[this.interfaces.size()]); <ide> } <ide> <add> @Override <ide> public boolean isInterfaceProxied(Class intf) { <ide> for (Class proxyIntf : this.interfaces) { <ide> if (intf.isAssignableFrom(proxyIntf)) { <ide> public boolean isInterfaceProxied(Class intf) { <ide> } <ide> <ide> <add> @Override <ide> public final Advisor[] getAdvisors() { <ide> return this.advisorArray; <ide> } <ide> <add> @Override <ide> public void addAdvisor(Advisor advisor) { <ide> int pos = this.advisors.size(); <ide> addAdvisor(pos, advisor); <ide> } <ide> <add> @Override <ide> public void addAdvisor(int pos, Advisor advisor) throws AopConfigException { <ide> if (advisor instanceof IntroductionAdvisor) { <ide> validateIntroductionAdvisor((IntroductionAdvisor) advisor); <ide> } <ide> addAdvisorInternal(pos, advisor); <ide> } <ide> <add> @Override <ide> public boolean removeAdvisor(Advisor advisor) { <ide> int index = indexOf(advisor); <ide> if (index == -1) { <ide> public boolean removeAdvisor(Advisor advisor) { <ide> } <ide> } <ide> <add> @Override <ide> public void removeAdvisor(int index) throws AopConfigException { <ide> if (isFrozen()) { <ide> throw new AopConfigException("Cannot remove Advisor: Configuration is frozen."); <ide> public void removeAdvisor(int index) throws AopConfigException { <ide> adviceChanged(); <ide> } <ide> <add> @Override <ide> public int indexOf(Advisor advisor) { <ide> Assert.notNull(advisor, "Advisor must not be null"); <ide> return this.advisors.indexOf(advisor); <ide> } <ide> <add> @Override <ide> public boolean replaceAdvisor(Advisor a, Advisor b) throws AopConfigException { <ide> Assert.notNull(a, "Advisor a must not be null"); <ide> Assert.notNull(b, "Advisor b must not be null"); <ide> protected final List<Advisor> getAdvisorsInternal() { <ide> } <ide> <ide> <add> @Override <ide> public void addAdvice(Advice advice) throws AopConfigException { <ide> int pos = this.advisors.size(); <ide> addAdvice(pos, advice); <ide> public void addAdvice(Advice advice) throws AopConfigException { <ide> /** <ide> * Cannot add introductions this way unless the advice implements IntroductionInfo. <ide> */ <add> @Override <ide> public void addAdvice(int pos, Advice advice) throws AopConfigException { <ide> Assert.notNull(advice, "Advice must not be null"); <ide> if (advice instanceof IntroductionInfo) { <ide> else if (advice instanceof DynamicIntroductionAdvice) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean removeAdvice(Advice advice) throws AopConfigException { <ide> int index = indexOf(advice); <ide> if (index == -1) { <ide> public boolean removeAdvice(Advice advice) throws AopConfigException { <ide> } <ide> } <ide> <add> @Override <ide> public int indexOf(Advice advice) { <ide> Assert.notNull(advice, "Advice must not be null"); <ide> for (int i = 0; i < this.advisors.size(); i++) { <ide> private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound <ide> } <ide> <ide> <add> @Override <ide> public String toProxyConfigString() { <ide> return toString(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java <ide> public void setConstructorArguments(Object[] constructorArgs, Class<?>[] constru <ide> } <ide> <ide> <add> @Override <ide> public Object getProxy() { <ide> return getProxy(null); <ide> } <ide> <add> @Override <ide> public Object getProxy(ClassLoader classLoader) { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Creating CGLIB proxy: target source is " + this.advised.getTargetSource()); <ide> public StaticUnadvisedInterceptor(Object target) { <ide> this.target = target; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> Object retVal = methodProxy.invoke(this.target, args); <ide> return processReturnType(proxy, this.target, method, retVal); <ide> public StaticUnadvisedExposedInterceptor(Object target) { <ide> this.target = target; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> Object oldProxy = null; <ide> try { <ide> public DynamicUnadvisedInterceptor(TargetSource targetSource) { <ide> this.targetSource = targetSource; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> Object target = this.targetSource.getTarget(); <ide> try { <ide> public DynamicUnadvisedExposedInterceptor(TargetSource targetSource) { <ide> this.targetSource = targetSource; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> Object oldProxy = null; <ide> Object target = this.targetSource.getTarget(); <ide> public StaticDispatcher(Object target) { <ide> this.target = target; <ide> } <ide> <add> @Override <ide> public Object loadObject() { <ide> return this.target; <ide> } <ide> public AdvisedDispatcher(AdvisedSupport advised) { <ide> this.advised = advised; <ide> } <ide> <add> @Override <ide> public Object loadObject() throws Exception { <ide> return this.advised; <ide> } <ide> public EqualsInterceptor(AdvisedSupport advised) { <ide> this.advised = advised; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) { <ide> Object other = args[0]; <ide> if (proxy == other) { <ide> public HashCodeInterceptor(AdvisedSupport advised) { <ide> this.advised = advised; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) { <ide> return CglibAopProxy.class.hashCode() * 13 + this.advised.getTargetSource().hashCode(); <ide> } <ide> public FixedChainStaticTargetInterceptor(List<Object> adviceChain, Object target <ide> this.targetClass = targetClass; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args, <ide> this.targetClass, this.adviceChain, methodProxy); <ide> public DynamicAdvisedInterceptor(AdvisedSupport advised) { <ide> this.advised = advised; <ide> } <ide> <add> @Override <ide> public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { <ide> Object oldProxy = null; <ide> boolean setProxyContext = false; <ide> public ProxyCallbackFilter(AdvisedSupport advised, Map<String, Integer> fixedInt <ide> * DynamicUnadvisedInterceptor already considers this.</dd> <ide> * </dl> <ide> */ <add> @Override <ide> public int accept(Method method) { <ide> if (AopUtils.isFinalizeMethod(method)) { <ide> logger.debug("Found finalize() method - using NO_OVERRIDE"); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java <ide> @SuppressWarnings("serial") <ide> public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializable { <ide> <add> @Override <ide> public List<Object> getInterceptorsAndDynamicInterceptionAdvice( <ide> Advised config, Method method, Class targetClass) { <ide> <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java <ide> public class DefaultAopProxyFactory implements AopProxyFactory, Serializable { <ide> <ide> <add> @Override <ide> public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException { <ide> if (config.isOptimize() || config.isProxyTargetClass() || hasNoUserSuppliedProxyInterfaces(config)) { <ide> Class targetClass = config.getTargetClass(); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java <ide> public JdkDynamicAopProxy(AdvisedSupport config) throws AopConfigException { <ide> } <ide> <ide> <add> @Override <ide> public Object getProxy() { <ide> return getProxy(ClassUtils.getDefaultClassLoader()); <ide> } <ide> <add> @Override <ide> public Object getProxy(ClassLoader classLoader) { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource()); <ide> private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) { <ide> * <p>Callers will see exactly the exception thrown by the target, <ide> * unless a hook method throws an exception. <ide> */ <add> @Override <ide> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { <ide> MethodInvocation invocation; <ide> Object oldProxy = null; <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java <ide> public void setProxyClassLoader(ClassLoader classLoader) { <ide> this.classLoaderConfigured = (classLoader != null); <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> if (!this.classLoaderConfigured) { <ide> this.proxyClassLoader = classLoader; <ide> } <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> checkInterceptorNames(); <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> * {@code getObject()} for a proxy. <ide> * @return a fresh AOP proxy reflecting the current state of this factory <ide> */ <add> @Override <ide> public Object getObject() throws BeansException { <ide> initializeAdvisorChain(); <ide> if (isSingleton()) { <ide> public Object getObject() throws BeansException { <ide> * a single one), the target bean type, or the TargetSource's target class. <ide> * @see org.springframework.aop.TargetSource#getTargetClass <ide> */ <add> @Override <ide> public Class<?> getObjectType() { <ide> synchronized (this) { <ide> if (this.singletonInstance != null) { <ide> else if (this.targetName != null && this.beanFactory != null) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return this.singleton; <ide> } <ide> public String getBeanName() { <ide> return beanName; <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> throw new UnsupportedOperationException("Cannot invoke methods: " + this.message); <ide> } <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> throw new UnsupportedOperationException("Cannot invoke methods: " + this.message); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java <ide> protected ReflectiveMethodInvocation( <ide> } <ide> <ide> <add> @Override <ide> public final Object getProxy() { <ide> return this.proxy; <ide> } <ide> <add> @Override <ide> public final Object getThis() { <ide> return this.target; <ide> } <ide> <add> @Override <ide> public final AccessibleObject getStaticPart() { <ide> return this.method; <ide> } <ide> public final AccessibleObject getStaticPart() { <ide> * May or may not correspond with a method invoked on an underlying <ide> * implementation of that interface. <ide> */ <add> @Override <ide> public final Method getMethod() { <ide> return this.method; <ide> } <ide> <add> @Override <ide> public final Object[] getArguments() { <ide> return (this.arguments != null ? this.arguments : new Object[0]); <ide> } <ide> <add> @Override <ide> public void setArguments(Object[] arguments) { <ide> this.arguments = arguments; <ide> } <ide> <ide> <add> @Override <ide> public Object proceed() throws Throwable { <ide> // We start with an index of -1 and increment early. <ide> if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) { <ide> protected Object invokeJoinpoint() throws Throwable { <ide> * current interceptor index. <ide> * @see java.lang.Object#clone() <ide> */ <add> @Override <ide> public MethodInvocation invocableClone() { <ide> Object[] cloneArguments = null; <ide> if (this.arguments != null) { <ide> public MethodInvocation invocableClone() { <ide> * current interceptor index. <ide> * @see java.lang.Object#clone() <ide> */ <add> @Override <ide> public MethodInvocation invocableClone(Object[] arguments) { <ide> // Force initialization of the user attributes Map, <ide> // for having a shared Map reference in the clone. <ide> public MethodInvocation invocableClone(Object[] arguments) { <ide> } <ide> <ide> <add> @Override <ide> public void setUserAttribute(String key, Object value) { <ide> if (value != null) { <ide> if (this.userAttributes == null) { <ide> public void setUserAttribute(String key, Object value) { <ide> } <ide> } <ide> <add> @Override <ide> public Object getUserAttribute(String key) { <ide> return (this.userAttributes != null ? this.userAttributes.get(key) : null); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationManager.java <ide> public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegis <ide> } <ide> <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <ide> if (bean instanceof AdvisorAdapter){ <ide> this.advisorAdapterRegistry.registerAdvisorAdapter((AdvisorAdapter) bean); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java <ide> @SuppressWarnings("serial") <ide> class AfterReturningAdviceAdapter implements AdvisorAdapter, Serializable { <ide> <add> @Override <ide> public boolean supportsAdvice(Advice advice) { <ide> return (advice instanceof AfterReturningAdvice); <ide> } <ide> <add> @Override <ide> public MethodInterceptor getInterceptor(Advisor advisor) { <ide> AfterReturningAdvice advice = (AfterReturningAdvice) advisor.getAdvice(); <ide> return new AfterReturningAdviceInterceptor(advice); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java <ide> public AfterReturningAdviceInterceptor(AfterReturningAdvice advice) { <ide> this.advice = advice; <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> Object retVal = mi.proceed(); <ide> this.advice.afterReturning(retVal, mi.getMethod(), mi.getArguments(), mi.getThis()); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java <ide> public DefaultAdvisorAdapterRegistry() { <ide> } <ide> <ide> <add> @Override <ide> public Advisor wrap(Object adviceObject) throws UnknownAdviceTypeException { <ide> if (adviceObject instanceof Advisor) { <ide> return (Advisor) adviceObject; <ide> public Advisor wrap(Object adviceObject) throws UnknownAdviceTypeException { <ide> throw new UnknownAdviceTypeException(advice); <ide> } <ide> <add> @Override <ide> public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException { <ide> List<MethodInterceptor> interceptors = new ArrayList<MethodInterceptor>(3); <ide> Advice advice = advisor.getAdvice(); <ide> public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdvice <ide> return interceptors.toArray(new MethodInterceptor[interceptors.size()]); <ide> } <ide> <add> @Override <ide> public void registerAdvisorAdapter(AdvisorAdapter adapter) { <ide> this.adapters.add(adapter); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java <ide> @SuppressWarnings("serial") <ide> class MethodBeforeAdviceAdapter implements AdvisorAdapter, Serializable { <ide> <add> @Override <ide> public boolean supportsAdvice(Advice advice) { <ide> return (advice instanceof MethodBeforeAdvice); <ide> } <ide> <add> @Override <ide> public MethodInterceptor getInterceptor(Advisor advisor) { <ide> MethodBeforeAdvice advice = (MethodBeforeAdvice) advisor.getAdvice(); <ide> return new MethodBeforeAdviceInterceptor(advice); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java <ide> public MethodBeforeAdviceInterceptor(MethodBeforeAdvice advice) { <ide> this.advice = advice; <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> this.advice.before(mi.getMethod(), mi.getArguments(), mi.getThis() ); <ide> return mi.proceed(); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java <ide> @SuppressWarnings("serial") <ide> class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable { <ide> <add> @Override <ide> public boolean supportsAdvice(Advice advice) { <ide> return (advice instanceof ThrowsAdvice); <ide> } <ide> <add> @Override <ide> public MethodInterceptor getInterceptor(Advisor advisor) { <ide> return new ThrowsAdviceInterceptor(advisor.getAdvice()); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java <ide> private Method getExceptionHandler(Throwable exception) { <ide> return handler; <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> try { <ide> return mi.proceed(); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java <ide> public final void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public final int getOrder() { <ide> return this.order; <ide> } <ide> public void setProxyClassLoader(ClassLoader classLoader) { <ide> this.classLoaderConfigured = (classLoader != null); <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> if (!this.classLoaderConfigured) { <ide> this.proxyClassLoader = classLoader; <ide> } <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> protected BeanFactory getBeanFactory() { <ide> } <ide> <ide> <add> @Override <ide> public Class<?> predictBeanType(Class<?> beanClass, String beanName) { <ide> Object cacheKey = getCacheKey(beanClass, beanName); <ide> return this.proxyTypes.get(cacheKey); <ide> } <ide> <add> @Override <ide> public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { <ide> Object cacheKey = getCacheKey(bean.getClass(), beanName); <ide> this.earlyProxyReferences.put(cacheKey, Boolean.TRUE); <ide> return wrapIfNecessary(bean, beanName, cacheKey); <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException { <ide> Object cacheKey = getCacheKey(beanClass, beanName); <ide> <ide> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName <ide> return null; <ide> } <ide> <add> @Override <ide> public boolean postProcessAfterInstantiation(Object bean, String beanName) { <ide> return true; <ide> } <ide> <add> @Override <ide> public PropertyValues postProcessPropertyValues( <ide> PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) { <ide> <ide> return pvs; <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> return bean; <ide> } <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> * identified as one to proxy by the subclass. <ide> * @see #getAdvicesAndAdvisorsForBean <ide> */ <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <ide> if (bean != null) { <ide> Object cacheKey = getCacheKey(bean.getClass(), beanName); <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java <ide> public String getAdvisorBeanNamePrefix() { <ide> return this.advisorBeanNamePrefix; <ide> } <ide> <add> @Override <ide> public void setBeanName(String name) { <ide> // If no infrastructure bean name prefix has been set, override it. <ide> if (this.advisorBeanNamePrefix == null) { <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java <ide> new HashMap<String, DefaultListableBeanFactory>(); <ide> <ide> <add> @Override <ide> public final void setBeanFactory(BeanFactory beanFactory) { <ide> if (!(beanFactory instanceof ConfigurableBeanFactory)) { <ide> throw new IllegalStateException("Cannot do auto-TargetSource creation with a BeanFactory " + <ide> protected final BeanFactory getBeanFactory() { <ide> // Implementation of the TargetSourceCreator interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public final TargetSource getTargetSource(Class<?> beanClass, String beanName) { <ide> AbstractBeanFactoryBasedTargetSource targetSource = <ide> createBeanFactoryBasedTargetSource(beanClass, beanName); <ide> protected DefaultListableBeanFactory buildInternalBeanFactory(ConfigurableBeanFa <ide> * Destroys the internal BeanFactory on shutdown of the TargetSourceCreator. <ide> * @see #getInternalBeanFactoryForBean <ide> */ <add> @Override <ide> public void destroy() { <ide> synchronized (this.internalBeanFactories) { <ide> for (DefaultListableBeanFactory bf : this.internalBeanFactories.values()) { <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java <ide> public void setHideProxyClassNames(boolean hideProxyClassNames) { <ide> * to the {@code invokeUnderTrace} method for handling. <ide> * @see #invokeUnderTrace(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log) <ide> */ <add> @Override <ide> public Object invoke(MethodInvocation invocation) throws Throwable { <ide> Log logger = getLoggerForInvocation(invocation); <ide> if (isInterceptorEnabled(invocation, logger)) { <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java <ide> public void setExecutor(Executor defaultExecutor) { <ide> /** <ide> * Set the {@link BeanFactory} to be used when looking up executors by qualifier. <ide> */ <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> this.beanFactory = beanFactory; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionInterceptor.java <ide> public AsyncExecutionInterceptor(Executor executor) { <ide> * @return {@link Future} if the original method returns {@code Future}; {@code null} <ide> * otherwise. <ide> */ <add> @Override <ide> public Object invoke(final MethodInvocation invocation) throws Throwable { <ide> Future<?> result = this.determineAsyncExecutor(invocation.getMethod()).submit( <ide> new Callable<Object>() { <add> @Override <ide> public Object call() throws Exception { <ide> try { <ide> Object result = invocation.proceed(); <ide> protected String getExecutorQualifier(Method method) { <ide> return null; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return Ordered.HIGHEST_PRECEDENCE; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java <ide> public ConcurrencyThrottleInterceptor() { <ide> setConcurrencyLimit(1); <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation methodInvocation) throws Throwable { <ide> beforeAccess(); <ide> try { <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java <ide> public ExposeBeanNameInterceptor(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> if (!(mi instanceof ProxyMethodInvocation)) { <ide> throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> return super.invoke(mi); <ide> } <ide> <add> @Override <ide> public String getBeanName() { <ide> return this.beanName; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java <ide> public static MethodInvocation currentInvocation() throws IllegalStateException <ide> private ExposeInvocationInterceptor() { <ide> } <ide> <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> MethodInvocation oldInvocation = invocation.get(); <ide> invocation.set(mi); <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> } <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return Ordered.HIGHEST_PRECEDENCE + 1; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java <ide> public DefaultScopedObject(ConfigurableBeanFactory beanFactory, String targetBea <ide> } <ide> <ide> <add> @Override <ide> public Object getTargetObject() { <ide> return this.beanFactory.getBean(this.targetBeanName); <ide> } <ide> <add> @Override <ide> public void removeFromScope() { <ide> this.beanFactory.destroyScopedBean(this.targetBeanName); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java <ide> public void setTargetBeanName(String targetBeanName) { <ide> this.scopedTargetSource.setTargetBeanName(targetBeanName); <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (!(beanFactory instanceof ConfigurableBeanFactory)) { <ide> throw new IllegalStateException("Not running in a ConfigurableBeanFactory: " + beanFactory); <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() { <ide> if (this.proxy == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> } <ide> return this.proxy; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> if (this.proxy != null) { <ide> return this.proxy.getClass(); <ide> public Class<?> getObjectType() { <ide> return null; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java <ide> public String getAdviceBeanName() { <ide> return this.adviceBeanName; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> public void setAdvice(Advice advice) { <ide> } <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> synchronized (this.adviceMonitor) { <ide> if (this.advice == null && this.adviceBeanName != null) { <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractExpressionPointcut.java <ide> protected void onSetExpression(String expression) throws IllegalArgumentExceptio <ide> /** <ide> * Return this pointcut's expression. <ide> */ <add> @Override <ide> public String getExpression() { <ide> return this.expression; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractGenericPointcutAdvisor.java <ide> public void setAdvice(Advice advice) { <ide> this.advice = advice; <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> return this.advice; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> if (this.order != null) { <ide> return this.order; <ide> public int getOrder() { <ide> return Ordered.LOWEST_PRECEDENCE; <ide> } <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java <ide> public String[] getExcludedPatterns() { <ide> * of the target class as well as against the method's declaring class, <ide> * plus the name of the method. <ide> */ <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) || <ide> matchesPattern(method.getDeclaringClass().getName() + "." + method.getName())); <ide><path>spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java <ide> public UnionClassFilter(ClassFilter[] filters) { <ide> this.filters = filters; <ide> } <ide> <add> @Override <ide> public boolean matches(Class clazz) { <ide> for (int i = 0; i < this.filters.length; i++) { <ide> if (this.filters[i].matches(clazz)) { <ide> public IntersectionClassFilter(ClassFilter[] filters) { <ide> this.filters = filters; <ide> } <ide> <add> @Override <ide> public boolean matches(Class clazz) { <ide> for (int i = 0; i < this.filters.length; i++) { <ide> if (!this.filters[i].matches(clazz)) { <ide><path>spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java <ide> public ComposablePointcut intersection(Pointcut other) { <ide> } <ide> <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this.classFilter; <ide> } <ide> <add> @Override <ide> public MethodMatcher getMethodMatcher() { <ide> return this.methodMatcher; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java <ide> public ControlFlowPointcut(Class clazz, String methodName) { <ide> /** <ide> * Subclasses can override this for greater filtering (and performance). <ide> */ <add> @Override <ide> public boolean matches(Class clazz) { <ide> return true; <ide> } <ide> public boolean matches(Class clazz) { <ide> * Subclasses can override this if it's possible to filter out <ide> * some candidate classes. <ide> */ <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return true; <ide> } <ide> <add> @Override <ide> public boolean isRuntime() { <ide> return true; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> ++this.evaluations; <ide> ControlFlow cflow = ControlFlowFactory.createControlFlow(); <ide> public int getEvaluations() { <ide> } <ide> <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this; <ide> } <ide> <add> @Override <ide> public MethodMatcher getMethodMatcher() { <ide> return this; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DefaultBeanFactoryPointcutAdvisor.java <ide> public void setPointcut(Pointcut pointcut) { <ide> this.pointcut = (pointcut != null ? pointcut : Pointcut.TRUE); <ide> } <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java <ide> public void addInterface(Class intf) { <ide> this.interfaces.add(intf); <ide> } <ide> <add> @Override <ide> public Class[] getInterfaces() { <ide> return this.interfaces.toArray(new Class[this.interfaces.size()]); <ide> } <ide> <add> @Override <ide> public void validateInterfaces() throws IllegalArgumentException { <ide> for (Class ifc : this.interfaces) { <ide> if (this.advice instanceof DynamicIntroductionAdvice && <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <ide> <add> @Override <ide> public Advice getAdvice() { <ide> return this.advice; <ide> } <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> return true; <ide> } <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this; <ide> } <ide> <add> @Override <ide> public boolean matches(Class clazz) { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java <ide> public void setPointcut(Pointcut pointcut) { <ide> this.pointcut = (pointcut != null ? pointcut : Pointcut.TRUE); <ide> } <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java <ide> public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Cla <ide> * behaviour in around advice. However, subclasses should invoke this <ide> * method, which handles introduced interfaces and forwarding to the target. <ide> */ <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> if (isMethodOnIntroducedInterface(mi)) { <ide> Object delegate = getIntroductionDelegateFor(mi.getThis()); <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java <ide> private void init(Object delegate) { <ide> * behaviour in around advice. However, subclasses should invoke this <ide> * method, which handles introduced interfaces and forwarding to the target. <ide> */ <add> @Override <ide> public Object invoke(MethodInvocation mi) throws Throwable { <ide> if (isMethodOnIntroducedInterface(mi)) { <ide> // Using the following method rather than direct reflection, we <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java <ide> */ <ide> public abstract class DynamicMethodMatcher implements MethodMatcher { <ide> <add> @Override <ide> public final boolean isRuntime() { <ide> return true; <ide> } <ide> public final boolean isRuntime() { <ide> * Can override to add preconditions for dynamic matching. This implementation <ide> * always returns true. <ide> */ <add> @Override <ide> public boolean matches(Method method, Class<?> targetClass) { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java <ide> */ <ide> public abstract class DynamicMethodMatcherPointcut extends DynamicMethodMatcher implements Pointcut { <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return ClassFilter.TRUE; <ide> } <ide> <add> @Override <ide> public final MethodMatcher getMethodMatcher() { <ide> return this; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java <ide> public void suppressInterface(Class intf) { <ide> this.publishedInterfaces.remove(intf); <ide> } <ide> <add> @Override <ide> public Class[] getInterfaces() { <ide> return this.publishedInterfaces.toArray(new Class[this.publishedInterfaces.size()]); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java <ide> public UnionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) { <ide> this.mm2 = mm2; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { <ide> return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) || <ide> (matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions)); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return (matchesClass1(targetClass) && this.mm1.matches(method, targetClass)) || <ide> (matchesClass2(targetClass) && this.mm2.matches(method, targetClass)); <ide> protected boolean matchesClass2(Class targetClass) { <ide> return true; <ide> } <ide> <add> @Override <ide> public boolean isRuntime() { <ide> return this.mm1.isRuntime() || this.mm2.isRuntime(); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args); <ide> } <ide> public IntersectionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) { <ide> this.mm2 = mm2; <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { <ide> return MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions) && <ide> MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return this.mm1.matches(method, targetClass) && this.mm2.matches(method, targetClass); <ide> } <ide> <add> @Override <ide> public boolean isRuntime() { <ide> return this.mm1.isRuntime() || this.mm2.isRuntime(); <ide> } <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass, Object[] args) { <ide> // Because a dynamic intersection may be composed of a static and dynamic part, <ide> // we must avoid calling the 3-arg matches method on a dynamic matcher, as <ide><path>spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java <ide> public NameMatchMethodPointcut addMethodName(String name) { <ide> } <ide> <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> for (String mappedName : this.mappedNames) { <ide> if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) { <ide><path>spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java <ide> public NameMatchMethodPointcut addMethodName(String name) { <ide> } <ide> <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java <ide> private static class SetterPointcut extends StaticMethodMatcherPointcut implemen <ide> <ide> public static SetterPointcut INSTANCE = new SetterPointcut(); <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return method.getName().startsWith("set") && <ide> method.getParameterTypes().length == 1 && <ide> private static class GetterPointcut extends StaticMethodMatcherPointcut implemen <ide> <ide> public static GetterPointcut INSTANCE = new GetterPointcut(); <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> return method.getName().startsWith("get") && <ide> method.getParameterTypes().length == 0; <ide><path>spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java <ide> public void setPatterns(String[] patterns) { <ide> /** <ide> * Initialize the singleton Pointcut held within this Advisor. <ide> */ <add> @Override <ide> public Pointcut getPointcut() { <ide> synchronized (this.pointcutMonitor) { <ide> if (this.pointcut == null) { <ide><path>spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java <ide> public RootClassFilter(Class clazz) { <ide> this.clazz = clazz; <ide> } <ide> <add> @Override <ide> public boolean matches(Class candidate) { <ide> return clazz.isAssignableFrom(candidate); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java <ide> */ <ide> public abstract class StaticMethodMatcher implements MethodMatcher { <ide> <add> @Override <ide> public final boolean isRuntime() { <ide> return false; <ide> } <ide> <add> @Override <ide> public final boolean matches(Method method, Class<?> targetClass, Object[] args) { <ide> // should never be invoked because isRuntime() returns false <ide> throw new UnsupportedOperationException("Illegal MethodMatcher usage"); <ide><path>spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcut.java <ide> public void setClassFilter(ClassFilter classFilter) { <ide> this.classFilter = classFilter; <ide> } <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this.classFilter; <ide> } <ide> <ide> <add> @Override <ide> public final MethodMatcher getMethodMatcher() { <ide> return this; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> public void setAdvice(Advice advice) { <ide> this.advice = advice; <ide> } <ide> <add> @Override <ide> public Advice getAdvice() { <ide> return this.advice; <ide> } <ide> <add> @Override <ide> public boolean isPerInstance() { <ide> return true; <ide> } <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java <ide> public AnnotationClassFilter(Class<? extends Annotation> annotationType, boolean <ide> } <ide> <ide> <add> @Override <ide> public boolean matches(Class clazz) { <ide> return (this.checkInherited ? <ide> (AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) : <ide><path>spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java <ide> public AnnotationMatchingPointcut( <ide> } <ide> <ide> <add> @Override <ide> public ClassFilter getClassFilter() { <ide> return this.classFilter; <ide> } <ide> <add> @Override <ide> public MethodMatcher getMethodMatcher() { <ide> return this.methodMatcher; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java <ide> public AnnotationMethodMatcher(Class<? extends Annotation> annotationType) { <ide> } <ide> <ide> <add> @Override <ide> public boolean matches(Method method, Class targetClass) { <ide> if (method.isAnnotationPresent(this.annotationType)) { <ide> return true; <ide><path>spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java <ide> public void setTargetClass(Class targetClass) { <ide> * Set the owning BeanFactory. We need to save a reference so that we can <ide> * use the {@code getBean} method on every invocation. <ide> */ <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (this.targetBeanName == null) { <ide> throw new IllegalStateException("Property'targetBeanName' is required"); <ide> public BeanFactory getBeanFactory() { <ide> } <ide> <ide> <add> @Override <ide> public synchronized Class<?> getTargetClass() { <ide> if (this.targetClass == null && this.beanFactory != null) { <ide> // Determine type of the target bean. <ide> public synchronized Class<?> getTargetClass() { <ide> return this.targetClass; <ide> } <ide> <add> @Override <ide> public boolean isStatic() { <ide> return false; <ide> } <ide> <add> @Override <ide> public void releaseTarget(Object target) throws Exception { <ide> // Nothing to do here. <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java <ide> public synchronized boolean isInitialized() { <ide> * a meaningful value when the target is still {@code null}. <ide> * @see #isInitialized() <ide> */ <add> @Override <ide> public synchronized Class<?> getTargetClass() { <ide> return (this.lazyTarget != null ? this.lazyTarget.getClass() : null); <ide> } <ide> <add> @Override <ide> public boolean isStatic() { <ide> return false; <ide> } <ide> public boolean isStatic() { <ide> * creating it on-the-fly if it doesn't exist already. <ide> * @see #createObject() <ide> */ <add> @Override <ide> public synchronized Object getTarget() throws Exception { <ide> if (this.lazyTarget == null) { <ide> logger.debug("Initializing lazy target object"); <ide> public synchronized Object getTarget() throws Exception { <ide> return this.lazyTarget; <ide> } <ide> <add> @Override <ide> public void releaseTarget(Object target) throws Exception { <ide> // nothing to do <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java <ide> public void setMaxSize(int maxSize) { <ide> /** <ide> * Return the maximum size of the pool. <ide> */ <add> @Override <ide> public int getMaxSize() { <ide> return this.maxSize; <ide> } <ide> public final void setBeanFactory(BeanFactory beanFactory) throws BeansException <ide> * @throws Exception we may need to deal with checked exceptions from pool <ide> * APIs, so we're forgiving with our exception signature <ide> */ <add> @Override <ide> public abstract Object getTarget() throws Exception; <ide> <ide> /** <ide><path>spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java <ide> public void releaseTarget(Object target) throws Exception { <ide> this.pool.returnObject(target); <ide> } <ide> <add> @Override <ide> public int getActiveCount() throws UnsupportedOperationException { <ide> return this.pool.getNumActive(); <ide> } <ide> <add> @Override <ide> public int getIdleCount() throws UnsupportedOperationException { <ide> return this.pool.getNumIdle(); <ide> } <ide> public int getIdleCount() throws UnsupportedOperationException { <ide> /** <ide> * Closes the underlying {@code ObjectPool} when destroying this object. <ide> */ <add> @Override <ide> public void destroy() throws Exception { <ide> logger.debug("Closing Commons ObjectPool"); <ide> this.pool.close(); <ide> public void destroy() throws Exception { <ide> // Implementation of org.apache.commons.pool.PoolableObjectFactory interface <ide> //---------------------------------------------------------------------------- <ide> <add> @Override <ide> public Object makeObject() throws BeansException { <ide> return newPrototypeInstance(); <ide> } <ide> <add> @Override <ide> public void destroyObject(Object obj) throws Exception { <ide> destroyPrototypeInstance(obj); <ide> } <ide> <add> @Override <ide> public boolean validateObject(Object obj) { <ide> return true; <ide> } <ide> <add> @Override <ide> public void activateObject(Object obj) { <ide> } <ide> <add> @Override <ide> public void passivateObject(Object obj) { <ide> } <ide> <ide><path>spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java <ide> private EmptyTargetSource(Class targetClass, boolean isStatic) { <ide> /** <ide> * Always returns the specified target Class, or {@code null} if none. <ide> */ <add> @Override <ide> public Class<?> getTargetClass() { <ide> return this.targetClass; <ide> } <ide> <ide> /** <ide> * Always returns {@code true}. <ide> */ <add> @Override <ide> public boolean isStatic() { <ide> return this.isStatic; <ide> } <ide> <ide> /** <ide> * Always returns {@code null}. <ide> */ <add> @Override <ide> public Object getTarget() { <ide> return null; <ide> } <ide> <ide> /** <ide> * Nothing to release. <ide> */ <add> @Override <ide> public void releaseTarget(Object target) { <ide> } <ide> <ide><path>spring-aop/src/main/java/org/springframework/aop/target/HotSwappableTargetSource.java <ide> public HotSwappableTargetSource(Object initialTarget) { <ide> * Return the type of the current target object. <ide> * <p>The returned type should usually be constant across all target objects. <ide> */ <add> @Override <ide> public synchronized Class<?> getTargetClass() { <ide> return this.target.getClass(); <ide> } <ide> <add> @Override <ide> public final boolean isStatic() { <ide> return false; <ide> } <ide> <add> @Override <ide> public synchronized Object getTarget() { <ide> return this.target; <ide> } <ide> <add> @Override <ide> public void releaseTarget(Object target) { <ide> // nothing to do <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/LazyInitTargetSource.java <ide> public class LazyInitTargetSource extends AbstractBeanFactoryBasedTargetSource { <ide> private Object target; <ide> <ide> <add> @Override <ide> public synchronized Object getTarget() throws BeansException { <ide> if (this.target == null) { <ide> this.target = getBeanFactory().getBean(getTargetBeanName()); <ide><path>spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java <ide> public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource { <ide> * Obtain a new prototype instance for every call. <ide> * @see #newPrototypeInstance() <ide> */ <add> @Override <ide> public Object getTarget() throws BeansException { <ide> return newPrototypeInstance(); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/SimpleBeanTargetSource.java <ide> @SuppressWarnings("serial") <ide> public class SimpleBeanTargetSource extends AbstractBeanFactoryBasedTargetSource { <ide> <add> @Override <ide> public Object getTarget() throws Exception { <ide> return getBeanFactory().getBean(getTargetBeanName()); <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java <ide> public SingletonTargetSource(Object target) { <ide> } <ide> <ide> <add> @Override <ide> public Class<?> getTargetClass() { <ide> return this.target.getClass(); <ide> } <ide> <add> @Override <ide> public Object getTarget() { <ide> return this.target; <ide> } <ide> <add> @Override <ide> public void releaseTarget(Object target) { <ide> // nothing to do <ide> } <ide> <add> @Override <ide> public boolean isStatic() { <ide> return true; <ide> } <ide><path>spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java <ide> public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource <ide> * We look for a target held in a ThreadLocal. If we don't find one, <ide> * we create one and bind it to the thread. No synchronization is required. <ide> */ <add> @Override <ide> public Object getTarget() throws BeansException { <ide> ++this.invocationCount; <ide> Object target = this.targetInThread.get(); <ide> public Object getTarget() throws BeansException { <ide> * Dispose of targets if necessary; clear ThreadLocal. <ide> * @see #destroyPrototypeInstance <ide> */ <add> @Override <ide> public void destroy() { <ide> logger.debug("Destroying ThreadLocalTargetSource bindings"); <ide> synchronized (this.targetSet) { <ide> public void destroy() { <ide> } <ide> <ide> <add> @Override <ide> public int getInvocationCount() { <ide> return this.invocationCount; <ide> } <ide> <add> @Override <ide> public int getHitCount() { <ide> return this.hitCount; <ide> } <ide> <add> @Override <ide> public int getObjectCount() { <ide> synchronized (this.targetSet) { <ide> return this.targetSet.size(); <ide><path>spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java <ide> public void setRefreshCheckDelay(long refreshCheckDelay) { <ide> } <ide> <ide> <add> @Override <ide> public synchronized Class<?> getTargetClass() { <ide> if (this.targetObject == null) { <ide> refresh(); <ide> public synchronized Class<?> getTargetClass() { <ide> /** <ide> * Not static. <ide> */ <add> @Override <ide> public boolean isStatic() { <ide> return false; <ide> } <ide> <add> @Override <ide> public final synchronized Object getTarget() { <ide> if ((refreshCheckDelayElapsed() && requiresRefresh()) || this.targetObject == null) { <ide> refresh(); <ide> public final synchronized Object getTarget() { <ide> /** <ide> * No need to release target. <ide> */ <add> @Override <ide> public void releaseTarget(Object object) { <ide> } <ide> <ide> <add> @Override <ide> public final synchronized void refresh() { <ide> logger.debug("Attempting to refresh target"); <ide> <ide> public final synchronized void refresh() { <ide> logger.debug("Target refreshed successfully"); <ide> } <ide> <add> @Override <ide> public synchronized long getRefreshCount() { <ide> return this.refreshCount; <ide> } <ide> <add> @Override <ide> public synchronized long getLastRefreshTime() { <ide> return this.lastRefreshTime; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java <ide> public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl <ide> private boolean extractOldValueForEditor = false; <ide> <ide> <add> @Override <ide> public void setExtractOldValueForEditor(boolean extractOldValueForEditor) { <ide> this.extractOldValueForEditor = extractOldValueForEditor; <ide> } <ide> <add> @Override <ide> public boolean isExtractOldValueForEditor() { <ide> return this.extractOldValueForEditor; <ide> } <ide> <ide> <add> @Override <ide> public void setPropertyValue(PropertyValue pv) throws BeansException { <ide> setPropertyValue(pv.getName(), pv.getValue()); <ide> } <ide> <add> @Override <ide> public void setPropertyValues(Map<?, ?> map) throws BeansException { <ide> setPropertyValues(new MutablePropertyValues(map)); <ide> } <ide> <add> @Override <ide> public void setPropertyValues(PropertyValues pvs) throws BeansException { <ide> setPropertyValues(pvs, false, false); <ide> } <ide> <add> @Override <ide> public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException { <ide> setPropertyValues(pvs, ignoreUnknown, false); <ide> } <ide> <add> @Override <ide> public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) <ide> throws BeansException { <ide> <ide> public Class getPropertyType(String propertyPath) { <ide> * @throws PropertyAccessException if the property was valid but the <ide> * accessor method failed <ide> */ <add> @Override <ide> public abstract Object getPropertyValue(String propertyName) throws BeansException; <ide> <ide> /** <ide> public Class getPropertyType(String propertyPath) { <ide> * @throws PropertyAccessException if the property was valid but the <ide> * accessor method failed or a type mismatch occured <ide> */ <add> @Override <ide> public abstract void setPropertyValue(String propertyName, Object value) throws BeansException; <ide> <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/BeanMetadataAttribute.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/BeanMetadataAttributeAccessor.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java <ide> public void setWrappedInstance(Object object, String nestedPath, Object rootObje <ide> setIntrospectionClass(object.getClass()); <ide> } <ide> <add> @Override <ide> public final Object getWrappedInstance() { <ide> return this.object; <ide> } <ide> <add> @Override <ide> public final Class getWrappedClass() { <ide> return (this.object != null ? this.object.getClass() : null); <ide> } <ide> public final Class getRootClass() { <ide> * enables auto-growth of collection elements when accessing an out-of-bounds index. <ide> * <p>Default is "false" on a plain BeanWrapper. <ide> */ <add> @Override <ide> public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths) { <ide> this.autoGrowNestedPaths = autoGrowNestedPaths; <ide> } <ide> <ide> /** <ide> * Return whether "auto-growing" of nested paths has been activated. <ide> */ <add> @Override <ide> public boolean isAutoGrowNestedPaths() { <ide> return this.autoGrowNestedPaths; <ide> } <ide> public boolean isAutoGrowNestedPaths() { <ide> * Specify a limit for array and collection auto-growing. <ide> * <p>Default is unlimited on a plain BeanWrapper. <ide> */ <add> @Override <ide> public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) { <ide> this.autoGrowCollectionLimit = autoGrowCollectionLimit; <ide> } <ide> <ide> /** <ide> * Return the limit for array and collection auto-growing. <ide> */ <add> @Override <ide> public int getAutoGrowCollectionLimit() { <ide> return this.autoGrowCollectionLimit; <ide> } <ide> private CachedIntrospectionResults getCachedIntrospectionResults() { <ide> } <ide> <ide> <add> @Override <ide> public PropertyDescriptor[] getPropertyDescriptors() { <ide> return getCachedIntrospectionResults().getPropertyDescriptors(); <ide> } <ide> <add> @Override <ide> public PropertyDescriptor getPropertyDescriptor(String propertyName) throws BeansException { <ide> PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); <ide> if (pd == null) { <ide> public Class getPropertyType(String propertyName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException { <ide> try { <ide> BeanWrapperImpl nestedBw = getBeanWrapperForPropertyPath(propertyName); <ide> public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws Bean <ide> return null; <ide> } <ide> <add> @Override <ide> public boolean isReadableProperty(String propertyName) { <ide> try { <ide> PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); <ide> public boolean isReadableProperty(String propertyName) { <ide> return false; <ide> } <ide> <add> @Override <ide> public boolean isWritableProperty(String propertyName) { <ide> try { <ide> PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); <ide> private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansExceptio <ide> if (!Modifier.isPublic(readMethod.getDeclaringClass().getModifiers()) && !readMethod.isAccessible()) { <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> readMethod.setAccessible(true); <ide> return null; <ide> public Object run() { <ide> if (System.getSecurityManager() != null) { <ide> try { <ide> value = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> return readMethod.invoke(object, (Object[]) null); <ide> } <ide> else if (propValue instanceof Map) { <ide> !readMethod.isAccessible()) { <ide> if (System.getSecurityManager()!= null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> readMethod.setAccessible(true); <ide> return null; <ide> public Object run() { <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> oldValue = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> return readMethod.invoke(object); <ide> } <ide> public Object run() throws Exception { <ide> if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers()) && !writeMethod.isAccessible()) { <ide> if (System.getSecurityManager()!= null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> writeMethod.setAccessible(true); <ide> return null; <ide> public Object run() { <ide> if (System.getSecurityManager() != null) { <ide> try { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> writeMethod.invoke(object, value); <ide> return null; <ide><path>spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java <ide> public DirectFieldAccessor(final Object target) { <ide> Assert.notNull(target, "Target object must not be null"); <ide> this.target = target; <ide> ReflectionUtils.doWithFields(this.target.getClass(), new ReflectionUtils.FieldCallback() { <add> @Override <ide> public void doWith(Field field) { <ide> if (fieldMap.containsKey(field.getName())) { <ide> // ignore superclass declarations of fields already found in a subclass <ide> public void doWith(Field field) { <ide> } <ide> <ide> <add> @Override <ide> public boolean isReadableProperty(String propertyName) throws BeansException { <ide> return this.fieldMap.containsKey(propertyName); <ide> } <ide> <add> @Override <ide> public boolean isWritableProperty(String propertyName) throws BeansException { <ide> return this.fieldMap.containsKey(propertyName); <ide> } <ide> public Class<?> getPropertyType(String propertyName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException { <ide> Field field = this.fieldMap.get(propertyName); <ide> if (field != null) { <ide><path>spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java <ide> private String propertyNameFor(Method method) { <ide> * method found during construction. <ide> * @see #ExtendedBeanInfo(BeanInfo) <ide> */ <add> @Override <ide> public PropertyDescriptor[] getPropertyDescriptors() { <ide> return this.propertyDescriptors.toArray( <ide> new PropertyDescriptor[this.propertyDescriptors.size()]); <ide> } <ide> <add> @Override <ide> public BeanInfo[] getAdditionalBeanInfo() { <ide> return delegate.getAdditionalBeanInfo(); <ide> } <ide> <add> @Override <ide> public BeanDescriptor getBeanDescriptor() { <ide> return delegate.getBeanDescriptor(); <ide> } <ide> <add> @Override <ide> public int getDefaultEventIndex() { <ide> return delegate.getDefaultEventIndex(); <ide> } <ide> <add> @Override <ide> public int getDefaultPropertyIndex() { <ide> return delegate.getDefaultPropertyIndex(); <ide> } <ide> <add> @Override <ide> public EventSetDescriptor[] getEventSetDescriptors() { <ide> return delegate.getEventSetDescriptors(); <ide> } <ide> <add> @Override <ide> public Image getIcon(int iconKind) { <ide> return delegate.getIcon(iconKind); <ide> } <ide> <add> @Override <ide> public MethodDescriptor[] getMethodDescriptors() { <ide> return delegate.getMethodDescriptors(); <ide> } <ide> public static boolean compareMethods(Method a, Method b) { <ide> */ <ide> class PropertyDescriptorComparator implements Comparator<PropertyDescriptor> { <ide> <add> @Override <ide> public int compare(PropertyDescriptor desc1, PropertyDescriptor desc2) { <ide> String left = desc1.getName(); <ide> String right = desc2.getName(); <ide><path>spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java <ide> public class ExtendedBeanInfoFactory implements Ordered, BeanInfoFactory { <ide> /** <ide> * Return a new {@link ExtendedBeanInfo} for the given bean class. <ide> */ <add> @Override <ide> public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException { <ide> return supports(beanClass) ? <ide> new ExtendedBeanInfo(Introspector.getBeanInfo(beanClass)) : null; <ide> private boolean supports(Class<?> beanClass) { <ide> return false; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return Ordered.LOWEST_PRECEDENCE; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java <ide> public MethodInvocationException(PropertyChangeEvent propertyChangeEvent, Throwa <ide> super(propertyChangeEvent, "Property '" + propertyChangeEvent.getPropertyName() + "' threw exception", cause); <ide> } <ide> <add> @Override <ide> public String getErrorCode() { <ide> return ERROR_CODE; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java <ide> public void removePropertyValue(String propertyName) { <ide> } <ide> <ide> <add> @Override <ide> public PropertyValue[] getPropertyValues() { <ide> return this.propertyValueList.toArray(new PropertyValue[this.propertyValueList.size()]); <ide> } <ide> <add> @Override <ide> public PropertyValue getPropertyValue(String propertyName) { <ide> for (PropertyValue pv : this.propertyValueList) { <ide> if (pv.getName().equals(propertyName)) { <ide> public PropertyValue getPropertyValue(String propertyName) { <ide> return null; <ide> } <ide> <add> @Override <ide> public PropertyValues changesSince(PropertyValues old) { <ide> MutablePropertyValues changes = new MutablePropertyValues(); <ide> if (old == this) { <ide> else if (!pvOld.equals(newPv)) { <ide> return changes; <ide> } <ide> <add> @Override <ide> public boolean contains(String propertyName) { <ide> return (getPropertyValue(propertyName) != null || <ide> (this.processedProperties != null && this.processedProperties.contains(propertyName))); <ide> } <ide> <add> @Override <ide> public boolean isEmpty() { <ide> return this.propertyValueList.isEmpty(); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java <ide> protected void copyDefaultEditorsTo(PropertyEditorRegistrySupport target) { <ide> // Management of custom editors <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) { <ide> registerCustomEditor(requiredType, null, propertyEditor); <ide> } <ide> <add> @Override <ide> public void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) { <ide> if (requiredType == null && propertyPath == null) { <ide> throw new IllegalArgumentException("Either requiredType or propertyPath is required"); <ide> public boolean isSharedEditor(PropertyEditor propertyEditor) { <ide> return (this.sharedEditors != null && this.sharedEditors.contains(propertyEditor)); <ide> } <ide> <add> @Override <ide> public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath) { <ide> Class<?> requiredTypeToUse = requiredType; <ide> if (propertyPath != null) { <ide><path>spring-beans/src/main/java/org/springframework/beans/TypeConverterSupport.java <ide> public abstract class TypeConverterSupport extends PropertyEditorRegistrySupport <ide> TypeConverterDelegate typeConverterDelegate; <ide> <ide> <add> @Override <ide> public <T> T convertIfNecessary(Object value, Class<T> requiredType) throws TypeMismatchException { <ide> return doConvert(value, requiredType, null, null); <ide> } <ide> <add> @Override <ide> public <T> T convertIfNecessary(Object value, Class<T> requiredType, MethodParameter methodParam) <ide> throws TypeMismatchException { <ide> <ide> return doConvert(value, requiredType, methodParam, null); <ide> } <ide> <add> @Override <ide> public <T> T convertIfNecessary(Object value, Class<T> requiredType, Field field) <ide> throws TypeMismatchException { <ide> <ide><path>spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java <ide> public Class getRequiredType() { <ide> return this.requiredType; <ide> } <ide> <add> @Override <ide> public String getErrorCode() { <ide> return ERROR_CODE; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java <ide> protected SingletonBeanFactoryLocator(String resourceLocation) { <ide> this.resourceLocation = resourceLocation; <ide> } <ide> <add> @Override <ide> public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException { <ide> synchronized (this.bfgInstancesByKey) { <ide> BeanFactoryGroup bfg = this.bfgInstancesByKey.get(this.resourceLocation); <ide> public CountingBeanFactoryReference(BeanFactory beanFactory, BeanFactory groupCo <ide> this.groupContextRef = groupContext; <ide> } <ide> <add> @Override <ide> public BeanFactory getFactory() { <ide> return this.beanFactory; <ide> } <ide> <ide> // Note that it's legal to call release more than once! <add> @Override <ide> public void release() throws FatalBeanException { <ide> synchronized (bfgInstancesByKey) { <ide> BeanFactory savedRef = this.groupContextRef; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotatedGenericBeanDefinition.java <ide> public AnnotatedGenericBeanDefinition(AnnotationMetadata metadata) { <ide> } <ide> <ide> <add> @Override <ide> public final AnnotationMetadata getMetadata() { <ide> return this.metadata; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolver.java <ide> */ <ide> public class AnnotationBeanWiringInfoResolver implements BeanWiringInfoResolver { <ide> <add> @Override <ide> public BeanWiringInfo resolveWiringInfo(Object beanInstance) { <ide> Assert.notNull(beanInstance, "Bean instance must not be null"); <ide> Configurable annotation = beanInstance.getClass().getAnnotation(Configurable.class); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> if (!(beanFactory instanceof ConfigurableListableBeanFactory)) { <ide> throw new IllegalArgumentException( <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> } <ide> <ide> <add> @Override <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) { <ide> if (beanType != null) { <ide> InjectionMetadata metadata = findAutowiringMetadata(beanType); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide> public void setCustomQualifierTypes(Set customQualifierTypes) { <ide> } <ide> <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <ide> if (this.customQualifierTypes != null) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <ide> <add> @Override <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) { <ide> if (beanType != null) { <ide> LifecycleMetadata metadata = findLifecycleMetadata(beanType); <ide> metadata.checkConfigMembers(beanDefinition); <ide> } <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { <ide> LifecycleMetadata metadata = findLifecycleMetadata(bean.getClass()); <ide> try { <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) thro <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide> <add> @Override <ide> public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException { <ide> LifecycleMetadata metadata = findLifecycleMetadata(bean.getClass()); <ide> try { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java <ide> public void setValueAnnotationType(Class<? extends Annotation> valueAnnotationTy <ide> this.valueAnnotationType = valueAnnotationType; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> * attribute does not match. <ide> * @see Qualifier <ide> */ <add> @Override <ide> public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) { <ide> if (!bdHolder.getBeanDefinition().isAutowireCandidate()) { <ide> // if explicitly false, do not proceed with qualifier check <ide> protected boolean checkQualifier( <ide> * Determine whether the given dependency carries a value annotation. <ide> * @see Value <ide> */ <add> @Override <ide> public Object getSuggestedValue(DependencyDescriptor descriptor) { <ide> Object value = findValue(descriptor.getAnnotations()); <ide> if (value == null) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java <ide> protected Class<? extends Annotation> getRequiredAnnotationType() { <ide> return this.requiredAnnotationType; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (beanFactory instanceof ConfigurableListableBeanFactory) { <ide> this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <ide> <add> @Override <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) { <ide> } <ide> <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java <ide> public void setSingleton(boolean singleton) { <ide> this.singleton = singleton; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return this.singleton; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> this.beanClassLoader = classLoader; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> protected TypeConverter getBeanTypeConverter() { <ide> /** <ide> * Eagerly create the singleton instance, if necessary. <ide> */ <add> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> if (isSingleton()) { <ide> this.initialized = true; <ide> public void afterPropertiesSet() throws Exception { <ide> * @see #createInstance() <ide> * @see #getEarlySingletonInterfaces() <ide> */ <add> @Override <ide> public final T getObject() throws Exception { <ide> if (isSingleton()) { <ide> return (this.initialized ? this.singletonInstance : getEarlySingletonInstance()); <ide> private T getSingletonInstance() throws IllegalStateException { <ide> * Destroy the singleton instance, if any. <ide> * @see #destroyInstance(Object) <ide> */ <add> @Override <ide> public void destroy() throws Exception { <ide> if (isSingleton()) { <ide> destroyInstance(this.singletonInstance); <ide> public void destroy() throws Exception { <ide> * interface, for a consistent offering of abstract template methods. <ide> * @see org.springframework.beans.factory.FactoryBean#getObjectType() <ide> */ <add> @Override <ide> public abstract Class<?> getObjectType(); <ide> <ide> /** <ide> protected void destroyInstance(T instance) throws Exception { <ide> */ <ide> private class EarlySingletonInvocationHandler implements InvocationHandler { <ide> <add> @Override <ide> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { <ide> if (ReflectionUtils.isEqualsMethod(method)) { <ide> // Only consider equal when proxies are identical. <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinitionHolder.java <ide> public String[] getAliases() { <ide> * Expose the bean definition's source object. <ide> * @see BeanDefinition#getSource() <ide> */ <add> @Override <ide> public Object getSource() { <ide> return this.beanDefinition.getSource(); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java <ide> public void setTargetBeanName(String targetBeanName) { <ide> this.targetBeanName = targetBeanName; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> if (this.targetBeanName == null) { <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() throws BeansException { <ide> if (this.beanFactory == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> } <ide> return this.beanFactory.getBean(this.targetBeanName); <ide> } <ide> <add> @Override <ide> public Class getObjectType() { <ide> if (this.beanFactory == null) { <ide> return null; <ide> } <ide> return this.beanFactory.getType(this.targetBeanName); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> if (this.beanFactory == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> } <ide> return this.beanFactory.isSingleton(this.targetBeanName); <ide> } <ide> <add> @Override <ide> public boolean isPrototype() { <ide> if (this.beanFactory == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> } <ide> return this.beanFactory.isPrototype(this.targetBeanName); <ide> } <ide> <add> @Override <ide> public boolean isEagerInit() { <ide> return false; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java <ide> public void setLogName(String logName) { <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.log == null) { <ide> throw new IllegalArgumentException("'logName' is required"); <ide> } <ide> } <ide> <add> @Override <ide> public Log getObject() { <ide> return this.log; <ide> } <ide> <add> @Override <ide> public Class<? extends Log> getObjectType() { <ide> return (this.log != null ? this.log.getClass() : Log.class); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> public void setIgnoreUnresolvableEditors(boolean ignoreUnresolvableEditors) { <ide> this.ignoreUnresolvableEditors = ignoreUnresolvableEditors; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide> <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <ide> if (this.propertyEditorRegistrars != null) { <ide> public SharedPropertyEditorRegistrar(Class requiredType, PropertyEditor sharedEd <ide> this.sharedEditor = sharedEditor; <ide> } <ide> <add> @Override <ide> public void registerCustomEditors(PropertyEditorRegistry registry) { <ide> if (!(registry instanceof PropertyEditorRegistrySupport)) { <ide> throw new IllegalArgumentException("Cannot registered shared editor " + <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide> <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <ide> if (this.scopes != null) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/DeprecatedBeanWarner.java <ide> public void setLoggerName(String loggerName) { <ide> } <ide> <ide> <add> @Override <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <ide> if (isLogEnabled()) { <ide> String[] beanNames = beanFactory.getBeanDefinitionNames(); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java <ide> public void setStaticField(String staticField) { <ide> * nor "targetField" have been specified. <ide> * This allows for concise bean definitions with just an id/name. <ide> */ <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = StringUtils.trimAllWhitespace(BeanFactoryUtils.originalBeanName(beanName)); <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> this.beanClassLoader = classLoader; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws ClassNotFoundException, NoSuchFieldException { <ide> if (this.targetClass != null && this.targetObject != null) { <ide> throw new IllegalArgumentException("Specify either targetClass or targetObject, not both"); <ide> else if (this.targetField == null) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() throws IllegalAccessException { <ide> if (this.fieldObject == null) { <ide> throw new FactoryBeanNotInitializedException(); <ide> public Object getObject() throws IllegalAccessException { <ide> } <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return (this.fieldObject != null ? this.fieldObject.getType() : null); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return false; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessorAdapter.java <ide> */ <ide> public abstract class InstantiationAwareBeanPostProcessorAdapter implements SmartInstantiationAwareBeanPostProcessor { <ide> <add> @Override <ide> public Class<?> predictBeanType(Class<?> beanClass, String beanName) { <ide> return null; <ide> } <ide> <add> @Override <ide> public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { <ide> return true; <ide> } <ide> <add> @Override <ide> public PropertyValues postProcessPropertyValues( <ide> PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) <ide> throws BeansException { <ide> <ide> return pvs; <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java <ide> public void setSingleton(boolean singleton) { <ide> this.singleton = singleton; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return this.singleton; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> this.beanClassLoader = classLoader; <ide> } <ide> protected Class resolveClassName(String className) throws ClassNotFoundException <ide> return ClassUtils.forName(className, this.beanClassLoader); <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (beanFactory instanceof ConfigurableBeanFactory) { <ide> this.beanFactory = (ConfigurableBeanFactory) beanFactory; <ide> protected TypeConverter getDefaultTypeConverter() { <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> prepare(); <ide> if (this.singleton) { <ide> private Object doInvoke() throws Exception { <ide> * to "true", otherwise returns the value returned from invoking the <ide> * specified method on the fly. <ide> */ <add> @Override <ide> public Object getObject() throws Exception { <ide> if (this.singleton) { <ide> if (!this.initialized) { <ide> public Object getObject() throws Exception { <ide> * Return the type of object that this FactoryBean creates, <ide> * or {@code null} if not known in advance. <ide> */ <add> @Override <ide> public Class<?> getObjectType() { <ide> if (!isPrepared()) { <ide> // Not fully initialized yet -> return null to indicate "not known yet". <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java <ide> public TargetBeanObjectFactory(BeanFactory beanFactory, String targetBeanName) { <ide> this.targetBeanName = targetBeanName; <ide> } <ide> <add> @Override <ide> public Object getObject() throws BeansException { <ide> return this.beanFactory.getBean(this.targetBeanName); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java <ide> public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlacehol <ide> * @see #setLocations <ide> * @see org.springframework.core.io.ResourceEditor <ide> */ <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> public void setBeanName(String beanName) { <ide> * @see #setLocations <ide> * @see org.springframework.core.io.ResourceEditor <ide> */ <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java <ide> public void setUserTreePath(String userTreePath) { <ide> * This implementation eagerly fetches the Preferences instances <ide> * for the required system and user tree nodes. <ide> */ <add> @Override <ide> public void afterPropertiesSet() { <ide> this.systemPrefs = (this.systemTreePath != null) ? <ide> Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot(); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PropertiesFactoryBean.java <ide> public final void setSingleton(boolean singleton) { <ide> this.singleton = singleton; <ide> } <ide> <add> @Override <ide> public final boolean isSingleton() { <ide> return this.singleton; <ide> } <ide> <ide> <add> @Override <ide> public final void afterPropertiesSet() throws IOException { <ide> if (this.singleton) { <ide> this.singletonInstance = createProperties(); <ide> } <ide> } <ide> <add> @Override <ide> public final Properties getObject() throws IOException { <ide> if (this.singleton) { <ide> return this.singletonInstance; <ide> public final Properties getObject() throws IOException { <ide> } <ide> } <ide> <add> @Override <ide> public Class<Properties> getObjectType() { <ide> return Properties.class; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java <ide> public void setResultType(Class resultType) { <ide> * "targetBeanName" nor "propertyPath" have been specified. <ide> * This allows for concise bean definitions with just an id/name. <ide> */ <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = StringUtils.trimAllWhitespace(BeanFactoryUtils.originalBeanName(beanName)); <ide> } <ide> <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> <ide> else if (this.propertyPath == null) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() throws BeansException { <ide> BeanWrapper target = this.targetBeanWrapper; <ide> if (target != null) { <ide> public Object getObject() throws BeansException { <ide> return target.getPropertyValue(this.propertyPath); <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return this.resultType; <ide> } <ide> public Class<?> getObjectType() { <ide> * for each call, so we have to assume that we're not returning the <ide> * same object for each {@link #getObject()} call. <ide> */ <add> @Override <ide> public boolean isSingleton() { <ide> return false; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java <ide> public PlaceholderResolvingStringValueResolver(Properties props) { <ide> this.resolver = new PropertyPlaceholderConfigurerResolver(props); <ide> } <ide> <add> @Override <ide> public String resolveStringValue(String strVal) throws BeansException { <ide> String value = this.helper.replacePlaceholders(strVal, this.resolver); <ide> return (value.equals(nullValue) ? null : value); <ide> private PropertyPlaceholderConfigurerResolver(Properties props) { <ide> this.props = props; <ide> } <ide> <add> @Override <ide> public String resolvePlaceholder(String placeholderName) { <ide> return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, props, systemPropertiesMode); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyResourceConfigurer.java <ide> public void setOrder(int order) { <ide> this.order = order; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return this.order; <ide> } <ide> public int getOrder() { <ide> * {@linkplain #processProperties process} properties against the given bean factory. <ide> * @throws BeanInitializationException if any properties cannot be loaded <ide> */ <add> @Override <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <ide> try { <ide> Properties mergedProps = mergeProperties(); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java <ide> public TargetBeanProvider(BeanFactory beanFactory, String targetBeanName) { <ide> this.targetBeanName = targetBeanName; <ide> } <ide> <add> @Override <ide> public Object get() throws BeansException { <ide> return this.beanFactory.getBean(this.targetBeanName); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java <ide> public RuntimeBeanNameReference(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public String getBeanName() { <ide> return this.beanName; <ide> } <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java <ide> public RuntimeBeanReference(String beanName, boolean toParent) { <ide> } <ide> <ide> <add> @Override <ide> public String getBeanName() { <ide> return this.beanName; <ide> } <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java <ide> public void setServiceMappings(Properties serviceMappings) { <ide> this.serviceMappings = serviceMappings; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> if (!(beanFactory instanceof ListableBeanFactory)) { <ide> throw new FatalBeanException( <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> this.beanFactory = (ListableBeanFactory) beanFactory; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.serviceLocatorInterface == null) { <ide> throw new IllegalArgumentException("Property 'serviceLocatorInterface' is required"); <ide> else if (paramTypes[i].isInstance(cause)) { <ide> } <ide> <ide> <add> @Override <ide> public Object getObject() { <ide> return this.proxy; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return this.serviceLocatorInterface; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide> public boolean isSingleton() { <ide> */ <ide> private class ServiceLocatorInvocationHandler implements InvocationHandler { <ide> <add> @Override <ide> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { <ide> if (ReflectionUtils.isEqualsMethod(method)) { <ide> // Only consider equal when proxies are identical. <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/AbstractComponentDefinition.java <ide> public abstract class AbstractComponentDefinition implements ComponentDefinition <ide> /** <ide> * Delegates to {@link #getName}. <ide> */ <add> @Override <ide> public String getDescription() { <ide> return getName(); <ide> } <ide> <ide> /** <ide> * Returns an empty array. <ide> */ <add> @Override <ide> public BeanDefinition[] getBeanDefinitions() { <ide> return new BeanDefinition[0]; <ide> } <ide> <ide> /** <ide> * Returns an empty array. <ide> */ <add> @Override <ide> public BeanDefinition[] getInnerBeanDefinitions() { <ide> return new BeanDefinition[0]; <ide> } <ide> <ide> /** <ide> * Returns an empty array. <ide> */ <add> @Override <ide> public BeanReference[] getBeanReferences() { <ide> return new BeanReference[0]; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/AliasDefinition.java <ide> public final String getAlias() { <ide> return this.alias; <ide> } <ide> <add> @Override <ide> public final Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/BeanComponentDefinition.java <ide> else if (value instanceof BeanReference) { <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return getBeanName(); <ide> } <ide> <add> @Override <ide> public String getDescription() { <ide> return getShortDescription(); <ide> } <ide> <add> @Override <ide> public BeanDefinition[] getBeanDefinitions() { <ide> return new BeanDefinition[] {getBeanDefinition()}; <ide> } <ide> <add> @Override <ide> public BeanDefinition[] getInnerBeanDefinitions() { <ide> return this.innerBeanDefinitions; <ide> } <ide> <add> @Override <ide> public BeanReference[] getBeanReferences() { <ide> return this.beanReferences; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/CompositeComponentDefinition.java <ide> public CompositeComponentDefinition(String name, Object source) { <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.name; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/EmptyReaderEventListener.java <ide> */ <ide> public class EmptyReaderEventListener implements ReaderEventListener { <ide> <add> @Override <ide> public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { <ide> // no-op <ide> } <ide> <add> @Override <ide> public void componentRegistered(ComponentDefinition componentDefinition) { <ide> // no-op <ide> } <ide> <add> @Override <ide> public void aliasRegistered(AliasDefinition aliasDefinition) { <ide> // no-op <ide> } <ide> <add> @Override <ide> public void importProcessed(ImportDefinition importDefinition) { <ide> // no-op <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java <ide> public void setLogger(Log logger) { <ide> * that has occurred. <ide> * @param problem the source of the error <ide> */ <add> @Override <ide> public void fatal(Problem problem) { <ide> throw new BeanDefinitionParsingException(problem); <ide> } <ide> public void fatal(Problem problem) { <ide> * that has occurred. <ide> * @param problem the source of the error <ide> */ <add> @Override <ide> public void error(Problem problem) { <ide> throw new BeanDefinitionParsingException(problem); <ide> } <ide> public void error(Problem problem) { <ide> * Writes the supplied {@link Problem} to the {@link Log} at {@code WARN} level. <ide> * @param problem the source of the warning <ide> */ <add> @Override <ide> public void warning(Problem problem) { <ide> this.logger.warn(problem, problem.getRootCause()); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/ImportDefinition.java <ide> public final Resource[] getActualResources() { <ide> return this.actualResources; <ide> } <ide> <add> @Override <ide> public final Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/NullSourceExtractor.java <ide> public class NullSourceExtractor implements SourceExtractor { <ide> /** <ide> * This implementation simply returns {@code null} for any input. <ide> */ <add> @Override <ide> public Object extractSource(Object sourceCandidate, Resource definitionResource) { <ide> return null; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractor.java <ide> public class PassThroughSourceExtractor implements SourceExtractor { <ide> * @param sourceCandidate the source metadata <ide> * @return the supplied {@code sourceCandidate} <ide> */ <add> @Override <ide> public Object extractSource(Object sourceCandidate, Resource definingResource) { <ide> return sourceCandidate; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java <ide> public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) { <ide> // Typical methods for creating and populating external bean instances <ide> //------------------------------------------------------------------------- <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public <T> T createBean(Class<T> beanClass) throws BeansException { <ide> // Use prototype bean definition, to avoid registering bean as dependent bean. <ide> public <T> T createBean(Class<T> beanClass) throws BeansException { <ide> return (T) createBean(beanClass.getName(), bd, null); <ide> } <ide> <add> @Override <ide> public void autowireBean(Object existingBean) { <ide> // Use non-singleton bean definition, to avoid registering bean as dependent bean. <ide> RootBeanDefinition bd = new RootBeanDefinition(ClassUtils.getUserClass(existingBean)); <ide> public void autowireBean(Object existingBean) { <ide> populateBean(bd.getBeanClass().getName(), bd, bw); <ide> } <ide> <add> @Override <ide> public Object configureBean(Object existingBean, String beanName) throws BeansException { <ide> markBeanAsCreated(beanName); <ide> BeanDefinition mbd = getMergedBeanDefinition(beanName); <ide> public Object configureBean(Object existingBean, String beanName) throws BeansEx <ide> return initializeBean(beanName, existingBean, bd); <ide> } <ide> <add> @Override <ide> public Object resolveDependency(DependencyDescriptor descriptor, String beanName) throws BeansException { <ide> return resolveDependency(descriptor, beanName, null, null); <ide> } <ide> public Object resolveDependency(DependencyDescriptor descriptor, String beanName <ide> // Specialized methods for fine-grained control over the bean lifecycle <ide> //------------------------------------------------------------------------- <ide> <add> @Override <ide> public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { <ide> // Use non-singleton bean definition, to avoid registering bean as dependent bean. <ide> RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck); <ide> bd.setScope(BeanDefinition.SCOPE_PROTOTYPE); <ide> return createBean(beanClass.getName(), bd, null); <ide> } <ide> <add> @Override <ide> public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { <ide> // Use non-singleton bean definition, to avoid registering bean as dependent bean. <ide> final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck); <ide> public Object autowire(Class beanClass, int autowireMode, boolean dependencyChec <ide> if (System.getSecurityManager() != null) { <ide> bean = AccessController.doPrivileged(new PrivilegedAction<Object>() { <ide> <add> @Override <ide> public Object run() { <ide> return getInstantiationStrategy().instantiate(bd, null, parent); <ide> } <ide> public Object run() { <ide> } <ide> } <ide> <add> @Override <ide> public void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck) <ide> throws BeansException { <ide> <ide> public void autowireBeanProperties(Object existingBean, int autowireMode, boolea <ide> populateBean(bd.getBeanClass().getName(), bd, bw); <ide> } <ide> <add> @Override <ide> public void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException { <ide> markBeanAsCreated(beanName); <ide> BeanDefinition bd = getMergedBeanDefinition(beanName); <ide> public void applyBeanPropertyValues(Object existingBean, String beanName) throws <ide> applyPropertyValues(beanName, bd, bw, bd.getPropertyValues()); <ide> } <ide> <add> @Override <ide> public Object initializeBean(Object existingBean, String beanName) { <ide> return initializeBean(beanName, existingBean, null); <ide> } <ide> <add> @Override <ide> public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) <ide> throws BeansException { <ide> <ide> public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, S <ide> return result; <ide> } <ide> <add> @Override <ide> public Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName) <ide> throws BeansException { <ide> <ide> protected Object doCreateBean(final String beanName, final RootBeanDefinition mb <ide> "' to allow for resolving potential circular references"); <ide> } <ide> addSingletonFactory(beanName, new ObjectFactory() { <add> @Override <ide> public Object getObject() throws BeansException { <ide> return getEarlyBeanReference(beanName, mbd, bean); <ide> } <ide> class Holder { Class<?> value = null; } <ide> // @Bean methods, there may be parameters present. <ide> ReflectionUtils.doWithMethods(fbClass, <ide> new ReflectionUtils.MethodCallback() { <add> @Override <ide> public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { <ide> if (method.getName().equals(factoryMethodName) && <ide> FactoryBean.class.isAssignableFrom(method.getReturnType())) { <ide> protected BeanWrapper instantiateBean(final String beanName, final RootBeanDefin <ide> final BeanFactory parent = this; <ide> if (System.getSecurityManager() != null) { <ide> beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> return getInstantiationStrategy().instantiate(mbd, beanName, parent); <ide> } <ide> private Object convertForProperty(Object value, String propertyName, BeanWrapper <ide> protected Object initializeBean(final String beanName, final Object bean, RootBeanDefinition mbd) { <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> invokeAwareMethods(beanName, bean); <ide> return null; <ide> protected void invokeInitMethods(String beanName, final Object bean, RootBeanDef <ide> if (System.getSecurityManager() != null) { <ide> try { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> ((InitializingBean) bean).afterPropertiesSet(); <ide> return null; <ide> protected void invokeCustomInitMethod(String beanName, final Object bean, RootBe <ide> <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> ReflectionUtils.makeAccessible(initMethod); <ide> return null; <ide> } <ide> }); <ide> try { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> initMethod.invoke(bean); <ide> return null; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java <ide> public Class<?> getBeanClass() throws IllegalStateException { <ide> return (Class) beanClassObject; <ide> } <ide> <add> @Override <ide> public void setBeanClassName(String beanClassName) { <ide> this.beanClass = beanClassName; <ide> } <ide> <add> @Override <ide> public String getBeanClassName() { <ide> Object beanClassObject = this.beanClass; <ide> if (beanClassObject instanceof Class) { <ide> public Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundExcep <ide> * @see #SCOPE_SINGLETON <ide> * @see #SCOPE_PROTOTYPE <ide> */ <add> @Override <ide> public void setScope(String scope) { <ide> this.scope = scope; <ide> this.singleton = SCOPE_SINGLETON.equals(scope) || SCOPE_DEFAULT.equals(scope); <ide> public void setScope(String scope) { <ide> /** <ide> * Return the name of the target scope for the bean. <ide> */ <add> @Override <ide> public String getScope() { <ide> return this.scope; <ide> } <ide> public void setSingleton(boolean singleton) { <ide> * returned from all calls. <ide> * @see #SCOPE_SINGLETON <ide> */ <add> @Override <ide> public boolean isSingleton() { <ide> return this.singleton; <ide> } <ide> public boolean isSingleton() { <ide> * returned for each call. <ide> * @see #SCOPE_PROTOTYPE <ide> */ <add> @Override <ide> public boolean isPrototype() { <ide> return this.prototype; <ide> } <ide> public void setAbstract(boolean abstractFlag) { <ide> * Return whether this bean is "abstract", i.e. not meant to be instantiated <ide> * itself but rather just serving as parent for concrete child bean definitions. <ide> */ <add> @Override <ide> public boolean isAbstract() { <ide> return this.abstractFlag; <ide> } <ide> public boolean isAbstract() { <ide> * <p>If {@code false}, the bean will get instantiated on startup by bean <ide> * factories that perform eager initialization of singletons. <ide> */ <add> @Override <ide> public void setLazyInit(boolean lazyInit) { <ide> this.lazyInit = lazyInit; <ide> } <ide> public void setLazyInit(boolean lazyInit) { <ide> * Return whether this bean should be lazily initialized, i.e. not <ide> * eagerly instantiated on startup. Only applicable to a singleton bean. <ide> */ <add> @Override <ide> public boolean isLazyInit() { <ide> return this.lazyInit; <ide> } <ide> public int getDependencyCheck() { <ide> * constructor arguments. This property should just be necessary for other kinds <ide> * of dependencies like statics (*ugh*) or database preparation on startup. <ide> */ <add> @Override <ide> public void setDependsOn(String[] dependsOn) { <ide> this.dependsOn = dependsOn; <ide> } <ide> <ide> /** <ide> * Return the bean names that this bean depends on. <ide> */ <add> @Override <ide> public String[] getDependsOn() { <ide> return this.dependsOn; <ide> } <ide> <ide> /** <ide> * Set whether this bean is a candidate for getting autowired into some other bean. <ide> */ <add> @Override <ide> public void setAutowireCandidate(boolean autowireCandidate) { <ide> this.autowireCandidate = autowireCandidate; <ide> } <ide> <ide> /** <ide> * Return whether this bean is a candidate for getting autowired into some other bean. <ide> */ <add> @Override <ide> public boolean isAutowireCandidate() { <ide> return this.autowireCandidate; <ide> } <ide> public boolean isAutowireCandidate() { <ide> * If this value is true for exactly one bean among multiple <ide> * matching candidates, it will serve as a tie-breaker. <ide> */ <add> @Override <ide> public void setPrimary(boolean primary) { <ide> this.primary = primary; <ide> } <ide> public void setPrimary(boolean primary) { <ide> * If this value is true for exactly one bean among multiple <ide> * matching candidates, it will serve as a tie-breaker. <ide> */ <add> @Override <ide> public boolean isPrimary() { <ide> return this.primary; <ide> } <ide> public void setConstructorArgumentValues(ConstructorArgumentValues constructorAr <ide> /** <ide> * Return constructor argument values for this bean (never {@code null}). <ide> */ <add> @Override <ide> public ConstructorArgumentValues getConstructorArgumentValues() { <ide> return this.constructorArgumentValues; <ide> } <ide> public void setPropertyValues(MutablePropertyValues propertyValues) { <ide> /** <ide> * Return property values for this bean (never {@code null}). <ide> */ <add> @Override <ide> public MutablePropertyValues getPropertyValues() { <ide> return this.propertyValues; <ide> } <ide> public MethodOverrides getMethodOverrides() { <ide> } <ide> <ide> <add> @Override <ide> public void setFactoryBeanName(String factoryBeanName) { <ide> this.factoryBeanName = factoryBeanName; <ide> } <ide> <add> @Override <ide> public String getFactoryBeanName() { <ide> return this.factoryBeanName; <ide> } <ide> <add> @Override <ide> public void setFactoryMethodName(String factoryMethodName) { <ide> this.factoryMethodName = factoryMethodName; <ide> } <ide> <add> @Override <ide> public String getFactoryMethodName() { <ide> return this.factoryMethodName; <ide> } <ide> public void setRole(int role) { <ide> /** <ide> * Return the role hint for this {@code BeanDefinition}. <ide> */ <add> @Override <ide> public int getRole() { <ide> return this.role; <ide> } <ide> public void setDescription(String description) { <ide> this.description = description; <ide> } <ide> <add> @Override <ide> public String getDescription() { <ide> return this.description; <ide> } <ide> public void setResourceDescription(String resourceDescription) { <ide> this.resource = new DescriptiveResource(resourceDescription); <ide> } <ide> <add> @Override <ide> public String getResourceDescription() { <ide> return (this.resource != null ? this.resource.getDescription() : null); <ide> } <ide> public void setOriginatingBeanDefinition(BeanDefinition originatingBd) { <ide> this.resource = new BeanDefinitionResource(originatingBd); <ide> } <ide> <add> @Override <ide> public BeanDefinition getOriginatingBeanDefinition() { <ide> return (this.resource instanceof BeanDefinitionResource ? <ide> ((BeanDefinitionResource) this.resource).getBeanDefinition() : null); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java <ide> public final BeanDefinitionRegistry getBeanFactory() { <ide> return this.registry; <ide> } <ide> <add> @Override <ide> public final BeanDefinitionRegistry getRegistry() { <ide> return this.registry; <ide> } <ide> public void setResourceLoader(ResourceLoader resourceLoader) { <ide> this.resourceLoader = resourceLoader; <ide> } <ide> <add> @Override <ide> public ResourceLoader getResourceLoader() { <ide> return this.resourceLoader; <ide> } <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide> <add> @Override <ide> public ClassLoader getBeanClassLoader() { <ide> return this.beanClassLoader; <ide> } <ide> public void setEnvironment(Environment environment) { <ide> this.environment = environment; <ide> } <ide> <add> @Override <ide> public Environment getEnvironment() { <ide> return this.environment; <ide> } <ide> public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) { <ide> this.beanNameGenerator = (beanNameGenerator != null ? beanNameGenerator : new DefaultBeanNameGenerator()); <ide> } <ide> <add> @Override <ide> public BeanNameGenerator getBeanNameGenerator() { <ide> return this.beanNameGenerator; <ide> } <ide> <ide> <add> @Override <ide> public int loadBeanDefinitions(Resource... resources) throws BeanDefinitionStoreException { <ide> Assert.notNull(resources, "Resource array must not be null"); <ide> int counter = 0; <ide> public int loadBeanDefinitions(Resource... resources) throws BeanDefinitionStore <ide> return counter; <ide> } <ide> <add> @Override <ide> public int loadBeanDefinitions(String location) throws BeanDefinitionStoreException { <ide> return loadBeanDefinitions(location, null); <ide> } <ide> public int loadBeanDefinitions(String location, Set<Resource> actualResources) t <ide> } <ide> } <ide> <add> @Override <ide> public int loadBeanDefinitions(String... locations) throws BeanDefinitionStoreException { <ide> Assert.notNull(locations, "Location array must not be null"); <ide> int counter = 0; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java <ide> public AbstractBeanFactory(BeanFactory parentBeanFactory) { <ide> // Implementation of BeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public Object getBean(String name) throws BeansException { <ide> return doGetBean(name, null, null, false); <ide> } <ide> <add> @Override <ide> public <T> T getBean(String name, Class<T> requiredType) throws BeansException { <ide> return doGetBean(name, requiredType, null, false); <ide> } <ide> <add> @Override <ide> public Object getBean(String name, Object... args) throws BeansException { <ide> return doGetBean(name, null, args, false); <ide> } <ide> protected <T> T doGetBean( <ide> // Create bean instance. <ide> if (mbd.isSingleton()) { <ide> sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() { <add> @Override <ide> public Object getObject() throws BeansException { <ide> try { <ide> return createBean(beanName, mbd, args); <ide> else if (mbd.isPrototype()) { <ide> } <ide> try { <ide> Object scopedInstance = scope.get(beanName, new ObjectFactory<Object>() { <add> @Override <ide> public Object getObject() throws BeansException { <ide> beforePrototypeCreation(beanName); <ide> try { <ide> public Object getObject() throws BeansException { <ide> return (T) bean; <ide> } <ide> <add> @Override <ide> public boolean containsBean(String name) { <ide> String beanName = transformedBeanName(name); <ide> if (containsSingleton(beanName) || containsBeanDefinition(beanName)) { <ide> public boolean containsBean(String name) { <ide> return (parentBeanFactory != null && parentBeanFactory.containsBean(originalBeanName(name))); <ide> } <ide> <add> @Override <ide> public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { <ide> String beanName = transformedBeanName(name); <ide> <ide> else if (containsSingleton(beanName)) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { <ide> String beanName = transformedBeanName(name); <ide> <ide> public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { <ide> final FactoryBean<?> factoryBean = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName); <ide> if (System.getSecurityManager() != null) { <ide> return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { <add> @Override <ide> public Boolean run() { <ide> return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean<?>) factoryBean).isPrototype()) || <ide> !factoryBean.isSingleton()); <ide> public Boolean run() { <ide> } <ide> } <ide> <add> @Override <ide> public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException { <ide> String beanName = transformedBeanName(name); <ide> Class<?> typeToMatch = (targetType != null ? targetType : Object.class); <ide> else if (containsSingleton(beanName) && !containsBeanDefinition(beanName)) { <ide> } <ide> } <ide> <add> @Override <ide> public Class<?> getType(String name) throws NoSuchBeanDefinitionException { <ide> String beanName = transformedBeanName(name); <ide> <ide> public String[] getAliases(String name) { <ide> // Implementation of HierarchicalBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public BeanFactory getParentBeanFactory() { <ide> return this.parentBeanFactory; <ide> } <ide> <add> @Override <ide> public boolean containsLocalBean(String name) { <ide> String beanName = transformedBeanName(name); <ide> return ((containsSingleton(beanName) || containsBeanDefinition(beanName)) && <ide> public boolean containsLocalBean(String name) { <ide> // Implementation of ConfigurableBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void setParentBeanFactory(BeanFactory parentBeanFactory) { <ide> if (this.parentBeanFactory != null && this.parentBeanFactory != parentBeanFactory) { <ide> throw new IllegalStateException("Already associated with parent BeanFactory: " + this.parentBeanFactory); <ide> } <ide> this.parentBeanFactory = parentBeanFactory; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = (beanClassLoader != null ? beanClassLoader : ClassUtils.getDefaultClassLoader()); <ide> } <ide> <add> @Override <ide> public ClassLoader getBeanClassLoader() { <ide> return this.beanClassLoader; <ide> } <ide> <add> @Override <ide> public void setTempClassLoader(ClassLoader tempClassLoader) { <ide> this.tempClassLoader = tempClassLoader; <ide> } <ide> <add> @Override <ide> public ClassLoader getTempClassLoader() { <ide> return this.tempClassLoader; <ide> } <ide> <add> @Override <ide> public void setCacheBeanMetadata(boolean cacheBeanMetadata) { <ide> this.cacheBeanMetadata = cacheBeanMetadata; <ide> } <ide> <add> @Override <ide> public boolean isCacheBeanMetadata() { <ide> return this.cacheBeanMetadata; <ide> } <ide> <add> @Override <ide> public void setBeanExpressionResolver(BeanExpressionResolver resolver) { <ide> this.beanExpressionResolver = resolver; <ide> } <ide> <add> @Override <ide> public BeanExpressionResolver getBeanExpressionResolver() { <ide> return this.beanExpressionResolver; <ide> } <ide> <add> @Override <ide> public void setConversionService(ConversionService conversionService) { <ide> this.conversionService = conversionService; <ide> } <ide> <add> @Override <ide> public ConversionService getConversionService() { <ide> return this.conversionService; <ide> } <ide> <add> @Override <ide> public void addPropertyEditorRegistrar(PropertyEditorRegistrar registrar) { <ide> Assert.notNull(registrar, "PropertyEditorRegistrar must not be null"); <ide> this.propertyEditorRegistrars.add(registrar); <ide> public Set<PropertyEditorRegistrar> getPropertyEditorRegistrars() { <ide> return this.propertyEditorRegistrars; <ide> } <ide> <add> @Override <ide> public void registerCustomEditor(Class<?> requiredType, Class<? extends PropertyEditor> propertyEditorClass) { <ide> Assert.notNull(requiredType, "Required type must not be null"); <ide> Assert.isAssignable(PropertyEditor.class, propertyEditorClass); <ide> this.customEditors.put(requiredType, propertyEditorClass); <ide> } <ide> <add> @Override <ide> public void copyRegisteredEditorsTo(PropertyEditorRegistry registry) { <ide> registerCustomEditors(registry); <ide> } <ide> public Map<Class<?>, Class<? extends PropertyEditor>> getCustomEditors() { <ide> return this.customEditors; <ide> } <ide> <add> @Override <ide> public void setTypeConverter(TypeConverter typeConverter) { <ide> this.typeConverter = typeConverter; <ide> } <ide> protected TypeConverter getCustomTypeConverter() { <ide> return this.typeConverter; <ide> } <ide> <add> @Override <ide> public TypeConverter getTypeConverter() { <ide> TypeConverter customConverter = getCustomTypeConverter(); <ide> if (customConverter != null) { <ide> public TypeConverter getTypeConverter() { <ide> } <ide> } <ide> <add> @Override <ide> public void addEmbeddedValueResolver(StringValueResolver valueResolver) { <ide> Assert.notNull(valueResolver, "StringValueResolver must not be null"); <ide> this.embeddedValueResolvers.add(valueResolver); <ide> } <ide> <add> @Override <ide> public String resolveEmbeddedValue(String value) { <ide> String result = value; <ide> for (StringValueResolver resolver : this.embeddedValueResolvers) { <ide> public String resolveEmbeddedValue(String value) { <ide> return result; <ide> } <ide> <add> @Override <ide> public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) { <ide> Assert.notNull(beanPostProcessor, "BeanPostProcessor must not be null"); <ide> this.beanPostProcessors.remove(beanPostProcessor); <ide> public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) { <ide> } <ide> } <ide> <add> @Override <ide> public int getBeanPostProcessorCount() { <ide> return this.beanPostProcessors.size(); <ide> } <ide> protected boolean hasDestructionAwareBeanPostProcessors() { <ide> return this.hasDestructionAwareBeanPostProcessors; <ide> } <ide> <add> @Override <ide> public void registerScope(String scopeName, Scope scope) { <ide> Assert.notNull(scopeName, "Scope identifier must not be null"); <ide> Assert.notNull(scope, "Scope must not be null"); <ide> public void registerScope(String scopeName, Scope scope) { <ide> this.scopes.put(scopeName, scope); <ide> } <ide> <add> @Override <ide> public String[] getRegisteredScopeNames() { <ide> return StringUtils.toStringArray(this.scopes.keySet()); <ide> } <ide> <add> @Override <ide> public Scope getRegisteredScope(String scopeName) { <ide> Assert.notNull(scopeName, "Scope identifier must not be null"); <ide> return this.scopes.get(scopeName); <ide> public AccessControlContext getAccessControlContext() { <ide> AccessController.getContext()); <ide> } <ide> <add> @Override <ide> public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) { <ide> Assert.notNull(otherFactory, "BeanFactory must not be null"); <ide> setBeanClassLoader(otherFactory.getBeanClassLoader()); <ide> public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) { <ide> * @throws NoSuchBeanDefinitionException if there is no bean with the given name <ide> * @throws BeanDefinitionStoreException in case of an invalid bean definition <ide> */ <add> @Override <ide> public BeanDefinition getMergedBeanDefinition(String name) throws BeansException { <ide> String beanName = transformedBeanName(name); <ide> <ide> public BeanDefinition getMergedBeanDefinition(String name) throws BeansException <ide> return getMergedLocalBeanDefinition(beanName); <ide> } <ide> <add> @Override <ide> public boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException { <ide> String beanName = transformedBeanName(name); <ide> <ide> else if (curVal instanceof Set) { <ide> } <ide> } <ide> <add> @Override <ide> public void destroyBean(String beanName, Object beanInstance) { <ide> destroyBean(beanName, beanInstance, getMergedLocalBeanDefinition(beanName)); <ide> } <ide> protected void destroyBean(String beanName, Object beanInstance, RootBeanDefinit <ide> new DisposableBeanAdapter(beanInstance, beanName, mbd, getBeanPostProcessors(), getAccessControlContext()).destroy(); <ide> } <ide> <add> @Override <ide> public void destroyScopedBean(String beanName) { <ide> RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName); <ide> if (mbd.isSingleton() || mbd.isPrototype()) { <ide> protected Class<?> resolveBeanClass(final RootBeanDefinition mbd, String beanNam <ide> } <ide> if (System.getSecurityManager() != null) { <ide> return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() { <add> @Override <ide> public Class<?> run() throws Exception { <ide> return doResolveBeanClass(mbd, typesToMatch); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java <ide> abstract class AutowireUtils { <ide> */ <ide> public static void sortConstructors(Constructor[] constructors) { <ide> Arrays.sort(constructors, new Comparator<Constructor>() { <add> @Override <ide> public int compare(Constructor c1, Constructor c2) { <ide> boolean p1 = Modifier.isPublic(c1.getModifiers()); <ide> boolean p2 = Modifier.isPublic(c2.getModifiers()); <ide> public int compare(Constructor c1, Constructor c2) { <ide> */ <ide> public static void sortFactoryMethods(Method[] factoryMethods) { <ide> Arrays.sort(factoryMethods, new Comparator<Method>() { <add> @Override <ide> public int compare(Method fm1, Method fm2) { <ide> boolean p1 = Modifier.isPublic(fm1.getModifiers()); <ide> boolean p2 = Modifier.isPublic(fm2.getModifiers()); <ide> public ObjectFactoryDelegatingInvocationHandler(ObjectFactory objectFactory) { <ide> this.objectFactory = objectFactory; <ide> } <ide> <add> @Override <ide> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { <ide> String methodName = method.getName(); <ide> if (methodName.equals("equals")) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java <ide> public boolean isReadable() { <ide> return false; <ide> } <ide> <add> @Override <ide> public InputStream getInputStream() throws IOException { <ide> throw new FileNotFoundException( <ide> "Resource cannot be opened because it points to " + getDescription()); <ide> } <ide> <add> @Override <ide> public String getDescription() { <ide> return "BeanDefinition defined in " + this.beanDefinition.getResourceDescription(); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java <ide> public int hashCode() { <ide> */ <ide> private class LookupOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor { <ide> <add> @Override <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable { <ide> // Cast is safe, as CallbackFilter filters are used selectively. <ide> LookupOverride lo = (LookupOverride) beanDefinition.getMethodOverrides().getOverride(method); <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp <ide> */ <ide> private class ReplaceOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor { <ide> <add> @Override <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable { <ide> ReplaceOverride ro = (ReplaceOverride) beanDefinition.getMethodOverrides().getOverride(method); <ide> // TODO could cache if a singleton for minor performance optimization <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp <ide> */ <ide> private class CallbackFilterImpl extends CglibIdentitySupport implements CallbackFilter { <ide> <add> @Override <ide> public int accept(Method method) { <ide> MethodOverride methodOverride = beanDefinition.getMethodOverrides().getOverride(method); <ide> if (logger.isTraceEnabled()) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java <ide> public ChildBeanDefinition(ChildBeanDefinition original) { <ide> } <ide> <ide> <add> @Override <ide> public void setParentName(String parentName) { <ide> this.parentName = parentName; <ide> } <ide> <add> @Override <ide> public String getParentName() { <ide> return this.parentName; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java <ide> else if (ambiguousConstructors != null && !mbd.isLenientConstructorResolution()) <ide> final Constructor ctorToUse = constructorToUse; <ide> final Object[] argumentsToUse = argsToUse; <ide> beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> return beanFactory.getInstantiationStrategy().instantiate( <ide> mbd, beanName, beanFactory, ctorToUse, argumentsToUse); <ide> public BeanWrapper instantiateUsingFactoryMethod(final String beanName, final Ro <ide> final Class factoryClazz = factoryClass; <ide> if (System.getSecurityManager() != null) { <ide> rawCandidates = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { <add> @Override <ide> public Method[] run() { <ide> return (mbd.isNonPublicAccessAllowed() ? <ide> ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods()); <ide> else if (ambiguousFactoryMethods != null && !mbd.isLenientConstructorResolution( <ide> final Method factoryMethod = factoryMethodToUse; <ide> final Object[] args = argsToUse; <ide> beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> return beanFactory.getInstantiationStrategy().instantiate( <ide> mbd, beanName, beanFactory, fb, factoryMethod, args); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultBeanNameGenerator.java <ide> */ <ide> public class DefaultBeanNameGenerator implements BeanNameGenerator { <ide> <add> @Override <ide> public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) { <ide> return BeanDefinitionReaderUtils.generateBeanName(definition, registry); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java <ide> public void setAutowireCandidateResolver(final AutowireCandidateResolver autowir <ide> if (System.getSecurityManager() != null) { <ide> final BeanFactory target = this; <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> ((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(target); <ide> return null; <ide> public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) { <ide> // Implementation of ListableBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public <T> T getBean(Class<T> requiredType) throws BeansException { <ide> Assert.notNull(requiredType, "Required type must not be null"); <ide> String[] beanNames = getBeanNamesForType(requiredType); <ide> public boolean containsBeanDefinition(String beanName) { <ide> return this.beanDefinitionMap.containsKey(beanName); <ide> } <ide> <add> @Override <ide> public int getBeanDefinitionCount() { <ide> return this.beanDefinitionMap.size(); <ide> } <ide> <add> @Override <ide> public String[] getBeanDefinitionNames() { <ide> synchronized (this.beanDefinitionMap) { <ide> if (this.frozenBeanDefinitionNames != null) { <ide> public String[] getBeanDefinitionNames() { <ide> } <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class<?> type) { <ide> return getBeanNamesForType(type, true, true); <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) { <ide> if (!isConfigurationFrozen() || type == null || !allowEagerInit) { <ide> return doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit); <ide> private boolean requiresEagerInitForType(String factoryBeanName) { <ide> return (factoryBeanName != null && isFactoryBean(factoryBeanName) && !containsSingleton(factoryBeanName)); <ide> } <ide> <add> @Override <ide> public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException { <ide> return getBeansOfType(type, true, true); <ide> } <ide> <add> @Override <ide> public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) <ide> throws BeansException { <ide> <ide> public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingle <ide> return result; <ide> } <ide> <add> @Override <ide> public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) { <ide> Set<String> beanNames = new LinkedHashSet<String>(getBeanDefinitionCount()); <ide> beanNames.addAll(Arrays.asList(getBeanDefinitionNames())); <ide> public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> an <ide> * found on the given class itself, as well as checking its raw bean class <ide> * if not found on the exposed bean reference (e.g. in case of a proxy). <ide> */ <add> @Override <ide> public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) { <ide> A ann = null; <ide> Class<?> beanType = getType(beanName); <ide> public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> a <ide> // Implementation of ConfigurableListableBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue) { <ide> Assert.notNull(dependencyType, "Type must not be null"); <ide> if (autowiredValue != null) { <ide> public void registerResolvableDependency(Class<?> dependencyType, Object autowir <ide> } <ide> } <ide> <add> @Override <ide> public boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor) <ide> throws NoSuchBeanDefinitionException { <ide> <ide> public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefini <ide> return bd; <ide> } <ide> <add> @Override <ide> public void freezeConfiguration() { <ide> this.configurationFrozen = true; <ide> synchronized (this.beanDefinitionMap) { <ide> this.frozenBeanDefinitionNames = StringUtils.toStringArray(this.beanDefinitionNames); <ide> } <ide> } <ide> <add> @Override <ide> public boolean isConfigurationFrozen() { <ide> return this.configurationFrozen; <ide> } <ide> protected boolean isBeanEligibleForMetadataCaching(String beanName) { <ide> return (this.configurationFrozen || super.isBeanEligibleForMetadataCaching(beanName)); <ide> } <ide> <add> @Override <ide> public void preInstantiateSingletons() throws BeansException { <ide> if (this.logger.isInfoEnabled()) { <ide> this.logger.info("Pre-instantiating singletons in " + this); <ide> public void preInstantiateSingletons() throws BeansException { <ide> boolean isEagerInit; <ide> if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) { <ide> isEagerInit = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { <add> @Override <ide> public Boolean run() { <ide> return ((SmartFactoryBean<?>) factory).isEagerInit(); <ide> } <ide> public Boolean run() { <ide> // Implementation of BeanDefinitionRegistry interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) <ide> throws BeanDefinitionStoreException { <ide> <ide> public void registerBeanDefinition(String beanName, BeanDefinition beanDefinitio <ide> resetBeanDefinition(beanName); <ide> } <ide> <add> @Override <ide> public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { <ide> Assert.hasText(beanName, "'beanName' must not be empty"); <ide> <ide> protected boolean allowAliasOverriding() { <ide> // Dependency resolution functionality <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public Object resolveDependency(DependencyDescriptor descriptor, String beanName, <ide> Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException { <ide> <ide> public DependencyObjectFactory(DependencyDescriptor descriptor, String beanName) <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public Object getObject() throws BeansException { <ide> return doResolveDependency(this.descriptor, this.descriptor.getDependencyType(), this.beanName, null, null); <ide> } <ide> public DependencyProvider(DependencyDescriptor descriptor, String beanName) { <ide> super(descriptor, beanName); <ide> } <ide> <add> @Override <ide> public Object get() throws BeansException { <ide> return getObject(); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java <ide> public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements <ide> private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<String, Set<String>>(64); <ide> <ide> <add> @Override <ide> public void registerSingleton(String beanName, Object singletonObject) throws IllegalStateException { <ide> Assert.notNull(beanName, "'beanName' must not be null"); <ide> synchronized (this.singletonObjects) { <ide> protected void addSingletonFactory(String beanName, ObjectFactory singletonFacto <ide> } <ide> } <ide> <add> @Override <ide> public Object getSingleton(String beanName) { <ide> return getSingleton(beanName, true); <ide> } <ide> protected void removeSingleton(String beanName) { <ide> } <ide> } <ide> <add> @Override <ide> public boolean containsSingleton(String beanName) { <ide> return (this.singletonObjects.containsKey(beanName)); <ide> } <ide> <add> @Override <ide> public String[] getSingletonNames() { <ide> synchronized (this.singletonObjects) { <ide> return StringUtils.toStringArray(this.registeredSingletons); <ide> } <ide> } <ide> <add> @Override <ide> public int getSingletonCount() { <ide> synchronized (this.singletonObjects) { <ide> return this.registeredSingletons.size(); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java <ide> private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPo <ide> } <ide> <ide> <add> @Override <ide> public void run() { <ide> destroy(); <ide> } <ide> <add> @Override <ide> public void destroy() { <ide> if (this.beanPostProcessors != null && !this.beanPostProcessors.isEmpty()) { <ide> for (DestructionAwareBeanPostProcessor processor : this.beanPostProcessors) { <ide> public void destroy() { <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> ((DisposableBean) bean).destroy(); <ide> return null; <ide> private Method determineDestroyMethod() { <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> return AccessController.doPrivileged(new PrivilegedAction<Method>() { <add> @Override <ide> public Method run() { <ide> return findDestroyMethod(); <ide> } <ide> private void invokeCustomDestroyMethod(final Method destroyMethod) { <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> ReflectionUtils.makeAccessible(destroyMethod); <ide> return null; <ide> } <ide> }); <ide> try { <ide> AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> destroyMethod.invoke(bean, args); <ide> return null; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java <ide> protected Class getTypeForFactoryBean(final FactoryBean factoryBean) { <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> return AccessController.doPrivileged(new PrivilegedAction<Class>() { <add> @Override <ide> public Class run() { <ide> return factoryBean.getObjectType(); <ide> } <ide> private Object doGetObjectFromFactoryBean( <ide> AccessControlContext acc = getAccessControlContext(); <ide> try { <ide> object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { <add> @Override <ide> public Object run() throws Exception { <ide> return factory.getObject(); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java <ide> public GenericBeanDefinition(BeanDefinition original) { <ide> } <ide> <ide> <add> @Override <ide> public void setParentName(String parentName) { <ide> this.parentName = parentName; <ide> } <ide> <add> @Override <ide> public String getParentName() { <ide> return this.parentName; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide> public void setMergeEnabled(boolean mergeEnabled) { <ide> this.mergeEnabled = mergeEnabled; <ide> } <ide> <add> @Override <ide> public boolean isMergeEnabled() { <ide> return this.mergeEnabled; <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public List<E> merge(Object parent) { <ide> if (!this.mergeEnabled) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedMap.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide> public void setMergeEnabled(boolean mergeEnabled) { <ide> this.mergeEnabled = mergeEnabled; <ide> } <ide> <add> @Override <ide> public boolean isMergeEnabled() { <ide> return this.mergeEnabled; <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public Object merge(Object parent) { <ide> if (!this.mergeEnabled) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedProperties.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide> public void setMergeEnabled(boolean mergeEnabled) { <ide> this.mergeEnabled = mergeEnabled; <ide> } <ide> <add> @Override <ide> public boolean isMergeEnabled() { <ide> return this.mergeEnabled; <ide> } <ide> <ide> <add> @Override <ide> public Object merge(Object parent) { <ide> if (!this.mergeEnabled) { <ide> throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'"); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide> public void setMergeEnabled(boolean mergeEnabled) { <ide> this.mergeEnabled = mergeEnabled; <ide> } <ide> <add> @Override <ide> public boolean isMergeEnabled() { <ide> return this.mergeEnabled; <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public Set<E> merge(Object parent) { <ide> if (!this.mergeEnabled) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java <ide> public PropertiesPersister getPropertiesPersister() { <ide> * @throws BeanDefinitionStoreException in case of loading or parsing errors <ide> * @see #loadBeanDefinitions(org.springframework.core.io.Resource, String) <ide> */ <add> @Override <ide> public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException { <ide> return loadBeanDefinitions(new EncodedResource(resource), null); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java <ide> public RootBeanDefinition(RootBeanDefinition original) { <ide> } <ide> <ide> <add> @Override <ide> public String getParentName() { <ide> return null; <ide> } <ide> <add> @Override <ide> public void setParentName(String parentName) { <ide> if (parentName != null) { <ide> throw new IllegalArgumentException("Root bean cannot be changed into a child bean with parent reference"); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleAutowireCandidateResolver.java <ide> public class SimpleAutowireCandidateResolver implements AutowireCandidateResolve <ide> * <p>To be considered a candidate the bean's <em>autowire-candidate</em> <ide> * attribute must not have been set to 'false'. <ide> */ <add> @Override <ide> public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) { <ide> return bdHolder.getBeanDefinition().isAutowireCandidate(); <ide> } <ide> <add> @Override <ide> public Object getSuggestedValue(DependencyDescriptor descriptor) { <ide> return null; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleBeanDefinitionRegistry.java <ide> public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements <ide> private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(64); <ide> <ide> <add> @Override <ide> public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) <ide> throws BeanDefinitionStoreException { <ide> <ide> public void registerBeanDefinition(String beanName, BeanDefinition beanDefinitio <ide> this.beanDefinitionMap.put(beanName, beanDefinition); <ide> } <ide> <add> @Override <ide> public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { <ide> if (this.beanDefinitionMap.remove(beanName) == null) { <ide> throw new NoSuchBeanDefinitionException(beanName); <ide> } <ide> } <ide> <add> @Override <ide> public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { <ide> BeanDefinition bd = this.beanDefinitionMap.get(beanName); <ide> if (bd == null) { <ide> public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefini <ide> return bd; <ide> } <ide> <add> @Override <ide> public boolean containsBeanDefinition(String beanName) { <ide> return this.beanDefinitionMap.containsKey(beanName); <ide> } <ide> <add> @Override <ide> public String[] getBeanDefinitionNames() { <ide> return StringUtils.toStringArray(this.beanDefinitionMap.keySet()); <ide> } <ide> <add> @Override <ide> public int getBeanDefinitionCount() { <ide> return this.beanDefinitionMap.size(); <ide> } <ide> <add> @Override <ide> public boolean isBeanNameInUse(String beanName) { <ide> return isAlias(beanName) || containsBeanDefinition(beanName); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java <ide> public static Method getCurrentlyInvokedFactoryMethod() { <ide> } <ide> <ide> <add> @Override <ide> public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner) { <ide> // Don't override the class with CGLIB if no overrides. <ide> if (beanDefinition.getMethodOverrides().isEmpty()) { <ide> public Object instantiate(RootBeanDefinition beanDefinition, String beanName, Be <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor>() { <add> @Override <ide> public Constructor run() throws Exception { <ide> return clazz.getDeclaredConstructor((Class[]) null); <ide> } <ide> protected Object instantiateWithMethodInjection( <ide> "Method Injection not supported in SimpleInstantiationStrategy"); <ide> } <ide> <add> @Override <ide> public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, <ide> final Constructor<?> ctor, Object[] args) { <ide> <ide> if (beanDefinition.getMethodOverrides().isEmpty()) { <ide> if (System.getSecurityManager() != null) { <ide> // use own privileged to change accessibility (when security is on) <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> ReflectionUtils.makeAccessible(ctor); <ide> return null; <ide> protected Object instantiateWithMethodInjection(RootBeanDefinition beanDefinitio <ide> "Method Injection not supported in SimpleInstantiationStrategy"); <ide> } <ide> <add> @Override <ide> public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, <ide> Object factoryBean, final Method factoryMethod, Object[] args) { <ide> <ide> try { <ide> if (System.getSecurityManager() != null) { <ide> AccessController.doPrivileged(new PrivilegedAction<Object>() { <add> @Override <ide> public Object run() { <ide> ReflectionUtils.makeAccessible(factoryMethod); <ide> return null; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleSecurityContextProvider.java <ide> public SimpleSecurityContextProvider(AccessControlContext acc) { <ide> } <ide> <ide> <add> @Override <ide> public AccessControlContext getAccessControlContext() { <ide> return (this.acc != null ? acc : AccessController.getContext()); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java <ide> public void addBean(String name, Object bean) { <ide> // Implementation of BeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public Object getBean(String name) throws BeansException { <ide> String beanName = BeanFactoryUtils.transformedBeanName(name); <ide> Object bean = this.beans.get(beanName); <ide> public Object getBean(String name) throws BeansException { <ide> } <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public <T> T getBean(String name, Class<T> requiredType) throws BeansException { <ide> Object bean = getBean(name); <ide> public <T> T getBean(String name, Class<T> requiredType) throws BeansException { <ide> return (T) bean; <ide> } <ide> <add> @Override <ide> public <T> T getBean(Class<T> requiredType) throws BeansException { <ide> String[] beanNames = getBeanNamesForType(requiredType); <ide> if (beanNames.length == 1) { <ide> public <T> T getBean(Class<T> requiredType) throws BeansException { <ide> } <ide> } <ide> <add> @Override <ide> public Object getBean(String name, Object... args) throws BeansException { <ide> if (args != null) { <ide> throw new UnsupportedOperationException( <ide> public Object getBean(String name, Object... args) throws BeansException { <ide> return getBean(name); <ide> } <ide> <add> @Override <ide> public boolean containsBean(String name) { <ide> return this.beans.containsKey(name); <ide> } <ide> <add> @Override <ide> public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { <ide> Object bean = getBean(name); <ide> // In case of FactoryBean, return singleton status of created object. <ide> return (bean instanceof FactoryBean && ((FactoryBean) bean).isSingleton()); <ide> } <ide> <add> @Override <ide> public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { <ide> Object bean = getBean(name); <ide> // In case of FactoryBean, return prototype status of created object. <ide> return ((bean instanceof SmartFactoryBean && ((SmartFactoryBean) bean).isPrototype()) || <ide> (bean instanceof FactoryBean && !((FactoryBean) bean).isSingleton())); <ide> } <ide> <add> @Override <ide> public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { <ide> Class type = getType(name); <ide> return (targetType == null || (type != null && targetType.isAssignableFrom(type))); <ide> } <ide> <add> @Override <ide> public Class<?> getType(String name) throws NoSuchBeanDefinitionException { <ide> String beanName = BeanFactoryUtils.transformedBeanName(name); <ide> <ide> public Class<?> getType(String name) throws NoSuchBeanDefinitionException { <ide> return bean.getClass(); <ide> } <ide> <add> @Override <ide> public String[] getAliases(String name) { <ide> return new String[0]; <ide> } <ide> public String[] getAliases(String name) { <ide> // Implementation of ListableBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public boolean containsBeanDefinition(String name) { <ide> return this.beans.containsKey(name); <ide> } <ide> <add> @Override <ide> public int getBeanDefinitionCount() { <ide> return this.beans.size(); <ide> } <ide> <add> @Override <ide> public String[] getBeanDefinitionNames() { <ide> return StringUtils.toStringArray(this.beans.keySet()); <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class type) { <ide> return getBeanNamesForType(type, true, true); <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean includeFactoryBeans) { <ide> boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type)); <ide> List<String> matches = new ArrayList<String>(); <ide> public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, bo <ide> return StringUtils.toStringArray(matches); <ide> } <ide> <add> @Override <ide> public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException { <ide> return getBeansOfType(type, true, true); <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean includeFactoryBeans) <ide> throws BeansException { <ide> public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingle <ide> return matches; <ide> } <ide> <add> @Override <ide> public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) <ide> throws BeansException { <ide> <ide> public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> an <ide> return results; <ide> } <ide> <add> @Override <ide> public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) { <ide> return AnnotationUtils.findAnnotation(getType(beanName), annotationType); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java <ide> public void setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResol <ide> /** <ide> * Set the {@link BeanFactory} in which this aspect must configure beans. <ide> */ <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> if (!(beanFactory instanceof ConfigurableListableBeanFactory)) { <ide> throw new IllegalArgumentException( <ide> protected BeanWiringInfoResolver createDefaultBeanWiringInfoResolver() { <ide> /** <ide> * Check that a {@link BeanFactory} has been set. <ide> */ <add> @Override <ide> public void afterPropertiesSet() { <ide> Assert.notNull(this.beanFactory, "BeanFactory must be set"); <ide> } <ide> public void afterPropertiesSet() { <ide> * Release references to the {@link BeanFactory} and <ide> * {@link BeanWiringInfoResolver} when the container is destroyed. <ide> */ <add> @Override <ide> public void destroy() { <ide> this.beanFactory = null; <ide> this.beanWiringInfoResolver = null; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/wiring/ClassNameBeanWiringInfoResolver.java <ide> */ <ide> public class ClassNameBeanWiringInfoResolver implements BeanWiringInfoResolver { <ide> <add> @Override <ide> public BeanWiringInfo resolveWiringInfo(Object beanInstance) { <ide> Assert.notNull(beanInstance, "Bean instance must not be null"); <ide> return new BeanWiringInfo(ClassUtils.getUserClass(beanInstance).getName(), true); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java <ide> public abstract class AbstractBeanDefinitionParser implements BeanDefinitionPars <ide> /** Constant for the name attribute */ <ide> public static final String NAME_ATTRIBUTE = "name"; <ide> <add> @Override <ide> public final BeanDefinition parse(Element element, ParserContext parserContext) { <ide> AbstractBeanDefinition definition = parseInternal(element, parserContext); <ide> if (definition != null && !parserContext.isNested()) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java <ide> public class BeansDtdResolver implements EntityResolver { <ide> private static final Log logger = LogFactory.getLog(BeansDtdResolver.class); <ide> <ide> <add> @Override <ide> public InputSource resolveEntity(String publicId, String systemId) throws IOException { <ide> if (logger.isTraceEnabled()) { <ide> logger.trace("Trying to resolve XML entity with public ID [" + publicId + <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java <ide> public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume <ide> * {@code <beans/>} element with a {@code profile} attribute present. <ide> * @see #doRegisterBeanDefinitions <ide> */ <add> @Override <ide> public void setEnvironment(Environment environment) { <ide> this.environment = environment; <ide> } <ide> public void setEnvironment(Environment environment) { <ide> * <p>Opens a DOM Document; then initializes the default settings <ide> * specified at the {@code <beans/>} level; then parses the contained bean definitions. <ide> */ <add> @Override <ide> public void registerBeanDefinitions(Document doc, XmlReaderContext readerContext) { <ide> this.readerContext = readerContext; <ide> <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java <ide> public class DefaultDocumentLoader implements DocumentLoader { <ide> * Load the {@link Document} at the supplied {@link InputSource} using the standard JAXP-configured <ide> * XML parser. <ide> */ <add> @Override <ide> public Document loadDocument(InputSource inputSource, EntityResolver entityResolver, <ide> ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws Exception { <ide> <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java <ide> public DefaultNamespaceHandlerResolver(ClassLoader classLoader, String handlerMa <ide> * @param namespaceUri the relevant namespace URI <ide> * @return the located {@link NamespaceHandler}, or {@code null} if none found <ide> */ <add> @Override <ide> public NamespaceHandler resolve(String namespaceUri) { <ide> Map<String, Object> handlerMappings = getHandlerMappings(); <ide> Object handlerOrClassName = handlerMappings.get(namespaceUri); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java <ide> public DelegatingEntityResolver(EntityResolver dtdResolver, EntityResolver schem <ide> } <ide> <ide> <add> @Override <ide> public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { <ide> if (systemId != null) { <ide> if (systemId.endsWith(DTD_SUFFIX)) { <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/DocumentDefaultsDefinition.java <ide> public void setSource(Object source) { <ide> this.source = source; <ide> } <ide> <add> @Override <ide> public Object getSource() { <ide> return this.source; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java <ide> public abstract class NamespaceHandlerSupport implements NamespaceHandler { <ide> * Parses the supplied {@link Element} by delegating to the {@link BeanDefinitionParser} that is <ide> * registered for that {@link Element}. <ide> */ <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> return findParserForElement(element, parserContext).parse(element, parserContext); <ide> } <ide> private BeanDefinitionParser findParserForElement(Element element, ParserContext <ide> * Decorates the supplied {@link Node} by delegating to the {@link BeanDefinitionDecorator} that <ide> * is registered to handle that {@link Node}. <ide> */ <add> @Override <ide> public BeanDefinitionHolder decorate( <ide> Node node, BeanDefinitionHolder definition, ParserContext parserContext) { <ide> <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java <ide> public PluggableSchemaResolver(ClassLoader classLoader, String schemaMappingsLoc <ide> this.schemaMappingsLocation = schemaMappingsLocation; <ide> } <ide> <add> @Override <ide> public InputSource resolveEntity(String publicId, String systemId) throws IOException { <ide> if (logger.isTraceEnabled()) { <ide> logger.trace("Trying to resolve XML entity with public id [" + publicId + <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java <ide> public class SimpleConstructorNamespaceHandler implements NamespaceHandler { <ide> private static final String REF_SUFFIX = "-ref"; <ide> private static final String DELIMITER_PREFIX = "_"; <ide> <add> @Override <ide> public void init() { <ide> } <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> parserContext.getReaderContext().error( <ide> "Class [" + getClass().getName() + "] does not support custom elements.", element); <ide> return null; <ide> } <ide> <add> @Override <ide> public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) { <ide> if (node instanceof Attr) { <ide> Attr attr = (Attr) node; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandler.java <ide> public class SimplePropertyNamespaceHandler implements NamespaceHandler { <ide> private static final String REF_SUFFIX = "-ref"; <ide> <ide> <add> @Override <ide> public void init() { <ide> } <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> parserContext.getReaderContext().error( <ide> "Class [" + getClass().getName() + "] does not support custom elements.", element); <ide> return null; <ide> } <ide> <add> @Override <ide> public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) { <ide> if (node instanceof Attr) { <ide> Attr attr = (Attr) node; <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/UtilNamespaceHandler.java <ide> public class UtilNamespaceHandler extends NamespaceHandlerSupport { <ide> private static final String SCOPE_ATTRIBUTE = "scope"; <ide> <ide> <add> @Override <ide> public void init() { <ide> registerBeanDefinitionParser("constant", new ConstantBeanDefinitionParser()); <ide> registerBeanDefinitionParser("property-path", new PropertyPathBeanDefinitionParser()); <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java <ide> public void setDocumentReaderClass(Class<?> documentReaderClass) { <ide> * @return the number of bean definitions found <ide> * @throws BeanDefinitionStoreException in case of loading or parsing errors <ide> */ <add> @Override <ide> public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException { <ide> return loadBeanDefinitions(new EncodedResource(resource)); <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/support/MutableSortDefinition.java <ide> public void setProperty(String property) { <ide> } <ide> } <ide> <add> @Override <ide> public String getProperty() { <ide> return this.property; <ide> } <ide> public void setIgnoreCase(boolean ignoreCase) { <ide> this.ignoreCase = ignoreCase; <ide> } <ide> <add> @Override <ide> public boolean isIgnoreCase() { <ide> return this.ignoreCase; <ide> } <ide> public void setAscending(boolean ascending) { <ide> this.ascending = ascending; <ide> } <ide> <add> @Override <ide> public boolean isAscending() { <ide> return this.ascending; <ide> } <ide><path>spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java <ide> public final SortDefinition getSortDefinition() { <ide> } <ide> <ide> <add> @Override <ide> public int compare(Object o1, Object o2) { <ide> Object v1 = getPropertyValue(o1); <ide> Object v2 = getPropertyValue(o2); <ide><path>spring-beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java <ide> public ResourceEditorRegistrar(ResourceLoader resourceLoader, PropertyResolver p <ide> * @see org.springframework.beans.propertyeditors.ClassArrayEditor <ide> * @see org.springframework.core.io.support.ResourceArrayPropertyEditor <ide> */ <add> @Override <ide> public void registerCustomEditors(PropertyEditorRegistry registry) { <ide> ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver); <ide> doRegisterEditor(registry, Resource.class, baseEditor); <ide><path>spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCache.java <ide> public EhCacheCache(Ehcache ehcache) { <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.cache.getName(); <ide> } <ide> <add> @Override <ide> public Ehcache getNativeCache() { <ide> return this.cache; <ide> } <ide> <add> @Override <ide> public ValueWrapper get(Object key) { <ide> Element element = this.cache.get(key); <ide> return (element != null ? new SimpleValueWrapper(element.getObjectValue()) : null); <ide> } <ide> <add> @Override <ide> public void put(Object key, Object value) { <ide> this.cache.put(new Element(key, value)); <ide> } <ide> <add> @Override <ide> public void evict(Object key) { <ide> this.cache.remove(key); <ide> } <ide> <add> @Override <ide> public void clear() { <ide> this.cache.removeAll(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java <ide> public void setDisabled(boolean disabled) { <ide> this.disabled = disabled; <ide> } <ide> <add> @Override <ide> public void setBeanName(String name) { <ide> this.beanName = name; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws CacheException, IOException { <ide> // If no CacheManager given, fetch the default. <ide> if (this.cacheManager == null) { <ide> protected Ehcache decorateCache(Ehcache cache) { <ide> } <ide> <ide> <add> @Override <ide> public Ehcache getObject() { <ide> return this.cache; <ide> } <ide> public Ehcache getObject() { <ide> * {@link #getObject()} based on logic in {@link #createCache()} and <ide> * {@link #decorateCache(Ehcache)} as orchestrated by {@link #afterPropertiesSet()}. <ide> */ <add> @Override <ide> public Class<? extends Ehcache> getObjectType() { <ide> if (this.cache != null) { <ide> return this.cache.getClass(); <ide> public Class<? extends Ehcache> getObjectType() { <ide> return Cache.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java <ide> public void setCacheManagerName(String cacheManagerName) { <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws IOException, CacheException { <ide> logger.info("Initializing EHCache CacheManager"); <ide> if (this.configLocation != null) { <ide> public void afterPropertiesSet() throws IOException, CacheException { <ide> } <ide> <ide> <add> @Override <ide> public CacheManager getObject() { <ide> return this.cacheManager; <ide> } <ide> <add> @Override <ide> public Class<? extends CacheManager> getObjectType() { <ide> return (this.cacheManager != null ? this.cacheManager.getClass() : CacheManager.class); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide> <ide> <add> @Override <ide> public void destroy() { <ide> logger.info("Shutting down EHCache CacheManager"); <ide> this.cacheManager.shutdown(); <ide><path>spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java <ide> public JCacheCache(javax.cache.Cache<?,?> jcache, boolean allowNullValues) { <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.cache.getName(); <ide> } <ide> <add> @Override <ide> public javax.cache.Cache<?,?> getNativeCache() { <ide> return this.cache; <ide> } <ide> public boolean isAllowNullValues() { <ide> return this.allowNullValues; <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public ValueWrapper get(Object key) { <ide> Object value = this.cache.get(key); <ide> return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null); <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void put(Object key, Object value) { <ide> this.cache.put(key, toStoreValue(value)); <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void evict(Object key) { <ide> this.cache.remove(key); <ide> } <ide> <add> @Override <ide> public void clear() { <ide> this.cache.removeAll(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheManagerFactoryBean.java <ide> public void setCacheManagerName(String cacheManagerName) { <ide> this.cacheManagerName = cacheManagerName; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> this.beanClassLoader = classLoader; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> this.cacheManager = (this.beanClassLoader != null ? <ide> Caching.getCacheManager(this.beanClassLoader, this.cacheManagerName) : <ide> Caching.getCacheManager(this.cacheManagerName)); <ide> } <ide> <ide> <add> @Override <ide> public CacheManager getObject() { <ide> return this.cacheManager; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return (this.cacheManager != null ? this.cacheManager.getClass() : CacheManager.class); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide> <ide> <add> @Override <ide> public void destroy() { <ide> this.cacheManager.shutdown(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java <ide> public TransactionAwareCacheDecorator(Cache targetCache) { <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.targetCache.getName(); <ide> } <ide> <add> @Override <ide> public Object getNativeCache() { <ide> return this.targetCache.getNativeCache(); <ide> } <ide> <add> @Override <ide> public ValueWrapper get(Object key) { <ide> return this.targetCache.get(key); <ide> } <ide> <add> @Override <ide> public void put(final Object key, final Object value) { <ide> if (TransactionSynchronizationManager.isSynchronizationActive()) { <ide> TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { <ide> public void afterCommit() { <ide> } <ide> } <ide> <add> @Override <ide> public void evict(final Object key) { <ide> if (TransactionSynchronizationManager.isSynchronizationActive()) { <ide> TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { <ide> public void afterCommit() { <ide> } <ide> } <ide> <add> @Override <ide> public void clear() { <ide> this.targetCache.clear(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java <ide> public void setTargetCacheManager(CacheManager targetCacheManager) { <ide> this.targetCacheManager = targetCacheManager; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.targetCacheManager == null) { <ide> throw new IllegalStateException("'targetCacheManager' is required"); <ide> } <ide> } <ide> <ide> <add> @Override <ide> public Cache getCache(String name) { <ide> return new TransactionAwareCacheDecorator(this.targetCacheManager.getCache(name)); <ide> } <ide> <add> @Override <ide> public Collection<String> getCacheNames() { <ide> return this.targetCacheManager.getCacheNames(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java <ide> public SimpleMailMessage(SimpleMailMessage original) { <ide> } <ide> <ide> <add> @Override <ide> public void setFrom(String from) { <ide> this.from = from; <ide> } <ide> public String getFrom() { <ide> return this.from; <ide> } <ide> <add> @Override <ide> public void setReplyTo(String replyTo) { <ide> this.replyTo = replyTo; <ide> } <ide> public String getReplyTo() { <ide> return replyTo; <ide> } <ide> <add> @Override <ide> public void setTo(String to) { <ide> this.to = new String[] {to}; <ide> } <ide> <add> @Override <ide> public void setTo(String[] to) { <ide> this.to = to; <ide> } <ide> public String[] getTo() { <ide> return this.to; <ide> } <ide> <add> @Override <ide> public void setCc(String cc) { <ide> this.cc = new String[] {cc}; <ide> } <ide> <add> @Override <ide> public void setCc(String[] cc) { <ide> this.cc = cc; <ide> } <ide> public String[] getCc() { <ide> return cc; <ide> } <ide> <add> @Override <ide> public void setBcc(String bcc) { <ide> this.bcc = new String[] {bcc}; <ide> } <ide> <add> @Override <ide> public void setBcc(String[] bcc) { <ide> this.bcc = bcc; <ide> } <ide> public String[] getBcc() { <ide> return bcc; <ide> } <ide> <add> @Override <ide> public void setSentDate(Date sentDate) { <ide> this.sentDate = sentDate; <ide> } <ide> public Date getSentDate() { <ide> return sentDate; <ide> } <ide> <add> @Override <ide> public void setSubject(String subject) { <ide> this.subject = subject; <ide> } <ide> public String getSubject() { <ide> return this.subject; <ide> } <ide> <add> @Override <ide> public void setText(String text) { <ide> this.text = text; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java <ide> public void setMappings(String[] mappings) { <ide> /** <ide> * Creates the final merged mapping set. <ide> */ <add> @Override <ide> public void afterPropertiesSet() { <ide> getFileTypeMap(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java <ide> public FileTypeMap getDefaultFileTypeMap() { <ide> // Implementation of MailSender <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void send(SimpleMailMessage simpleMessage) throws MailException { <ide> send(new SimpleMailMessage[] { simpleMessage }); <ide> } <ide> <add> @Override <ide> public void send(SimpleMailMessage[] simpleMessages) throws MailException { <ide> List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(simpleMessages.length); <ide> for (SimpleMailMessage simpleMessage : simpleMessages) { <ide> public void send(SimpleMailMessage[] simpleMessages) throws MailException { <ide> * @see #setDefaultEncoding <ide> * @see #setDefaultFileTypeMap <ide> */ <add> @Override <ide> public MimeMessage createMimeMessage() { <ide> return new SmartMimeMessage(getSession(), getDefaultEncoding(), getDefaultFileTypeMap()); <ide> } <ide> <add> @Override <ide> public MimeMessage createMimeMessage(InputStream contentStream) throws MailException { <ide> try { <ide> return new MimeMessage(getSession(), contentStream); <ide> public MimeMessage createMimeMessage(InputStream contentStream) throws MailExcep <ide> } <ide> } <ide> <add> @Override <ide> public void send(MimeMessage mimeMessage) throws MailException { <ide> send(new MimeMessage[] {mimeMessage}); <ide> } <ide> <add> @Override <ide> public void send(MimeMessage[] mimeMessages) throws MailException { <ide> doSend(mimeMessages, null); <ide> } <ide> <add> @Override <ide> public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException { <ide> send(new MimeMessagePreparator[] { mimeMessagePreparator }); <ide> } <ide> <add> @Override <ide> public void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException { <ide> try { <ide> List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(mimeMessagePreparators.length); <ide><path>spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMailMessage.java <ide> public final MimeMessage getMimeMessage() { <ide> } <ide> <ide> <add> @Override <ide> public void setFrom(String from) throws MailParseException { <ide> try { <ide> this.helper.setFrom(from); <ide> public void setFrom(String from) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setReplyTo(String replyTo) throws MailParseException { <ide> try { <ide> this.helper.setReplyTo(replyTo); <ide> public void setReplyTo(String replyTo) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setTo(String to) throws MailParseException { <ide> try { <ide> this.helper.setTo(to); <ide> public void setTo(String to) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setTo(String[] to) throws MailParseException { <ide> try { <ide> this.helper.setTo(to); <ide> public void setTo(String[] to) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setCc(String cc) throws MailParseException { <ide> try { <ide> this.helper.setCc(cc); <ide> public void setCc(String cc) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setCc(String[] cc) throws MailParseException { <ide> try { <ide> this.helper.setCc(cc); <ide> public void setCc(String[] cc) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setBcc(String bcc) throws MailParseException { <ide> try { <ide> this.helper.setBcc(bcc); <ide> public void setBcc(String bcc) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setBcc(String[] bcc) throws MailParseException { <ide> try { <ide> this.helper.setBcc(bcc); <ide> public void setBcc(String[] bcc) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setSentDate(Date sentDate) throws MailParseException { <ide> try { <ide> this.helper.setSentDate(sentDate); <ide> public void setSentDate(Date sentDate) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setSubject(String subject) throws MailParseException { <ide> try { <ide> this.helper.setSubject(subject); <ide> public void setSubject(String subject) throws MailParseException { <ide> } <ide> } <ide> <add> @Override <ide> public void setText(String text) throws MailParseException { <ide> try { <ide> this.helper.setText(text); <ide><path>spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java <ide> protected DataSource createDataSource( <ide> final InputStreamSource inputStreamSource, final String contentType, final String name) { <ide> <ide> return new DataSource() { <add> @Override <ide> public InputStream getInputStream() throws IOException { <ide> return inputStreamSource.getInputStream(); <ide> } <add> @Override <ide> public OutputStream getOutputStream() { <ide> throw new UnsupportedOperationException("Read-only javax.activation.DataSource"); <ide> } <add> @Override <ide> public String getContentType() { <ide> return contentType; <ide> } <add> @Override <ide> public String getName() { <ide> return name; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java <ide> public DelegatingTimerListener(Runnable runnable) { <ide> /** <ide> * Delegates execution to the underlying Runnable. <ide> */ <add> @Override <ide> public void timerExpired(Timer timer) { <ide> this.runnable.run(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java <ide> public final Runnable getDelegate() { <ide> /** <ide> * Delegates execution to the underlying Runnable. <ide> */ <add> @Override <ide> public void run() { <ide> this.delegate.run(); <ide> } <ide> public void run() { <ide> * {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()}, <ide> * if available. <ide> */ <add> @Override <ide> public boolean isDaemon() { <ide> return (this.delegate instanceof SchedulingAwareRunnable && <ide> ((SchedulingAwareRunnable) this.delegate).isLongLived()); <ide> public boolean isDaemon() { <ide> * This implementation is empty, since we expect the Runnable <ide> * to terminate based on some specific shutdown signal. <ide> */ <add> @Override <ide> public void release() { <ide> } <ide> <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java <ide> public void setShared(boolean shared) { <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws NamingException { <ide> if (this.timerManager == null) { <ide> if (this.timerManagerName == null) { <ide> protected final TimerManager getTimerManager() { <ide> * Resumes the underlying TimerManager (if not shared). <ide> * @see commonj.timers.TimerManager#resume() <ide> */ <add> @Override <ide> public void start() { <ide> if (!this.shared) { <ide> this.timerManager.resume(); <ide> public void start() { <ide> * Suspends the underlying TimerManager (if not shared). <ide> * @see commonj.timers.TimerManager#suspend() <ide> */ <add> @Override <ide> public void stop() { <ide> if (!this.shared) { <ide> this.timerManager.suspend(); <ide> public void stop() { <ide> * @see commonj.timers.TimerManager#isSuspending() <ide> * @see commonj.timers.TimerManager#isStopping() <ide> */ <add> @Override <ide> public boolean isRunning() { <ide> return (!this.timerManager.isSuspending() && !this.timerManager.isStopping()); <ide> } <ide> public boolean isRunning() { <ide> * Stops the underlying TimerManager (if not shared). <ide> * @see commonj.timers.TimerManager#stop() <ide> */ <add> @Override <ide> public void destroy() { <ide> // Stop the entire TimerManager, if necessary. <ide> if (!this.shared) { <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java <ide> public void setScheduledTimerListeners(ScheduledTimerListener[] scheduledTimerLi <ide> // Implementation of InitializingBean interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void afterPropertiesSet() throws NamingException { <ide> super.afterPropertiesSet(); <ide> if (this.scheduledTimerListeners != null) { <ide> public void afterPropertiesSet() throws NamingException { <ide> // Implementation of FactoryBean interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public TimerManager getObject() { <ide> return getTimerManager(); <ide> } <ide> <add> @Override <ide> public Class<? extends TimerManager> getObjectType() { <ide> TimerManager timerManager = getTimerManager(); <ide> return (timerManager != null ? timerManager.getClass() : TimerManager.class); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java <ide> public void setErrorHandler(ErrorHandler errorHandler) { <ide> } <ide> <ide> <add> @Override <ide> public ScheduledFuture schedule(Runnable task, Trigger trigger) { <ide> return new ReschedulingTimerListener(errorHandlingTask(task, true), trigger).schedule(); <ide> } <ide> <add> @Override <ide> public ScheduledFuture schedule(Runnable task, Date startTime) { <ide> TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, false)); <ide> Timer timer = getTimerManager().schedule(futureTask, startTime); <ide> futureTask.setTimer(timer); <ide> return futureTask; <ide> } <ide> <add> @Override <ide> public ScheduledFuture scheduleAtFixedRate(Runnable task, Date startTime, long period) { <ide> TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true)); <ide> Timer timer = getTimerManager().scheduleAtFixedRate(futureTask, startTime, period); <ide> futureTask.setTimer(timer); <ide> return futureTask; <ide> } <ide> <add> @Override <ide> public ScheduledFuture scheduleAtFixedRate(Runnable task, long period) { <ide> TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true)); <ide> Timer timer = getTimerManager().scheduleAtFixedRate(futureTask, 0, period); <ide> futureTask.setTimer(timer); <ide> return futureTask; <ide> } <ide> <add> @Override <ide> public ScheduledFuture scheduleWithFixedDelay(Runnable task, Date startTime, long delay) { <ide> TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true)); <ide> Timer timer = getTimerManager().schedule(futureTask, startTime, delay); <ide> futureTask.setTimer(timer); <ide> return futureTask; <ide> } <ide> <add> @Override <ide> public ScheduledFuture scheduleWithFixedDelay(Runnable task, long delay) { <ide> TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true)); <ide> Timer timer = getTimerManager().schedule(futureTask, 0, delay); <ide> public void setTimer(Timer timer) { <ide> this.timer = timer; <ide> } <ide> <add> @Override <ide> public void timerExpired(Timer timer) { <ide> runAndReset(); <ide> } <ide> public boolean cancel(boolean mayInterruptIfRunning) { <ide> return result; <ide> } <ide> <add> @Override <ide> public long getDelay(TimeUnit unit) { <ide> return unit.convert(System.currentTimeMillis() - this.timer.getScheduledExecutionTime(), TimeUnit.MILLISECONDS); <ide> } <ide> <add> @Override <ide> public int compareTo(Delayed other) { <ide> if (this == other) { <ide> return 0; <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java <ide> public void setWorkListener(WorkListener workListener) { <ide> this.workListener = workListener; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() throws NamingException { <ide> if (this.workManager == null) { <ide> if (this.workManagerName == null) { <ide> public void afterPropertiesSet() throws NamingException { <ide> // Implementation of the Spring SchedulingTaskExecutor interface <ide> //------------------------------------------------------------------------- <ide> <add> @Override <ide> public void execute(Runnable task) { <ide> Assert.state(this.workManager != null, "No WorkManager specified"); <ide> Work work = new DelegatingWork(task); <ide> public void execute(Runnable task) { <ide> } <ide> } <ide> <add> @Override <ide> public void execute(Runnable task, long startTimeout) { <ide> execute(task); <ide> } <ide> <add> @Override <ide> public Future<?> submit(Runnable task) { <ide> FutureTask<Object> future = new FutureTask<Object>(task, null); <ide> execute(future); <ide> return future; <ide> } <ide> <add> @Override <ide> public <T> Future<T> submit(Callable<T> task) { <ide> FutureTask<T> future = new FutureTask<T>(task); <ide> execute(future); <ide> public <T> Future<T> submit(Callable<T> task) { <ide> /** <ide> * This task executor prefers short-lived work units. <ide> */ <add> @Override <ide> public boolean prefersShortLivedTasks() { <ide> return true; <ide> } <ide> public boolean prefersShortLivedTasks() { <ide> // Implementation of the CommonJ WorkManager interface <ide> //------------------------------------------------------------------------- <ide> <add> @Override <ide> public WorkItem schedule(Work work) <ide> throws WorkException, IllegalArgumentException { <ide> <ide> return this.workManager.schedule(work); <ide> } <ide> <add> @Override <ide> public WorkItem schedule(Work work, WorkListener workListener) <ide> throws WorkException, IllegalArgumentException { <ide> <ide> return this.workManager.schedule(work, workListener); <ide> } <ide> <add> @Override <ide> public boolean waitForAll(Collection workItems, long timeout) <ide> throws InterruptedException, IllegalArgumentException { <ide> <ide> return this.workManager.waitForAll(workItems, timeout); <ide> } <ide> <add> @Override <ide> public Collection waitForAny(Collection workItems, long timeout) <ide> throws InterruptedException, IllegalArgumentException { <ide> <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java <ide> public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws Schedul <ide> /** <ide> * Quartz 1.x version of newJob: contains actual implementation code. <ide> */ <add> @Override <ide> public Job newJob(TriggerFiredBundle bundle) throws SchedulerException { <ide> try { <ide> Object jobObject = createJobInstance(bundle); <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java <ide> public void setJobDetail(JobDetail jobDetail) { <ide> this.jobDetail = jobDetail; <ide> } <ide> <add> @Override <ide> public JobDetail getJobDetail() { <ide> return this.jobDetail; <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> if (this.startDelay > 0) { <ide> setStartTime(new Date(System.currentTimeMillis() + this.startDelay)); <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java <ide> public void setMisfireInstructionName(String constantName) { <ide> this.misfireInstruction = constants.asNumber(constantName).intValue(); <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.name == null) { <ide> this.name = this.beanName; <ide> else if (this.startTime == null) { <ide> } <ide> <ide> <add> @Override <ide> public CronTrigger getObject() { <ide> return this.cronTrigger; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return CronTrigger.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java <ide> public final Runnable getDelegate() { <ide> /** <ide> * Delegates execution to the underlying Runnable. <ide> */ <add> @Override <ide> public void execute(JobExecutionContext context) throws JobExecutionException { <ide> this.delegate.run(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java <ide> public void setJobListenerNames(String[] names) { <ide> } <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public void setApplicationContext(ApplicationContext applicationContext) { <ide> this.applicationContext = applicationContext; <ide> } <ide> public void setApplicationContextJobDataKey(String applicationContextJobDataKey) <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (getName() == null) { <ide> setName(this.beanName); <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java <ide> public void setDescription(String description) { <ide> this.description = description; <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public void setApplicationContext(ApplicationContext applicationContext) { <ide> this.applicationContext = applicationContext; <ide> } <ide> public void setApplicationContextJobDataKey(String applicationContextJobDataKey) <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.name == null) { <ide> this.name = this.beanName; <ide> public void afterPropertiesSet() { <ide> } <ide> <ide> <add> @Override <ide> public JobDetail getObject() { <ide> return this.jobDetail; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return JobDetail.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java <ide> public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) <ide> DBConnectionManager.getInstance().addConnectionProvider( <ide> TX_DATA_SOURCE_PREFIX + getInstanceName(), <ide> new ConnectionProvider() { <add> @Override <ide> public Connection getConnection() throws SQLException { <ide> // Return a transactional Connection, if any. <ide> return DataSourceUtils.doGetConnection(dataSource); <ide> } <add> @Override <ide> public void shutdown() { <ide> // Do nothing - a Spring-managed DataSource has its own lifecycle. <ide> } <ide> public void shutdown() { <ide> DBConnectionManager.getInstance().addConnectionProvider( <ide> NON_TX_DATA_SOURCE_PREFIX + getInstanceName(), <ide> new ConnectionProvider() { <add> @Override <ide> public Connection getConnection() throws SQLException { <ide> // Always return a non-transactional Connection. <ide> return nonTxDataSourceToUse.getConnection(); <ide> } <add> @Override <ide> public void shutdown() { <ide> // Do nothing - a Spring-managed DataSource has its own lifecycle. <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java <ide> public void setInstanceName(String schedName) { <ide> } <ide> <ide> <add> @Override <ide> public void initialize() throws SchedulerConfigException { <ide> // Absolutely needs thread-bound TaskExecutor to initialize. <ide> this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor(); <ide> public void initialize() throws SchedulerConfigException { <ide> } <ide> } <ide> <add> @Override <ide> public void shutdown(boolean waitForJobsToComplete) { <ide> } <ide> <add> @Override <ide> public int getPoolSize() { <ide> return -1; <ide> } <ide> <ide> <add> @Override <ide> public boolean runInThread(Runnable runnable) { <ide> if (runnable == null) { <ide> return false; <ide> public boolean runInThread(Runnable runnable) { <ide> } <ide> } <ide> <add> @Override <ide> public int blockForAvailableThreads() { <ide> // The present implementation always returns 1, making Quartz (1.6) <ide> // always schedule any tasks that it feels like scheduling. <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java <ide> public void setJobListenerNames(String[] names) { <ide> this.jobListenerNames = names; <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader classLoader) { <ide> this.beanClassLoader = classLoader; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> protected Class resolveClassName(String className) throws ClassNotFoundException <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException { <ide> prepare(); <ide> <ide> public Object getTargetObject() { <ide> } <ide> <ide> <add> @Override <ide> public JobDetail getObject() { <ide> return this.jobDetail; <ide> } <ide> <add> @Override <ide> public Class<? extends JobDetail> getObjectType() { <ide> return (this.jobDetail != null ? this.jobDetail.getClass() : JobDetail.class); <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java <ide> public abstract class QuartzJobBean implements Job { <ide> * values, and delegates to {@code executeInternal} afterwards. <ide> * @see #executeInternal <ide> */ <add> @Override <ide> public final void execute(JobExecutionContext context) throws JobExecutionException { <ide> try { <ide> // Reflectively adapting to differences between Quartz 1.x and Quartz 2.0... <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java <ide> public ResourceLoaderClassLoadHelper(ResourceLoader resourceLoader) { <ide> } <ide> <ide> <add> @Override <ide> public void initialize() { <ide> if (this.resourceLoader == null) { <ide> this.resourceLoader = SchedulerFactoryBean.getConfigTimeResourceLoader(); <ide> public void initialize() { <ide> } <ide> } <ide> <add> @Override <ide> public Class loadClass(String name) throws ClassNotFoundException { <ide> return this.resourceLoader.getClassLoader().loadClass(name); <ide> } <ide> public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws Clas <ide> return loadClass(name); <ide> } <ide> <add> @Override <ide> public URL getResource(String name) { <ide> Resource resource = this.resourceLoader.getResource(name); <ide> try { <ide> public URL getResource(String name) { <ide> } <ide> } <ide> <add> @Override <ide> public InputStream getResourceAsStream(String name) { <ide> Resource resource = this.resourceLoader.getResource(name); <ide> try { <ide> public InputStream getResourceAsStream(String name) { <ide> } <ide> } <ide> <add> @Override <ide> public ClassLoader getClassLoader() { <ide> return this.resourceLoader.getClassLoader(); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java <ide> public void setTransactionManager(PlatformTransactionManager transactionManager) <ide> this.transactionManager = transactionManager; <ide> } <ide> <add> @Override <ide> public void setResourceLoader(ResourceLoader resourceLoader) { <ide> this.resourceLoader = resourceLoader; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java <ide> public Scheduler getScheduler() { <ide> return this.scheduler; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws SchedulerException { <ide> if (this.scheduler == null) { <ide> if (this.schedulerName != null) { <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java <ide> public void setAutoStartup(boolean autoStartup) { <ide> * the scheduler will start after the context is refreshed and after the <ide> * start delay, if any. <ide> */ <add> @Override <ide> public boolean isAutoStartup() { <ide> return this.autoStartup; <ide> } <ide> public void setPhase(int phase) { <ide> /** <ide> * Return the phase in which this scheduler will be started and stopped. <ide> */ <add> @Override <ide> public int getPhase() { <ide> return this.phase; <ide> } <ide> public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnSh <ide> } <ide> <ide> <add> @Override <ide> public void setBeanName(String name) { <ide> if (this.schedulerName == null) { <ide> this.schedulerName = name; <ide> } <ide> } <ide> <add> @Override <ide> public void setApplicationContext(ApplicationContext applicationContext) { <ide> this.applicationContext = applicationContext; <ide> } <ide> public void setApplicationContext(ApplicationContext applicationContext) { <ide> // Implementation of InitializingBean interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> if (this.dataSource == null && this.nonTransactionalDataSource != null) { <ide> this.dataSource = this.nonTransactionalDataSource; <ide> public Scheduler getScheduler() { <ide> return this.scheduler; <ide> } <ide> <add> @Override <ide> public Scheduler getObject() { <ide> return this.scheduler; <ide> } <ide> <add> @Override <ide> public Class<? extends Scheduler> getObjectType() { <ide> return (this.scheduler != null) ? this.scheduler.getClass() : Scheduler.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide> public boolean isSingleton() { <ide> // Implementation of Lifecycle interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void start() throws SchedulingException { <ide> if (this.scheduler != null) { <ide> try { <ide> public void start() throws SchedulingException { <ide> } <ide> } <ide> <add> @Override <ide> public void stop() throws SchedulingException { <ide> if (this.scheduler != null) { <ide> try { <ide> public void stop() throws SchedulingException { <ide> } <ide> } <ide> <add> @Override <ide> public void stop(Runnable callback) throws SchedulingException { <ide> stop(); <ide> callback.run(); <ide> } <ide> <add> @Override <ide> public boolean isRunning() throws SchedulingException { <ide> if (this.scheduler != null) { <ide> try { <ide> public boolean isRunning() throws SchedulingException { <ide> * Shut down the Quartz scheduler on bean factory shutdown, <ide> * stopping all scheduled jobs. <ide> */ <add> @Override <ide> public void destroy() throws SchedulerException { <ide> logger.info("Shutting down Quartz Scheduler"); <ide> this.scheduler.shutdown(this.waitForJobsToCompleteOnShutdown); <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java <ide> public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnSh <ide> this.waitForJobsToCompleteOnShutdown = waitForJobsToCompleteOnShutdown; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() throws SchedulerConfigException { <ide> initialize(); <ide> } <ide> <ide> <add> @Override <ide> public void execute(Runnable task) { <ide> Assert.notNull(task, "Runnable must not be null"); <ide> if (!runInThread(task)) { <ide> throw new SchedulingException("Quartz SimpleThreadPool already shut down"); <ide> } <ide> } <ide> <add> @Override <ide> public void execute(Runnable task, long startTimeout) { <ide> execute(task); <ide> } <ide> <add> @Override <ide> public Future<?> submit(Runnable task) { <ide> FutureTask<Object> future = new FutureTask<Object>(task, null); <ide> execute(future); <ide> return future; <ide> } <ide> <add> @Override <ide> public <T> Future<T> submit(Callable<T> task) { <ide> FutureTask<T> future = new FutureTask<T>(task); <ide> execute(future); <ide> public <T> Future<T> submit(Callable<T> task) { <ide> /** <ide> * This task executor prefers short-lived work units. <ide> */ <add> @Override <ide> public boolean prefersShortLivedTasks() { <ide> return true; <ide> } <ide> <ide> <add> @Override <ide> public void destroy() { <ide> shutdown(this.waitForJobsToCompleteOnShutdown); <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java <ide> public void setJobDetail(JobDetail jobDetail) { <ide> this.jobDetail = jobDetail; <ide> } <ide> <add> @Override <ide> public JobDetail getJobDetail() { <ide> return this.jobDetail; <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws ParseException { <ide> if (getName() == null) { <ide> setName(this.beanName); <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java <ide> public void setMisfireInstructionName(String constantName) { <ide> this.misfireInstruction = constants.asNumber(constantName).intValue(); <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> this.beanName = beanName; <ide> } <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws ParseException { <ide> if (this.name == null) { <ide> this.name = this.beanName; <ide> else if (this.startTime == null) { <ide> } <ide> <ide> <add> @Override <ide> public SimpleTrigger getObject() { <ide> return this.simpleTrigger; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return SimpleTrigger.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java <ide> public void setIgnoredUnknownProperties(String[] ignoredUnknownProperties) { <ide> this.ignoredUnknownProperties = ignoredUnknownProperties; <ide> } <ide> <add> @Override <ide> public void setSchedulerContext(SchedulerContext schedulerContext) { <ide> this.schedulerContext = schedulerContext; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java <ide> public class FreeMarkerConfigurationFactoryBean extends FreeMarkerConfigurationF <ide> private Configuration configuration; <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws IOException, TemplateException { <ide> this.configuration = createConfiguration(); <ide> } <ide> <ide> <add> @Override <ide> public Configuration getObject() { <ide> return this.configuration; <ide> } <ide> <add> @Override <ide> public Class<? extends Configuration> getObjectType() { <ide> return Configuration.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java <ide> public SpringTemplateLoader(ResourceLoader resourceLoader, String templateLoader <ide> } <ide> } <ide> <add> @Override <ide> public Object findTemplateSource(String name) throws IOException { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Looking for FreeMarker template with name [" + name + "]"); <ide> public Object findTemplateSource(String name) throws IOException { <ide> return (resource.exists() ? resource : null); <ide> } <ide> <add> @Override <ide> public Reader getReader(Object templateSource, String encoding) throws IOException { <ide> Resource resource = (Resource) templateSource; <ide> try { <ide> public Reader getReader(Object templateSource, String encoding) throws IOExcepti <ide> } <ide> <ide> <add> @Override <ide> public long getLastModified(Object templateSource) { <ide> Resource resource = (Resource) templateSource; <ide> try { <ide> public long getLastModified(Object templateSource) { <ide> } <ide> } <ide> <add> @Override <ide> public void closeTemplateSource(Object templateSource) throws IOException { <ide> } <ide> <ide><path>spring-context-support/src/main/java/org/springframework/ui/velocity/CommonsLoggingLogSystem.java <ide> public class CommonsLoggingLogSystem implements LogSystem { <ide> <ide> private static final Log logger = LogFactory.getLog(VelocityEngine.class); <ide> <add> @Override <ide> public void init(RuntimeServices runtimeServices) { <ide> } <ide> <add> @Override <ide> public void logVelocityMessage(int type, String msg) { <ide> switch (type) { <ide> case ERROR_ID: <ide><path>spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java <ide> public class VelocityEngineFactoryBean extends VelocityEngineFactory <ide> private VelocityEngine velocityEngine; <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() throws IOException, VelocityException { <ide> this.velocityEngine = createVelocityEngine(); <ide> } <ide> <ide> <add> @Override <ide> public VelocityEngine getObject() { <ide> return this.velocityEngine; <ide> } <ide> <add> @Override <ide> public Class<? extends VelocityEngine> getObjectType() { <ide> return VelocityEngine.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java <ide> public abstract class AbstractCachingConfiguration implements ImportAware { <ide> @Autowired(required=false) <ide> private Collection<CachingConfigurer> cachingConfigurers; <ide> <add> @Override <ide> public void setImportMetadata(AnnotationMetadata importMetadata) { <ide> this.enableCaching = AnnotationAttributes.fromMap( <ide> importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false)); <ide><path>spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java <ide> public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl <ide> * @return {@link ProxyCachingConfiguration} or {@code AspectJCacheConfiguration} for <ide> * {@code PROXY} and {@code ASPECTJ} values of {@link EnableCaching#mode()}, respectively <ide> */ <add> @Override <ide> public String[] selectImports(AdviceMode adviceMode) { <ide> switch (adviceMode) { <ide> case PROXY: <ide><path>spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java <ide> @SuppressWarnings("serial") <ide> public class SpringCacheAnnotationParser implements CacheAnnotationParser, Serializable { <ide> <add> @Override <ide> public Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement ae) { <ide> Collection<CacheOperation> ops = null; <ide> <ide><path>spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java <ide> public ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, bool <ide> } <ide> <ide> <add> @Override <ide> public String getName() { <ide> return this.name; <ide> } <ide> <add> @Override <ide> public ConcurrentMap getNativeCache() { <ide> return this.store; <ide> } <ide> public boolean isAllowNullValues() { <ide> return this.allowNullValues; <ide> } <ide> <add> @Override <ide> public ValueWrapper get(Object key) { <ide> Object value = this.store.get(key); <ide> return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null); <ide> } <ide> <add> @Override <ide> public void put(Object key, Object value) { <ide> this.store.put(key, toStoreValue(value)); <ide> } <ide> <add> @Override <ide> public void evict(Object key) { <ide> this.store.remove(key); <ide> } <ide> <add> @Override <ide> public void clear() { <ide> this.store.clear(); <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCacheFactoryBean.java <ide> public void setAllowNullValues(boolean allowNullValues) { <ide> this.allowNullValues = allowNullValues; <ide> } <ide> <add> @Override <ide> public void setBeanName(String beanName) { <ide> if (!StringUtils.hasLength(this.name)) { <ide> setName(beanName); <ide> } <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> this.cache = (this.store != null ? new ConcurrentMapCache(this.name, this.store, this.allowNullValues) : <ide> new ConcurrentMapCache(this.name, this.allowNullValues)); <ide> } <ide> <ide> <add> @Override <ide> public ConcurrentMapCache getObject() { <ide> return this.cache; <ide> } <ide> <add> @Override <ide> public Class<?> getObjectType() { <ide> return ConcurrentMapCache.class; <ide> } <ide> <add> @Override <ide> public boolean isSingleton() { <ide> return true; <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCacheManager.java <ide> public void setCacheNames(Collection<String> cacheNames) { <ide> } <ide> } <ide> <add> @Override <ide> public Collection<String> getCacheNames() { <ide> return Collections.unmodifiableSet(this.cacheMap.keySet()); <ide> } <ide> <add> @Override <ide> public Cache getCache(String name) { <ide> Cache cache = this.cacheMap.get(name); <ide> if (cache == null && this.dynamic) { <ide><path>spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java <ide> class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser <ide> * {@link AopNamespaceUtils#registerAutoProxyCreatorIfNecessary <ide> * register an AutoProxyCreator} with the container as necessary. <ide> */ <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> String mode = element.getAttribute("mode"); <ide> if ("aspectj".equals(mode)) { <ide><path>spring-context/src/main/java/org/springframework/cache/config/CacheNamespaceHandler.java <ide> static BeanDefinition parseKeyGenerator(Element element, BeanDefinition def) { <ide> return def; <ide> } <ide> <add> @Override <ide> public void init() { <ide> registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenCacheBeanDefinitionParser()); <ide> registerBeanDefinitionParser("advice", new CacheAdviceParser()); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java <ide> public abstract class AbstractFallbackCacheOperationSource implements CacheOpera <ide> * @return {@link CacheOperation} for this method, or {@code null} if the method <ide> * is not cacheable <ide> */ <add> @Override <ide> public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) { <ide> // First, see if we have a cached value. <ide> Object cacheKey = getCacheKey(method, targetClass); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java <ide> public void setClassFilter(ClassFilter classFilter) { <ide> this.pointcut.setClassFilter(classFilter); <ide> } <ide> <add> @Override <ide> public Pointcut getPointcut() { <ide> return this.pointcut; <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java <ide> public KeyGenerator getKeyGenerator() { <ide> return this.keyGenerator; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.cacheManager == null) { <ide> throw new IllegalStateException("'cacheManager' is required"); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CacheInterceptor.java <ide> private static class ThrowableWrapper extends RuntimeException { <ide> } <ide> } <ide> <add> @Override <ide> public Object invoke(final MethodInvocation invocation) throws Throwable { <ide> Method method = invocation.getMethod(); <ide> <ide> Invoker aopAllianceInvoker = new Invoker() { <add> @Override <ide> public Object invoke() { <ide> try { <ide> return invocation.proceed(); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java <ide> @SuppressWarnings("serial") <ide> abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implements Serializable { <ide> <add> @Override <ide> public boolean matches(Method method, Class<?> targetClass) { <ide> CacheOperationSource cas = getCacheOperationSource(); <ide> return (cas != null && !CollectionUtils.isEmpty(cas.getCacheOperations(method, targetClass))); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CompositeCacheOperationSource.java <ide> public final CacheOperationSource[] getCacheOperationSources() { <ide> return this.cacheOperationSources; <ide> } <ide> <add> @Override <ide> public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) { <ide> Collection<CacheOperation> ops = null; <ide> <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java <ide> public class DefaultKeyGenerator implements KeyGenerator { <ide> public static final int NO_PARAM_KEY = 0; <ide> public static final int NULL_PARAM_KEY = 53; <ide> <add> @Override <ide> public Object generate(Object target, Method method, Object... params) { <ide> if (params.length == 1) { <ide> return (params[0] == null ? NULL_PARAM_KEY : params[0]); <ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/NameMatchCacheOperationSource.java <ide> public void addCacheMethod(String methodName, Collection<CacheOperation> ops) { <ide> this.nameMap.put(methodName, ops); <ide> } <ide> <add> @Override <ide> public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) { <ide> // look for direct name match <ide> String methodName = method.getName(); <ide><path>spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java <ide> public abstract class AbstractCacheManager implements CacheManager, Initializing <ide> private Set<String> cacheNames = new LinkedHashSet<String>(16); <ide> <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> Collection<? extends Cache> caches = loadCaches(); <ide> Assert.notEmpty(caches, "loadCaches must not return an empty Collection"); <ide> protected Cache decorateCache(Cache cache) { <ide> } <ide> <ide> <add> @Override <ide> public Cache getCache(String name) { <ide> return this.cacheMap.get(name); <ide> } <ide> <add> @Override <ide> public Collection<String> getCacheNames() { <ide> return Collections.unmodifiableSet(this.cacheNames); <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/support/CompositeCacheManager.java <ide> public void setFallbackToNoOpCache(boolean fallbackToNoOpCache) { <ide> this.fallbackToNoOpCache = fallbackToNoOpCache; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() { <ide> if (this.fallbackToNoOpCache) { <ide> this.cacheManagers.add(new NoOpCacheManager()); <ide> } <ide> } <ide> <ide> <add> @Override <ide> public Cache getCache(String name) { <ide> for (CacheManager cacheManager : this.cacheManagers) { <ide> Cache cache = cacheManager.getCache(name); <ide> public Cache getCache(String name) { <ide> return null; <ide> } <ide> <add> @Override <ide> public Collection<String> getCacheNames() { <ide> List<String> names = new ArrayList<String>(); <ide> for (CacheManager manager : this.cacheManagers) { <ide><path>spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java <ide> public class NoOpCacheManager implements CacheManager { <ide> * This implementation always returns a {@link Cache} implementation that will not store items. <ide> * Additionally, the request cache will be remembered by the manager for consistency. <ide> */ <add> @Override <ide> public Cache getCache(String name) { <ide> Cache cache = this.caches.get(name); <ide> if (cache == null) { <ide> public Cache getCache(String name) { <ide> /** <ide> * This implementation returns the name of the caches previously requested. <ide> */ <add> @Override <ide> public Collection<String> getCacheNames() { <ide> synchronized (this.cacheNames) { <ide> return Collections.unmodifiableSet(this.cacheNames); <ide> public NoOpCache(String name) { <ide> this.name = name; <ide> } <ide> <add> @Override <ide> public void clear() { <ide> } <ide> <add> @Override <ide> public void evict(Object key) { <ide> } <ide> <add> @Override <ide> public ValueWrapper get(Object key) { <ide> return null; <ide> } <ide> <add> @Override <ide> public String getName() { <ide> return this.name; <ide> } <ide> <add> @Override <ide> public Object getNativeCache() { <ide> return null; <ide> } <ide> <add> @Override <ide> public void put(Object key, Object value) { <ide> } <ide> } <ide><path>spring-context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java <ide> public SimpleValueWrapper(Object value) { <ide> /** <ide> * Simply returns the value as given at construction time. <ide> */ <add> @Override <ide> public Object get() { <ide> return this.value; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java <ide> public interface ConfigurableApplicationContext extends ApplicationContext, Life <ide> /** <ide> * Return the Environment for this application context in configurable form. <ide> */ <add> @Override <ide> ConfigurableEnvironment getEnvironment(); <ide> <ide> /** <ide> public interface ConfigurableApplicationContext extends ApplicationContext, Life <ide> * <p>This method can be called multiple times without side effects: Subsequent <ide> * {@code close} calls on an already closed context will be ignored. <ide> */ <add> @Override <ide> void close(); <ide> <ide> /** <ide><path>spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java <ide> public ContextBeanFactoryReference(ApplicationContext applicationContext) { <ide> } <ide> <ide> <add> @Override <ide> public BeanFactory getFactory() { <ide> if (this.applicationContext == null) { <ide> throw new IllegalStateException( <ide> public BeanFactory getFactory() { <ide> return this.applicationContext; <ide> } <ide> <add> @Override <ide> public void release() { <ide> if (this.applicationContext != null) { <ide> ApplicationContext savedCtx; <ide><path>spring-context/src/main/java/org/springframework/context/access/ContextJndiBeanFactoryLocator.java <ide> public class ContextJndiBeanFactoryLocator extends JndiLocatorSupport implements <ide> * will be created from the combined resources. <ide> * @see #createBeanFactory <ide> */ <add> @Override <ide> public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException { <ide> try { <ide> String beanFactoryPath = lookup(factoryKey, String.class); <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AdviceModeImportSelector.java <ide> protected String getAdviceModeAttributeName() { <ide> * on the importing {@code @Configuration} class or if {@link #selectImports(AdviceMode)} <ide> * returns {@code null} <ide> */ <add> @Override <ide> public final String[] selectImports(AnnotationMetadata importingClassMetadata) { <ide> Class<?> annoType = GenericTypeResolver.resolveTypeArgument(this.getClass(), AdviceModeImportSelector.class); <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java <ide> public class AnnotationBeanNameGenerator implements BeanNameGenerator { <ide> private static final String COMPONENT_ANNOTATION_CLASSNAME = "org.springframework.stereotype.Component"; <ide> <ide> <add> @Override <ide> public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) { <ide> if (definition instanceof AnnotatedBeanDefinition) { <ide> String beanName = determineBeanNameFromAnnotation((AnnotatedBeanDefinition) definition); <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java <ide> */ <ide> public class AnnotationConfigBeanDefinitionParser implements BeanDefinitionParser { <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> Object source = parserContext.extractSource(element); <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java <ide> public void setScopeAnnotationType(Class<? extends Annotation> scopeAnnotationTy <ide> } <ide> <ide> <add> @Override <ide> public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) { <ide> ScopeMetadata metadata = new ScopeMetadata(); <ide> if (definition instanceof AnnotatedBeanDefinition) { <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AspectJAutoProxyRegistrar.java <ide> class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar { <ide> * of the @{@link EnableAspectJAutoProxy#proxyTargetClass()} attribute on the importing <ide> * {@code @Configuration} class. <ide> */ <add> @Override <ide> public void registerBeanDefinitions( <ide> AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java <ide> public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar { <ide> * {@code proxyTargetClass} attributes, the APC can be registered and configured all <ide> * the same. <ide> */ <add> @Override <ide> public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { <ide> boolean candidateFound = false; <ide> Set<String> annoTypes = importingClassMetadata.getAnnotationTypes(); <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java <ide> public ClassPathScanningCandidateComponentProvider(boolean useDefaultFilters, En <ide> * @see org.springframework.core.io.support.ResourcePatternResolver <ide> * @see org.springframework.core.io.support.PathMatchingResourcePatternResolver <ide> */ <add> @Override <ide> public void setResourceLoader(ResourceLoader resourceLoader) { <ide> this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader); <ide> this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); <ide> public void setEnvironment(Environment environment) { <ide> this.environment = environment; <ide> } <ide> <add> @Override <ide> public final Environment getEnvironment() { <ide> return this.environment; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java <ide> public void setResourceFactory(BeanFactory resourceFactory) { <ide> this.resourceFactory = resourceFactory; <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> Assert.notNull(beanFactory, "BeanFactory must not be null"); <ide> this.beanFactory = beanFactory; <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, C <ide> } <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException { <ide> return null; <ide> } <ide> <add> @Override <ide> public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { <ide> return true; <ide> } <ide> <add> @Override <ide> public PropertyValues postProcessPropertyValues( <ide> PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException { <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java <ide> public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser { <ide> private static final String FILTER_EXPRESSION_ATTRIBUTE = "expression"; <ide> <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute(BASE_PACKAGE_ATTRIBUTE), <ide> ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java <ide> private ConfigurationClassBeanDefinition(ConfigurationClassBeanDefinition origin <ide> this.annotationMetadata = original.annotationMetadata; <ide> } <ide> <add> @Override <ide> public AnnotationMetadata getMetadata() { <ide> return this.annotationMetadata; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java <ide> class ConfigurationClassEnhancer { <ide> DisposableBeanMethodInterceptor.class, NoOp.class }; <ide> <ide> private static final CallbackFilter CALLBACK_FILTER = new CallbackFilter() { <add> @Override <ide> public int accept(Method candidateMethod) { <ide> // Set up the callback filter to return the index of the BeanMethodInterceptor when <ide> // handling a @Bean-annotated method; otherwise, return index of the NoOp callback. <ide> public GetObjectMethodInterceptor(ConfigurableBeanFactory beanFactory, String be <ide> this.beanName = beanName; <ide> } <ide> <add> @Override <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { <ide> return beanFactory.getBean(beanName); <ide> } <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy pr <ide> */ <ide> private static class DisposableBeanMethodInterceptor implements MethodInterceptor { <ide> <add> @Override <ide> public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { <ide> Enhancer.registerStaticCallbacks(obj.getClass(), null); <ide> // does the actual (non-CGLIB) superclass actually implement DisposableBean? <ide> private static class BeanMethodInterceptor implements MethodInterceptor { <ide> GetObjectMethodInterceptor.class, NoOp.class }; <ide> <ide> private static final CallbackFilter CALLBACK_FITLER = new CallbackFilter() { <add> @Override <ide> public int accept(Method method) { <ide> return method.getName().equals("getObject") ? 0 : 1; <ide> } <ide> public BeanMethodInterceptor(ConfigurableBeanFactory beanFactory) { <ide> * invoking the super implementation of the proxied method i.e., the actual <ide> * {@code @Bean} method. <ide> */ <add> @Override <ide> public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs, <ide> MethodProxy cglibMethodProxy) throws Throwable { <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java <ide> public void registerImport(String importingClass, String importedClass) { <ide> this.imports.put(importedClass, importingClass); <ide> } <ide> <add> @Override <ide> public String getImportingClassFor(String importedClass) { <ide> return this.imports.get(importedClass); <ide> } <ide> public String getImportingClassFor(String importedClass) { <ide> public boolean contains(Object elem) { <ide> ConfigurationClass configClass = (ConfigurationClass) elem; <ide> Comparator<ConfigurationClass> comparator = new Comparator<ConfigurationClass>() { <add> @Override <ide> public int compare(ConfigurationClass first, ConfigurationClass second) { <ide> return first.getMetadata().getClassName().equals(second.getMetadata().getClassName()) ? 0 : 1; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java <ide> public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) { <ide> this.importBeanNameGenerator = beanNameGenerator; <ide> } <ide> <add> @Override <ide> public void setEnvironment(Environment environment) { <ide> Assert.notNull(environment, "Environment must not be null"); <ide> this.environment = environment; <ide> } <ide> <add> @Override <ide> public void setResourceLoader(ResourceLoader resourceLoader) { <ide> Assert.notNull(resourceLoader, "ResourceLoader must not be null"); <ide> this.resourceLoader = resourceLoader; <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> if (!this.setMetadataReaderFactoryCalled) { <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> /** <ide> * Derive further bean definitions from the configuration classes in the registry. <ide> */ <add> @Override <ide> public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { <ide> RootBeanDefinition iabpp = new RootBeanDefinition(ImportAwareBeanPostProcessor.class); <ide> iabpp.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); <ide> public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { <ide> * Prepare the Configuration classes for servicing bean requests at runtime <ide> * by replacing them with CGLIB-enhanced subclasses. <ide> */ <add> @Override <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { <ide> int factoryId = System.identityHashCode(beanFactory); <ide> if (this.factoriesPostProcessed.contains(factoryId)) { <ide> private static class ImportAwareBeanPostProcessor implements PriorityOrdered, Be <ide> <ide> private BeanFactory beanFactory; <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> this.beanFactory = beanFactory; <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { <ide> if (bean instanceof ImportAware) { <ide> ImportRegistry importRegistry = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class); <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) thro <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <ide> return bean; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return Ordered.HIGHEST_PRECEDENCE; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java <ide> protected String resolveScopeName(String annotationType) { <ide> } <ide> <ide> <add> @Override <ide> public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) { <ide> ScopeMetadata metadata = new ScopeMetadata(); <ide> metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE); <ide><path>spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java <ide> public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade <ide> <ide> private ClassLoader beanClassLoader; <ide> <add> @Override <ide> public void setImportMetadata(AnnotationMetadata importMetadata) { <ide> this.enableLTW = MetadataUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.class); <ide> Assert.notNull(this.enableLTW, <ide> "@EnableLoadTimeWeaving is not present on importing class " + <ide> importMetadata.getClassName()); <ide> } <ide> <add> @Override <ide> public void setBeanClassLoader(ClassLoader beanClassLoader) { <ide> this.beanClassLoader = beanClassLoader; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java <ide> public class MBeanExportConfiguration implements ImportAware, BeanFactoryAware { <ide> private BeanFactory beanFactory; <ide> <ide> <add> @Override <ide> public void setImportMetadata(AnnotationMetadata importMetadata) { <ide> Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName()); <ide> this.attributes = AnnotationAttributes.fromMap(map); <ide> Assert.notNull(this.attributes, "@EnableMBeanExport is not present on " + <ide> "importing class " + importMetadata.getClassName()); <ide> } <ide> <add> @Override <ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException { <ide> this.beanFactory = beanFactory; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ScannedGenericBeanDefinition.java <ide> public ScannedGenericBeanDefinition(MetadataReader metadataReader) { <ide> } <ide> <ide> <add> @Override <ide> public final AnnotationMetadata getMetadata() { <ide> return this.metadata; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/config/ContextNamespaceHandler.java <ide> */ <ide> public class ContextNamespaceHandler extends NamespaceHandlerSupport { <ide> <add> @Override <ide> public void init() { <ide> registerBeanDefinitionParser("property-placeholder", new PropertyPlaceholderBeanDefinitionParser()); <ide> registerBeanDefinitionParser("property-override", new PropertyOverrideBeanDefinitionParser()); <ide><path>spring-context/src/main/java/org/springframework/context/config/SpringConfiguredBeanDefinitionParser.java <ide> class SpringConfiguredBeanDefinitionParser implements BeanDefinitionParser { <ide> "org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"; <ide> <ide> <add> @Override <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) { <ide> RootBeanDefinition def = new RootBeanDefinition(); <ide><path>spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java <ide> public abstract class AbstractApplicationEventMulticaster implements Application <ide> private BeanFactory beanFactory; <ide> <ide> <add> @Override <ide> public void addApplicationListener(ApplicationListener listener) { <ide> synchronized (this.defaultRetriever) { <ide> this.defaultRetriever.applicationListeners.add(listener); <ide> this.retrieverCache.clear(); <ide> } <ide> } <ide> <add> @Override <ide> public void addApplicationListenerBean(String listenerBeanName) { <ide> synchronized (this.defaultRetriever) { <ide> this.defaultRetriever.applicationListenerBeans.add(listenerBeanName); <ide> this.retrieverCache.clear(); <ide> } <ide> } <ide> <add> @Override <ide> public void removeApplicationListener(ApplicationListener listener) { <ide> synchronized (this.defaultRetriever) { <ide> this.defaultRetriever.applicationListeners.remove(listener); <ide> this.retrieverCache.clear(); <ide> } <ide> } <ide> <add> @Override <ide> public void removeApplicationListenerBean(String listenerBeanName) { <ide> synchronized (this.defaultRetriever) { <ide> this.defaultRetriever.applicationListenerBeans.remove(listenerBeanName); <ide> this.retrieverCache.clear(); <ide> } <ide> } <ide> <add> @Override <ide> public void removeAllListeners() { <ide> synchronized (this.defaultRetriever) { <ide> this.defaultRetriever.applicationListeners.clear(); <ide> public void removeAllListeners() { <ide> } <ide> } <ide> <add> @Override <ide> public final void setBeanFactory(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java <ide> public void setApplicationEventClass(Class applicationEventClass) { <ide> } <ide> } <ide> <add> @Override <ide> public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { <ide> this.applicationEventPublisher = applicationEventPublisher; <ide> } <ide> <add> @Override <ide> public void afterPropertiesSet() throws Exception { <ide> if (this.applicationEventClassConstructor == null) { <ide> throw new IllegalArgumentException("applicationEventClass is required"); <ide> } <ide> } <ide> <ide> <add> @Override <ide> public Object invoke(MethodInvocation invocation) throws Throwable { <ide> Object retVal = invocation.proceed(); <ide> <ide><path>spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java <ide> public GenericApplicationListenerAdapter(ApplicationListener delegate) { <ide> } <ide> <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void onApplicationEvent(ApplicationEvent event) { <ide> this.delegate.onApplicationEvent(event); <ide> } <ide> <add> @Override <ide> public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { <ide> Class typeArg = GenericTypeResolver.resolveTypeArgument(this.delegate.getClass(), ApplicationListener.class); <ide> if (typeArg == null || typeArg.equals(ApplicationEvent.class)) { <ide> public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { <ide> return (typeArg == null || typeArg.isAssignableFrom(eventType)); <ide> } <ide> <add> @Override <ide> public boolean supportsSourceType(Class<?> sourceType) { <ide> return true; <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return (this.delegate instanceof Ordered ? ((Ordered) this.delegate).getOrder() : Ordered.LOWEST_PRECEDENCE); <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java <ide> protected Executor getTaskExecutor() { <ide> } <ide> <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void multicastEvent(final ApplicationEvent event) { <ide> for (final ApplicationListener listener : getApplicationListeners(event)) { <ide> Executor executor = getTaskExecutor(); <ide> if (executor != null) { <ide> executor.execute(new Runnable() { <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void run() { <ide> listener.onApplicationEvent(event); <ide><path>spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java <ide> protected SourceFilteringListener(Object source) { <ide> } <ide> <ide> <add> @Override <ide> public void onApplicationEvent(ApplicationEvent event) { <ide> if (event.getSource() == this.source) { <ide> onApplicationEventInternal(event); <ide> } <ide> } <ide> <add> @Override <ide> public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { <ide> return (this.delegate == null || this.delegate.supportsEventType(eventType)); <ide> } <ide> <add> @Override <ide> public boolean supportsSourceType(Class<?> sourceType) { <ide> return sourceType.isInstance(this.source); <ide> } <ide> <add> @Override <ide> public int getOrder() { <ide> return (this.delegate != null ? this.delegate.getOrder() : Ordered.LOWEST_PRECEDENCE); <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java <ide> */ <ide> public class BeanExpressionContextAccessor implements PropertyAccessor { <ide> <add> @Override <ide> public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { <ide> return ((BeanExpressionContext) target).containsObject(name); <ide> } <ide> <add> @Override <ide> public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { <ide> return new TypedValue(((BeanExpressionContext) target).getObject(name)); <ide> } <ide> <add> @Override <ide> public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { <ide> return false; <ide> } <ide> <add> @Override <ide> public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { <ide> throw new AccessException("Beans in a BeanFactory are read-only"); <ide> } <ide> <add> @Override <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {BeanExpressionContext.class}; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java <ide> */ <ide> public class BeanFactoryAccessor implements PropertyAccessor { <ide> <add> @Override <ide> public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { <ide> return (((BeanFactory) target).containsBean(name)); <ide> } <ide> <add> @Override <ide> public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { <ide> return new TypedValue(((BeanFactory) target).getBean(name)); <ide> } <ide> <add> @Override <ide> public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { <ide> return false; <ide> } <ide> <add> @Override <ide> public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { <ide> throw new AccessException("Beans in a BeanFactory are read-only"); <ide> } <ide> <add> @Override <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {BeanFactory.class}; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/expression/BeanFactoryResolver.java <ide> public BeanFactoryResolver(BeanFactory beanFactory) { <ide> this.beanFactory = beanFactory; <ide> } <ide> <add> @Override <ide> public Object resolve(EvaluationContext context, String beanName) throws AccessException { <ide> try { <ide> return this.beanFactory.getBean(beanName); <ide><path>spring-context/src/main/java/org/springframework/context/expression/EnvironmentAccessor.java <ide> */ <ide> public class EnvironmentAccessor implements PropertyAccessor { <ide> <add> @Override <ide> public Class<?>[] getSpecificTargetClasses() { <ide> return new Class[] { Environment.class }; <ide> } <ide> public Class<?>[] getSpecificTargetClasses() { <ide> * Can read any {@link Environment}, thus always returns true. <ide> * @return true <ide> */ <add> @Override <ide> public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { <ide> return true; <ide> } <ide> public boolean canRead(EvaluationContext context, Object target, String name) th <ide> * Access the given target object by resolving the given property name against the given target <ide> * environment. <ide> */ <add> @Override <ide> public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { <ide> return new TypedValue(((Environment)target).getProperty(name)); <ide> } <ide> public TypedValue read(EvaluationContext context, Object target, String name) th <ide> * Read only. <ide> * @return false <ide> */ <add> @Override <ide> public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { <ide> return false; <ide> } <ide> <ide> /** <ide> * Read only. No-op. <ide> */ <add> @Override <ide> public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { <ide> } <ide> <ide><path>spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java <ide> */ <ide> public class MapAccessor implements PropertyAccessor { <ide> <add> @Override <ide> public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { <ide> Map map = (Map) target; <ide> return map.containsKey(name); <ide> } <ide> <add> @Override <ide> public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { <ide> Map map = (Map) target; <ide> Object value = map.get(name); <ide> public TypedValue read(EvaluationContext context, Object target, String name) th <ide> return new TypedValue(value); <ide> } <ide> <add> @Override <ide> public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { <ide> return true; <ide> } <ide> <add> @Override <ide> @SuppressWarnings("unchecked") <ide> public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { <ide> Map map = (Map) target; <ide> map.put(name, newValue); <ide> } <ide> <add> @Override <ide> public Class[] getSpecificTargetClasses() { <ide> return new Class[] {Map.class}; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java <ide> public class StandardBeanExpressionResolver implements BeanExpressionResolver { <ide> new ConcurrentHashMap<BeanExpressionContext, StandardEvaluationContext>(8); <ide> <ide> private final ParserContext beanExpressionParserContext = new ParserContext() { <add> @Override <ide> public boolean isTemplate() { <ide> return true; <ide> } <add> @Override <ide> public String getExpressionPrefix() { <ide> return expressionPrefix; <ide> } <add> @Override <ide> public String getExpressionSuffix() { <ide> return expressionSuffix; <ide> } <ide> public void setExpressionParser(ExpressionParser expressionParser) { <ide> } <ide> <ide> <add> @Override <ide> public Object evaluate(String value, BeanExpressionContext evalContext) throws BeansException { <ide> if (!StringUtils.hasLength(value)) { <ide> return value; <ide><path>spring-context/src/main/java/org/springframework/context/i18n/SimpleLocaleContext.java <ide> public SimpleLocaleContext(Locale locale) { <ide> this.locale = locale; <ide> } <ide> <add> @Override <ide> public Locale getLocale() { <ide> return this.locale; <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java <ide> public AbstractApplicationContext(ApplicationContext parent) { <ide> * of the context bean if the context is itself defined as a bean. <ide> * @param id the unique id of the context <ide> */ <add> @Override <ide> public void setId(String id) { <ide> this.id = id; <ide> } <ide> <add> @Override <ide> public String getId() { <ide> return this.id; <ide> } <ide> <add> @Override <ide> public String getApplicationName() { <ide> return ""; <ide> } <ide> public void setDisplayName(String displayName) { <ide> * Return a friendly name for this context. <ide> * @return a display name for this context (never {@code null}) <ide> */ <add> @Override <ide> public String getDisplayName() { <ide> return this.displayName; <ide> } <ide> public String getDisplayName() { <ide> * Return the parent context, or {@code null} if there is no parent <ide> * (that is, this context is the root of the context hierarchy). <ide> */ <add> @Override <ide> public ApplicationContext getParent() { <ide> return this.parent; <ide> } <ide> public ApplicationContext getParent() { <ide> * <p>If {@code null}, a new environment will be initialized via <ide> * {@link #createEnvironment()}. <ide> */ <add> @Override <ide> public ConfigurableEnvironment getEnvironment() { <ide> if (this.environment == null) { <ide> this.environment = createEnvironment(); <ide> public ConfigurableEnvironment getEnvironment() { <ide> * should be performed <em>before</em> {@link #refresh()}. <ide> * @see org.springframework.context.support.AbstractApplicationContext#createEnvironment <ide> */ <add> @Override <ide> public void setEnvironment(ConfigurableEnvironment environment) { <ide> this.environment = environment; <ide> } <ide> public void setEnvironment(ConfigurableEnvironment environment) { <ide> * if already available. <ide> * @see #getBeanFactory() <ide> */ <add> @Override <ide> public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException { <ide> return getBeanFactory(); <ide> } <ide> <ide> /** <ide> * Return the timestamp (ms) when this context was first loaded. <ide> */ <add> @Override <ide> public long getStartupDate() { <ide> return this.startupDate; <ide> } <ide> public long getStartupDate() { <ide> * @param event the event to publish (may be application-specific or a <ide> * standard framework event) <ide> */ <add> @Override <ide> public void publishEvent(ApplicationEvent event) { <ide> Assert.notNull(event, "Event must not be null"); <ide> if (logger.isTraceEnabled()) { <ide> protected ResourcePatternResolver getResourcePatternResolver() { <ide> * its environment is an instance of {@link ConfigurableEnvironment}. <ide> * @see ConfigurableEnvironment#merge(ConfigurableEnvironment) <ide> */ <add> @Override <ide> public void setParent(ApplicationContext parent) { <ide> this.parent = parent; <ide> if (parent != null) { <ide> public void setParent(ApplicationContext parent) { <ide> } <ide> } <ide> <add> @Override <ide> public void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor) { <ide> this.beanFactoryPostProcessors.add(beanFactoryPostProcessor); <ide> } <ide> public List<BeanFactoryPostProcessor> getBeanFactoryPostProcessors() { <ide> return this.beanFactoryPostProcessors; <ide> } <ide> <add> @Override <ide> public void addApplicationListener(ApplicationListener<?> listener) { <ide> if (this.applicationEventMulticaster != null) { <ide> this.applicationEventMulticaster.addApplicationListener(listener); <ide> protected ConfigurableEnvironment createEnvironment() { <ide> return new StandardEnvironment(); <ide> } <ide> <add> @Override <ide> public void refresh() throws BeansException, IllegalStateException { <ide> synchronized (this.startupShutdownMonitor) { <ide> // Prepare this context for refreshing. <ide> protected void cancelRefresh(BeansException ex) { <ide> * @see #close() <ide> * @see #doClose() <ide> */ <add> @Override <ide> public void registerShutdownHook() { <ide> if (this.shutdownHook == null) { <ide> // No shutdown hook registered yet. <ide> public void run() { <ide> * @see #close() <ide> * @see org.springframework.beans.factory.access.SingletonBeanFactoryLocator <ide> */ <add> @Override <ide> public void destroy() { <ide> close(); <ide> } <ide> public void destroy() { <ide> * @see #doClose() <ide> * @see #registerShutdownHook() <ide> */ <add> @Override <ide> public void close() { <ide> synchronized (this.startupShutdownMonitor) { <ide> doClose(); <ide> protected void onClose() { <ide> // For subclasses: do nothing by default. <ide> } <ide> <add> @Override <ide> public boolean isActive() { <ide> synchronized (this.activeMonitor) { <ide> return this.active; <ide> public boolean isActive() { <ide> // Implementation of BeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public Object getBean(String name) throws BeansException { <ide> return getBeanFactory().getBean(name); <ide> } <ide> <add> @Override <ide> public <T> T getBean(String name, Class<T> requiredType) throws BeansException { <ide> return getBeanFactory().getBean(name, requiredType); <ide> } <ide> <add> @Override <ide> public <T> T getBean(Class<T> requiredType) throws BeansException { <ide> return getBeanFactory().getBean(requiredType); <ide> } <ide> <add> @Override <ide> public Object getBean(String name, Object... args) throws BeansException { <ide> return getBeanFactory().getBean(name, args); <ide> } <ide> <add> @Override <ide> public boolean containsBean(String name) { <ide> return getBeanFactory().containsBean(name); <ide> } <ide> <add> @Override <ide> public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { <ide> return getBeanFactory().isSingleton(name); <ide> } <ide> <add> @Override <ide> public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { <ide> return getBeanFactory().isPrototype(name); <ide> } <ide> <add> @Override <ide> public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException { <ide> return getBeanFactory().isTypeMatch(name, targetType); <ide> } <ide> <add> @Override <ide> public Class<?> getType(String name) throws NoSuchBeanDefinitionException { <ide> return getBeanFactory().getType(name); <ide> } <ide> <add> @Override <ide> public String[] getAliases(String name) { <ide> return getBeanFactory().getAliases(name); <ide> } <ide> public String[] getAliases(String name) { <ide> // Implementation of ListableBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public boolean containsBeanDefinition(String beanName) { <ide> return getBeanFactory().containsBeanDefinition(beanName); <ide> } <ide> <add> @Override <ide> public int getBeanDefinitionCount() { <ide> return getBeanFactory().getBeanDefinitionCount(); <ide> } <ide> <add> @Override <ide> public String[] getBeanDefinitionNames() { <ide> return getBeanFactory().getBeanDefinitionNames(); <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class<?> type) { <ide> return getBeanFactory().getBeanNamesForType(type); <ide> } <ide> <add> @Override <ide> public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) { <ide> return getBeanFactory().getBeanNamesForType(type, includeNonSingletons, allowEagerInit); <ide> } <ide> <add> @Override <ide> public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException { <ide> return getBeanFactory().getBeansOfType(type); <ide> } <ide> <add> @Override <ide> public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) <ide> throws BeansException { <ide> <ide> return getBeanFactory().getBeansOfType(type, includeNonSingletons, allowEagerInit); <ide> } <ide> <add> @Override <ide> public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) <ide> throws BeansException { <ide> <ide> return getBeanFactory().getBeansWithAnnotation(annotationType); <ide> } <ide> <add> @Override <ide> public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) { <ide> return getBeanFactory().findAnnotationOnBean(beanName, annotationType); <ide> } <ide> public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> a <ide> // Implementation of HierarchicalBeanFactory interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public BeanFactory getParentBeanFactory() { <ide> return getParent(); <ide> } <ide> <add> @Override <ide> public boolean containsLocalBean(String name) { <ide> return getBeanFactory().containsLocalBean(name); <ide> } <ide> protected BeanFactory getInternalParentBeanFactory() { <ide> // Implementation of MessageSource interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public String getMessage(String code, Object args[], String defaultMessage, Locale locale) { <ide> return getMessageSource().getMessage(code, args, defaultMessage, locale); <ide> } <ide> <add> @Override <ide> public String getMessage(String code, Object args[], Locale locale) throws NoSuchMessageException { <ide> return getMessageSource().getMessage(code, args, locale); <ide> } <ide> <add> @Override <ide> public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { <ide> return getMessageSource().getMessage(resolvable, locale); <ide> } <ide> protected MessageSource getInternalParentMessageSource() { <ide> // Implementation of ResourcePatternResolver interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public Resource[] getResources(String locationPattern) throws IOException { <ide> return this.resourcePatternResolver.getResources(locationPattern); <ide> } <ide> public Resource[] getResources(String locationPattern) throws IOException { <ide> // Implementation of Lifecycle interface <ide> //--------------------------------------------------------------------- <ide> <add> @Override <ide> public void start() { <ide> getLifecycleProcessor().start(); <ide> publishEvent(new ContextStartedEvent(this)); <ide> } <ide> <add> @Override <ide> public void stop() { <ide> getLifecycleProcessor().stop(); <ide> publishEvent(new ContextStoppedEvent(this)); <ide> } <ide> <add> @Override <ide> public boolean isRunning() { <ide> return getLifecycleProcessor().isRunning(); <ide> } <ide> public boolean isRunning() { <ide> * @see #refreshBeanFactory() <ide> * @see #closeBeanFactory() <ide> */ <add> @Override <ide> public abstract ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException; <ide> <ide> <ide> public BeanPostProcessorChecker(ConfigurableListableBeanFactory beanFactory, int <ide> this.beanPostProcessorTargetCount = beanPostProcessorTargetCount; <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) { <ide> if (bean != null && !(bean instanceof BeanPostProcessor) && <ide> this.beanFactory.getBeanPostProcessorCount() < this.beanPostProcessorTargetCount) { <ide> private class ApplicationListenerDetector implements MergedBeanDefinitionPostPro <ide> <ide> private final Map<String, Boolean> singletonNames = new ConcurrentHashMap<String, Boolean>(64); <ide> <add> @Override <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) { <ide> if (beanDefinition.isSingleton()) { <ide> this.singletonNames.put(beanName, Boolean.TRUE); <ide> } <ide> } <ide> <add> @Override <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> return bean; <ide> } <ide> <add> @Override <ide> public Object postProcessAfterInitialization(Object bean, String beanName) { <ide> if (bean instanceof ApplicationListener) { <ide> // potentially not detected as a listener by getBeanNamesForType retrieval
300
Python
Python
fix incorrect output types for some ufuncs
772b0dab26370a36c3774049ad50315fc953c07a
<ide><path>numpy/core/code_generators/generate_umath.py <ide> def __init__(self, nin, nout, identity, docstring, <ide> Ufunc(2, 1, One, <ide> 'returns x1 and x2 elementwise.', <ide> TD(noobj, out='?'), <del> TD(M, f='logical_and', out='?'), <add> TD(M, f='logical_and'), <ide> ), <ide> 'logical_not' : <ide> Ufunc(1, 1, None, <ide> 'returns not x elementwise.', <ide> TD(noobj, out='?'), <del> TD(M, f='logical_not', out='?'), <add> TD(M, f='logical_not'), <ide> ), <ide> 'logical_or' : <ide> Ufunc(2, 1, Zero, <ide> 'returns x1 or x2 elementwise.', <ide> TD(noobj, out='?'), <del> TD(M, f='logical_or', out='?'), <add> TD(M, f='logical_or'), <ide> ), <ide> 'logical_xor' : <ide> Ufunc(2, 1, None, <ide> 'returns x1 xor x2 elementwise.', <ide> TD(noobj, out='?'), <del> TD(M, f='logical_xor', out='?'), <add> TD(M, f='logical_xor'), <ide> ), <ide> 'maximum' : <ide> Ufunc(2, 1, None,
1
Ruby
Ruby
generate appropriate error more judiciously
569fb1fffb216ad96721fe1f5d706535e9920154
<ide><path>activemodel/lib/active_model/observing.rb <ide> def count_observers <ide> def instantiate_observer(observer) #:nodoc: <ide> # string/symbol <ide> if observer.respond_to?(:to_sym) <del> observer.to_s.camelize.constantize.instance <del> elsif observer.respond_to?(:instance) <add> observer = observer.to_s.camelize.constantize <add> end <add> if observer.respond_to?(:instance) <ide> observer.instance <ide> else <ide> raise ArgumentError, <ide><path>activemodel/test/cases/observing_test.rb <ide> def setup <ide> ObservedModel.instantiate_observers <ide> end <ide> <add> test "raises an appropriate error when a developer accidentally adds the wrong class (i.e. Widget instead of WidgetObserver)" do <add> assert_raise ArgumentError do <add> ObservedModel.observers = ['string'] <add> ObservedModel.instantiate_observers <add> end <add> assert_raise ArgumentError do <add> ObservedModel.observers = [:string] <add> ObservedModel.instantiate_observers <add> end <add> assert_raise ArgumentError do <add> ObservedModel.observers = [String] <add> ObservedModel.instantiate_observers <add> end <add> end <add> <ide> test "passes observers to subclasses" do <ide> FooObserver.instance <ide> bar = Class.new(Foo)
2
Javascript
Javascript
remove double to string convertion in formdata
9e78a63f8417a08d5da9b4a96e978ba5290bbb7f
<ide><path>Libraries/Network/FormData.js <ide> class FormData { <ide> getParts(): Array<FormDataPart> { <ide> return this._parts.map(([name, value]) => { <ide> var contentDisposition = 'form-data; name="' + name + '"'; <del> // Convert non-object values to strings as per FormData.append() spec <del> if (typeof value !== 'object') { <del> value = '' + value; <del> } <ide> <ide> /* $FlowIssue(>=0.20.1) #9463928 */ <ide> var headers: Headers = {'content-disposition': contentDisposition}; <ide> class FormData { <ide> } <ide> return {...value, headers, fieldName: name}; <ide> } <del> // Cast to string all other values <add> // Convert non-object values to strings as per FormData.append() spec <ide> return {string: String(value), headers, fieldName: name}; <ide> }); <ide> }
1
Go
Go
handle plugin shutdown when liverestore is set
4a44cf1d4c8e540b67aaa3834291a964c6ab7524
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) Shutdown() error { <ide> daemon.shutdown = true <ide> // Keep mounts and networking running on daemon shutdown if <ide> // we are to keep containers running and restore them. <add> <add> pluginShutdown() <add> <ide> if daemon.configStore.LiveRestore && daemon.containers != nil { <ide> // check if there are any running containers, if none we should do some cleanup <ide> if ls, err := daemon.Containers(&types.ContainerListOptions{}); len(ls) != 0 || err != nil { <ide> func (daemon *Daemon) Shutdown() error { <ide> } <ide> } <ide> <del> pluginShutdown() <del> <ide> if err := daemon.cleanupMounts(); err != nil { <ide> return err <ide> } <ide><path>integration-cli/docker_cli_daemon_experimental_test.go <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) { <ide> c.Assert(out, checker.Contains, "false") <ide> } <ide> <del>// TestDaemonShutdownLiveRestoreWithPlugins leaves plugin running. <del>func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C) { <add>// TestDaemonKillLiveRestoreWithPlugins SIGKILLs daemon started with --live-restore. <add>// Plugins should continue to run. <add>func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *check.C) { <ide> if err := s.d.Start("--live-restore"); err != nil { <ide> c.Fatalf("Could not start daemon: %v", err) <ide> } <ide> func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C) <ide> } <ide> } <ide> <add>// TestDaemonShutdownLiveRestoreWithPlugins SIGTERMs daemon started with --live-restore. <add>// Plugins should continue to run. <add>func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C) { <add> if err := s.d.Start("--live-restore"); err != nil { <add> c.Fatalf("Could not start daemon: %v", err) <add> } <add> if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pluginName); err != nil { <add> c.Fatalf("Could not install plugin: %v %s", err, out) <add> } <add> defer func() { <add> if err := s.d.Restart("--live-restore"); err != nil { <add> c.Fatalf("Could not restart daemon: %v", err) <add> } <add> if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil { <add> c.Fatalf("Could not disable plugin: %v %s", err, out) <add> } <add> if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil { <add> c.Fatalf("Could not remove plugin: %v %s", err, out) <add> } <add> }() <add> <add> if err := s.d.cmd.Process.Signal(os.Interrupt); err != nil { <add> c.Fatalf("Could not kill daemon: %v", err) <add> } <add> <add> cmd := exec.Command("pgrep", "-f", "plugin-no-remove") <add> if out, ec, err := runCommandWithOutput(cmd); ec != 0 { <add> c.Fatalf("Expected exit code '0', got %d err: %v output: %s ", ec, err, out) <add> } <add>} <add> <ide> // TestDaemonShutdownWithPlugins shuts down running plugins. <ide> func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) { <ide> if err := s.d.Start(); err != nil { <ide><path>plugin/manager.go <ide> func (pm *Manager) init() error { <ide> if requiresManualRestore { <ide> // if liveRestore is not enabled, the plugin will be stopped now so we should enable it <ide> if err := pm.enable(p); err != nil { <del> logrus.Errorf("Error restoring plugin '%s': %s", p.Name(), err) <add> logrus.Errorf("Error enabling plugin '%s': %s", p.Name(), err) <ide> } <ide> } <ide> }(p) <ide><path>plugin/manager_linux.go <ide> func (pm *Manager) Shutdown() { <ide> <ide> pm.shutdown = true <ide> for _, p := range pm.plugins { <add> if pm.liveRestore && p.P.Active { <add> logrus.Debug("Plugin active when liveRestore is set, skipping shutdown") <add> continue <add> } <ide> if p.restartManager != nil { <ide> if err := p.restartManager.Cancel(); err != nil { <ide> logrus.Error(err) <ide> } <ide> } <del> if pm.containerdClient != nil { <add> if pm.containerdClient != nil && p.P.Active { <ide> p.exitChan = make(chan bool) <ide> err := pm.containerdClient.Signal(p.P.ID, int(syscall.SIGTERM)) <ide> if err != nil { <ide> func (pm *Manager) Shutdown() { <ide> } <ide> } <ide> close(p.exitChan) <add> pm.Lock() <add> p.P.Active = false <add> pm.save() <add> pm.Unlock() <ide> } <ide> if err := os.RemoveAll(p.runtimeSourcePath); err != nil { <ide> logrus.Errorf("Remove plugin runtime failed with error: %v", err)
4
Mixed
Javascript
add signal support to pipeline generators
c04d621eccfa1a8e65188ca6921ecd1b3b0a934c
<ide><path>doc/api/stream.md <ide> const { pipeline } = require('stream/promises'); <ide> <ide> async function run() { <ide> const ac = new AbortController(); <del> const options = { <del> signal: ac.signal, <del> }; <add> const signal = ac.signal; <ide> <ide> setTimeout(() => ac.abort(), 1); <ide> await pipeline( <ide> fs.createReadStream('archive.tar'), <ide> zlib.createGzip(), <ide> fs.createWriteStream('archive.tar.gz'), <del> options, <add> { signal }, <ide> ); <ide> } <ide> <ide> const fs = require('fs'); <ide> async function run() { <ide> await pipeline( <ide> fs.createReadStream('lowercase.txt'), <del> async function* (source) { <add> async function* (source, signal) { <ide> source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. <ide> for await (const chunk of source) { <del> yield chunk.toUpperCase(); <add> yield await processChunk(chunk, { signal }); <ide> } <ide> }, <ide> fs.createWriteStream('uppercase.txt') <ide> async function run() { <ide> run().catch(console.error); <ide> ``` <ide> <add>Remember to handle the `signal` argument passed into the async generator. <add>Especially in the case where the async generator is the source for the <add>pipeline (i.e. first argument) or the pipeline will never complete. <add> <add>```js <add>const { pipeline } = require('stream/promises'); <add>const fs = require('fs'); <add> <add>async function run() { <add> await pipeline( <add> async function * (signal) { <add> await someLongRunningfn({ signal }); <add> yield 'asd'; <add> }, <add> fs.createWriteStream('uppercase.txt') <add> ); <add> console.log('Pipeline succeeded.'); <add>} <add> <add>run().catch(console.error); <add>``` <add> <ide> `stream.pipeline()` will call `stream.destroy(err)` on all streams except: <ide> * `Readable` streams which have emitted `'end'` or `'close'`. <ide> * `Writable` streams which have emitted `'finish'` or `'close'`. <ide> the `Readable.from()` utility method: <ide> ```js <ide> const { Readable } = require('stream'); <ide> <add>const ac = new AbortController(); <add>const signal = ac.signal; <add> <ide> async function * generate() { <ide> yield 'a'; <add> await someLongRunningFn({ signal }); <ide> yield 'b'; <ide> yield 'c'; <ide> } <ide> <ide> const readable = Readable.from(generate()); <add>readable.on('close', () => { <add> ac.abort(); <add>}); <ide> <ide> readable.on('data', (chunk) => { <ide> console.log(chunk); <ide> const { pipeline: pipelinePromise } = require('stream/promises'); <ide> <ide> const writable = fs.createWriteStream('./file'); <ide> <add>const ac = new AbortController(); <add>const signal = ac.signal; <add> <add>const iterator = createIterator({ signal }); <add> <ide> // Callback Pattern <ide> pipeline(iterator, writable, (err, value) => { <ide> if (err) { <ide> console.error(err); <ide> } else { <ide> console.log(value, 'value returned'); <ide> } <add>}).on('close', () => { <add> ac.abort(); <ide> }); <ide> <ide> // Promise Pattern <ide> pipelinePromise(iterator, writable) <ide> .then((value) => { <ide> console.log(value, 'value returned'); <ide> }) <del> .catch(console.error); <add> .catch((err) => { <add> console.error(err); <add> ac.abort(); <add> }); <ide> ``` <ide> <ide> <!--type=misc--> <ide><path>lib/internal/streams/compose.js <ide> 'use strict'; <ide> <del>const pipeline = require('internal/streams/pipeline'); <add>const { pipeline } = require('internal/streams/pipeline'); <ide> const Duplex = require('internal/streams/duplex'); <ide> const { destroyer } = require('internal/streams/destroy'); <ide> const { <ide><path>lib/internal/streams/duplexify.js <ide> const from = require('internal/streams/from'); <ide> const { <ide> isBlob, <ide> } = require('internal/blob'); <add>const { AbortController } = require('internal/abort_controller'); <ide> <ide> const { <ide> FunctionPrototypeCall <ide> module.exports = function duplexify(body, name) { <ide> // } <ide> <ide> if (typeof body === 'function') { <del> const { value, write, final } = fromAsyncGen(body); <add> const { value, write, final, destroy } = fromAsyncGen(body); <ide> <ide> if (isIterable(value)) { <ide> return from(Duplexify, value, { <ide> // TODO (ronag): highWaterMark? <ide> objectMode: true, <ide> write, <del> final <add> final, <add> destroy <ide> }); <ide> } <ide> <ide> module.exports = function duplexify(body, name) { <ide> process.nextTick(cb, err); <ide> } <ide> }); <del> } <add> }, <add> destroy <ide> }); <ide> } <ide> <ide> module.exports = function duplexify(body, name) { <ide> <ide> function fromAsyncGen(fn) { <ide> let { promise, resolve } = createDeferredPromise(); <add> const ac = new AbortController(); <add> const signal = ac.signal; <ide> const value = fn(async function*() { <ide> while (true) { <ide> const { chunk, done, cb } = await promise; <ide> process.nextTick(cb); <ide> if (done) return; <add> if (signal.aborted) throw new AbortError(); <ide> yield chunk; <ide> ({ promise, resolve } = createDeferredPromise()); <ide> } <del> }()); <add> }(), { signal }); <ide> <ide> return { <ide> value, <ide> function fromAsyncGen(fn) { <ide> }, <ide> final(cb) { <ide> resolve({ done: true, cb }); <add> }, <add> destroy(err, cb) { <add> ac.abort(); <add> cb(err); <ide> } <ide> }; <ide> } <ide><path>lib/internal/streams/pipeline.js <ide> const { <ide> ERR_MISSING_ARGS, <ide> ERR_STREAM_DESTROYED, <ide> }, <add> AbortError, <ide> } = require('internal/errors'); <ide> <del>const { validateCallback } = require('internal/validators'); <add>const { <add> validateCallback, <add> validateAbortSignal <add>} = require('internal/validators'); <ide> <ide> const { <ide> isIterable, <ide> isReadableNodeStream, <ide> isNodeStream, <ide> } = require('internal/streams/utils'); <add>const { AbortController } = require('internal/abort_controller'); <ide> <ide> let PassThrough; <ide> let Readable; <ide> function pipeline(...streams) { <ide> streams = streams[0]; <ide> } <ide> <add> return pipelineImpl(streams, callback); <add>} <add> <add>function pipelineImpl(streams, callback, opts) { <ide> if (streams.length < 2) { <ide> throw new ERR_MISSING_ARGS('streams'); <ide> } <ide> <add> const ac = new AbortController(); <add> const signal = ac.signal; <add> const outerSignal = opts?.signal; <add> <add> validateAbortSignal(outerSignal, 'options.signal'); <add> <add> function abort() { <add> finishImpl(new AbortError()); <add> } <add> <add> outerSignal?.addEventListener('abort', abort); <add> <ide> let error; <ide> let value; <ide> const destroys = []; <ide> <ide> let finishCount = 0; <ide> <ide> function finish(err) { <del> const final = --finishCount === 0; <add> finishImpl(err, --finishCount === 0); <add> } <ide> <add> function finishImpl(err, final) { <ide> if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { <ide> error = err; <ide> } <ide> function pipeline(...streams) { <ide> destroys.shift()(error); <ide> } <ide> <add> outerSignal?.removeEventListener('abort', abort); <add> ac.abort(); <add> <ide> if (final) { <ide> callback(error, value); <ide> } <ide> function pipeline(...streams) { <ide> <ide> if (i === 0) { <ide> if (typeof stream === 'function') { <del> ret = stream(); <add> ret = stream({ signal }); <ide> if (!isIterable(ret)) { <ide> throw new ERR_INVALID_RETURN_VALUE( <ide> 'Iterable, AsyncIterable or Stream', 'source', ret); <ide> function pipeline(...streams) { <ide> } <ide> } else if (typeof stream === 'function') { <ide> ret = makeAsyncIterable(ret); <del> ret = stream(ret); <add> ret = stream(ret, { signal }); <ide> <ide> if (reading) { <ide> if (!isIterable(ret, true)) { <ide> function pipeline(...streams) { <ide> } <ide> } <ide> <add> if (signal?.aborted || outerSignal?.aborted) { <add> process.nextTick(abort); <add> } <add> <ide> return ret; <ide> } <ide> <del>module.exports = pipeline; <add>module.exports = { pipelineImpl, pipeline }; <ide><path>lib/stream.js <ide> const { <ide> promisify: { custom: customPromisify }, <ide> } = require('internal/util'); <ide> <del>const pipeline = require('internal/streams/pipeline'); <ide> const compose = require('internal/streams/compose'); <add>const { pipeline } = require('internal/streams/pipeline'); <ide> const { destroyer } = require('internal/streams/destroy'); <ide> const eos = require('internal/streams/end-of-stream'); <ide> const internalBuffer = require('internal/buffer'); <ide><path>lib/stream/promises.js <ide> const { <ide> Promise, <ide> } = primordials; <ide> <del>const { <del> addAbortSignalNoValidate, <del>} = require('internal/streams/add-abort-signal'); <del> <del>const { <del> validateAbortSignal, <del>} = require('internal/validators'); <del> <ide> const { <ide> isIterable, <ide> isNodeStream, <ide> } = require('internal/streams/utils'); <ide> <del>const pl = require('internal/streams/pipeline'); <add>const { pipelineImpl: pl } = require('internal/streams/pipeline'); <ide> const eos = require('internal/streams/end-of-stream'); <ide> <ide> function pipeline(...streams) { <ide> function pipeline(...streams) { <ide> !isNodeStream(lastArg) && !isIterable(lastArg)) { <ide> const options = ArrayPrototypePop(streams); <ide> signal = options.signal; <del> validateAbortSignal(signal, 'options.signal'); <ide> } <ide> <del> const pipe = pl(...streams, (err, value) => { <add> pl(streams, (err, value) => { <ide> if (err) { <ide> reject(err); <ide> } else { <ide> resolve(value); <ide> } <del> }); <del> if (signal) { <del> addAbortSignalNoValidate(signal, pipe); <del> } <add> }, { signal }); <ide> }); <ide> } <ide> <ide><path>test/parallel/test-stream-pipeline.js <ide> const { <ide> Duplex, <ide> addAbortSignal, <ide> } = require('stream'); <add>const pipelinep = require('stream/promises').pipeline; <ide> const assert = require('assert'); <ide> const http = require('http'); <ide> const { promisify } = require('util'); <ide> const net = require('net'); <add>const tsp = require('timers/promises'); <ide> <ide> { <ide> let finished = false; <ide> const net = require('net'); <ide> assert.strictEqual(res, content); <ide> })); <ide> } <add> <add>{ <add> const ac = new AbortController(); <add> const signal = ac.signal; <add> pipelinep( <add> async function * ({ signal }) { <add> await tsp.setTimeout(1e6, signal); <add> }, <add> async function(source) { <add> <add> }, <add> { signal } <add> ).catch(common.mustCall((err) => { <add> assert.strictEqual(err.name, 'AbortError'); <add> })); <add> ac.abort(); <add>}
7
PHP
PHP
add jsonp as a default response
1beea5d594b89986b5f92ec2fd33bbeb722a21f9
<ide><path>laravel/response.php <ide> public static function json($data, $status = 200, $headers = array()) <ide> return new static(json_encode($data), $status, $headers); <ide> } <ide> <add> /** <add> * Create a new JSONP response. <add> * <add> * <code> <add> * // Create a response instance with JSONP <add> * return Response::jsonp($data, 200, array('header' => 'value')); <add> * </code> <add> * <add> * @param mixed $data <add> * @param int $status <add> * @param array $headers <add> * @return Response <add> */ <add> public static function jsonp($data, $status = 200, $headers = array()) <add> { <add> $headers['Content-Type'] = 'application/javascript; charset=utf-8'; <add> <add> return new static(json_encode($data), $status, $headers); <add> } <add> <ide> /** <ide> * Create a new response of JSON'd Eloquent models. <ide> * <ide> public function __toString() <ide> return $this->render(); <ide> } <ide> <del>} <ide>\ No newline at end of file <add>}
1
Text
Text
edit colormode information
973b5c02bba6b744f7ba38f335ec8d0d67e1b199
<ide><path>doc/api/console.md <ide> changes: <ide> * `ignoreErrors` {boolean} Ignore errors when writing to the underlying <ide> streams. **Default:** `true`. <ide> * `colorMode` {boolean|string} Set color support for this `Console` instance. <del> Setting to `true` enables coloring while inspecting values, setting to <del> `'auto'` will make color support depend on the value of the `isTTY` property <add> Setting to `true` enables coloring while inspecting values. Setting to <add> `false` disables coloring while inspecting values. Setting to <add> `'auto'` makes color support depend on the value of the `isTTY` property <ide> and the value returned by `getColorDepth()` on the respective stream. This <ide> option can not be used, if `inspectOptions.colors` is set as well. <ide> **Default:** `'auto'`.
1
Javascript
Javascript
move location to ember-routing
8bb14d5e3b50abc58d7ed9b053709e604070de00
<ide><path>packages/ember-routing/lib/location.js <add>require('ember-views'); <add>require('ember-routing/location/api'); <add>require('ember-routing/location/none_location'); <add>require('ember-routing/location/hash_location'); <add>require('ember-routing/location/history_location'); <ide><path>packages/ember-routing/lib/location/api.js <add>/** <add>@module ember <add>@submodule ember-old-router <add>*/ <add> <add>var get = Ember.get, set = Ember.set; <add> <add>/* <add> This file implements the `location` API used by Ember's router. <add> <add> That API is: <add> <add> getURL: returns the current URL <add> setURL(path): sets the current URL <add> onUpdateURL(callback): triggers the callback when the URL changes <add> formatURL(url): formats `url` to be placed into `href` attribute <add> <add> Calling setURL will not trigger onUpdateURL callbacks. <add> <add> TODO: This should perhaps be moved so that it's visible in the doc output. <add>*/ <add> <add>/** <add> Ember.Location returns an instance of the correct implementation of <add> the `location` API. <add> <add> You can pass it a `implementation` ('hash', 'history', 'none') to force a <add> particular implementation. <add> <add> @class Location <add> @namespace Ember <add> @static <add>*/ <add>Ember.Location = { <add> create: function(options) { <add> var implementation = options && options.implementation; <add> Ember.assert("Ember.Location.create: you must specify a 'implementation' option", !!implementation); <add> <add> var implementationClass = this.implementations[implementation]; <add> Ember.assert("Ember.Location.create: " + implementation + " is not a valid implementation", !!implementationClass); <add> <add> return implementationClass.create.apply(implementationClass, arguments); <add> }, <add> <add> registerImplementation: function(name, implementation) { <add> this.implementations[name] = implementation; <add> }, <add> <add> implementations: {} <add>}; <ide><path>packages/ember-routing/lib/location/hash_location.js <add>/** <add>@module ember <add>@submodule ember-old-router <add>*/ <add> <add>var get = Ember.get, set = Ember.set; <add> <add>/** <add> Ember.HashLocation implements the location API using the browser's <add> hash. At present, it relies on a hashchange event existing in the <add> browser. <add> <add> @class HashLocation <add> @namespace Ember <add> @extends Ember.Object <add>*/ <add>Ember.HashLocation = Ember.Object.extend({ <add> <add> init: function() { <add> set(this, 'location', get(this, 'location') || window.location); <add> }, <add> <add> /** <add> @private <add> <add> Returns the current `location.hash`, minus the '#' at the front. <add> <add> @method getURL <add> */ <add> getURL: function() { <add> return get(this, 'location').hash.substr(1); <add> }, <add> <add> /** <add> @private <add> <add> Set the `location.hash` and remembers what was set. This prevents <add> `onUpdateURL` callbacks from triggering when the hash was set by <add> `HashLocation`. <add> <add> @method setURL <add> @param path {String} <add> */ <add> setURL: function(path) { <add> get(this, 'location').hash = path; <add> set(this, 'lastSetURL', path); <add> }, <add> <add> /** <add> @private <add> <add> Register a callback to be invoked when the hash changes. These <add> callbacks will execute when the user presses the back or forward <add> button, but not after `setURL` is invoked. <add> <add> @method onUpdateURL <add> @param callback {Function} <add> */ <add> onUpdateURL: function(callback) { <add> var self = this; <add> var guid = Ember.guidFor(this); <add> <add> Ember.$(window).bind('hashchange.ember-location-'+guid, function() { <add> var path = location.hash.substr(1); <add> if (get(self, 'lastSetURL') === path) { return; } <add> <add> set(self, 'lastSetURL', null); <add> <add> callback(location.hash.substr(1)); <add> }); <add> }, <add> <add> /** <add> @private <add> <add> Given a URL, formats it to be placed into the page as part <add> of an element's `href` attribute. <add> <add> This is used, for example, when using the {{action}} helper <add> to generate a URL based on an event. <add> <add> @method formatURL <add> @param url {String} <add> */ <add> formatURL: function(url) { <add> return '#'+url; <add> }, <add> <add> willDestroy: function() { <add> var guid = Ember.guidFor(this); <add> <add> Ember.$(window).unbind('hashchange.ember-location-'+guid); <add> } <add>}); <add> <add>Ember.Location.registerImplementation('hash', Ember.HashLocation); <ide><path>packages/ember-routing/lib/location/history_location.js <add>/** <add>@module ember <add>@submodule ember-old-router <add>*/ <add> <add>var get = Ember.get, set = Ember.set; <add>var popstateReady = false; <add> <add>/** <add> Ember.HistoryLocation implements the location API using the browser's <add> history.pushState API. <add> <add> @class HistoryLocation <add> @namespace Ember <add> @extends Ember.Object <add>*/ <add>Ember.HistoryLocation = Ember.Object.extend({ <add> <add> init: function() { <add> set(this, 'location', get(this, 'location') || window.location); <add> this.initState(); <add> }, <add> <add> /** <add> @private <add> <add> Used to set state on first call to setURL <add> <add> @method initState <add> */ <add> initState: function() { <add> this.replaceState(get(this, 'location').pathname); <add> set(this, 'history', window.history); <add> }, <add> <add> /** <add> Will be pre-pended to path upon state change <add> <add> @property rootURL <add> @default '/' <add> */ <add> rootURL: '/', <add> <add> /** <add> @private <add> <add> Returns the current `location.pathname`. <add> <add> @method getURL <add> */ <add> getURL: function() { <add> return get(this, 'location').pathname; <add> }, <add> <add> /** <add> @private <add> <add> Uses `history.pushState` to update the url without a page reload. <add> <add> @method setURL <add> @param path {String} <add> */ <add> setURL: function(path) { <add> path = this.formatURL(path); <add> <add> if (this.getState() && this.getState().path !== path) { <add> popstateReady = true; <add> this.pushState(path); <add> } <add> }, <add> <add> /** <add> @private <add> <add> Get the current `history.state` <add> <add> @method getState <add> */ <add> getState: function() { <add> return get(this, 'history').state; <add> }, <add> <add> /** <add> @private <add> <add> Pushes a new state <add> <add> @method pushState <add> @param path {String} <add> */ <add> pushState: function(path) { <add> window.history.pushState({ path: path }, null, path); <add> }, <add> <add> /** <add> @private <add> <add> Replaces the current state <add> <add> @method replaceState <add> @param path {String} <add> */ <add> replaceState: function(path) { <add> window.history.replaceState({ path: path }, null, path); <add> }, <add> <add> /** <add> @private <add> <add> Register a callback to be invoked whenever the browser <add> history changes, including using forward and back buttons. <add> <add> @method onUpdateURL <add> @param callback {Function} <add> */ <add> onUpdateURL: function(callback) { <add> var guid = Ember.guidFor(this); <add> <add> Ember.$(window).bind('popstate.ember-location-'+guid, function(e) { <add> if(!popstateReady) { <add> return; <add> } <add> callback(location.pathname); <add> }); <add> }, <add> <add> /** <add> @private <add> <add> Used when using `{{action}}` helper. The url is always appended to the rootURL. <add> <add> @method formatURL <add> @param url {String} <add> */ <add> formatURL: function(url) { <add> var rootURL = get(this, 'rootURL'); <add> <add> if (url !== '') { <add> rootURL = rootURL.replace(/\/$/, ''); <add> } <add> <add> return rootURL + url; <add> }, <add> <add> willDestroy: function() { <add> var guid = Ember.guidFor(this); <add> <add> Ember.$(window).unbind('popstate.ember-location-'+guid); <add> } <add>}); <add> <add>Ember.Location.registerImplementation('history', Ember.HistoryLocation); <ide><path>packages/ember-routing/lib/location/none_location.js <add>/** <add>@module ember <add>@submodule ember-old-router <add>*/ <add> <add>var get = Ember.get, set = Ember.set; <add> <add>/** <add> Ember.NoneLocation does not interact with the browser. It is useful for <add> testing, or when you need to manage state with your Router, but temporarily <add> don't want it to muck with the URL (for example when you embed your <add> application in a larger page). <add> <add> @class NoneLocation <add> @namespace Ember <add> @extends Ember.Object <add>*/ <add>Ember.NoneLocation = Ember.Object.extend({ <add> path: '', <add> <add> getURL: function() { <add> return get(this, 'path'); <add> }, <add> <add> setURL: function(path) { <add> set(this, 'path', path); <add> }, <add> <add> onUpdateURL: function(callback) { <add> // We are not wired up to the browser, so we'll never trigger the callback. <add> }, <add> <add> formatURL: function(url) { <add> // The return value is not overly meaningful, but we do not want to throw <add> // errors when test code renders templates containing {{action href=true}} <add> // helpers. <add> return url; <add> } <add>}); <add> <add>Ember.Location.registerImplementation('none', Ember.NoneLocation);
5
Ruby
Ruby
fix activestorage update
ead3f67e88af80cdb8d14e095b7ded2965f021c9
<ide><path>activestorage/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb <ide> class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] <ide> def up <add> return unless table_exists?(:active_storage_blobs) <add> <ide> unless column_exists?(:active_storage_blobs, :service_name) <ide> add_column :active_storage_blobs, :service_name, :string <ide> <ide> def up <ide> end <ide> <ide> def down <add> return unless table_exists?(:active_storage_blobs) <add> <ide> remove_column :active_storage_blobs, :service_name <ide> end <ide> end <ide><path>activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb <ide> class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] <ide> def change <add> return unless table_exists?(:active_storage_blobs) <add> <ide> # Use Active Record's configured type for primary key <ide> create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| <ide> t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type <ide><path>activestorage/db/update_migrate/20211119233751_remove_not_null_on_active_storage_blobs_checksum.rb <ide> class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] <ide> def change <add> return unless table_exists?(:active_storage_blobs) <add> <ide> change_column_null(:active_storage_blobs, :checksum, true) <ide> end <ide> end
3
PHP
PHP
support custom `to` address on `mailmessage`
e6063d7df79aa6bbc3829dcc0b3907fe8b49201c
<ide><path>src/Illuminate/Notifications/Channels/MailChannel.php <ide> public function send($notifiable, Notification $notification) <ide> $message = $notification->toMail($notifiable); <ide> <ide> $this->mailer->send($message->view, $message->data(), function ($m) use ($notifiable, $notification, $message) { <del> $recipients = $notifiable->routeNotificationFor('mail'); <add> $recipients = empty($message->to) ? $notifiable->routeNotificationFor('mail') : $message->to; <ide> <ide> if (! empty($message->from)) { <ide> $m->from($message->from[0], isset($message->from[1]) ? $message->from[1] : null); <ide><path>src/Illuminate/Notifications/Messages/MailMessage.php <ide> class MailMessage extends SimpleMessage <ide> */ <ide> public $from = []; <ide> <add> /** <add> * The recipient information for the message. <add> * <add> * @var array <add> */ <add> public $to = []; <add> <ide> /** <ide> * The attachments for the message. <ide> * <ide> public function from($address, $name = null) <ide> return $this; <ide> } <ide> <add> /** <add> * Set the recipient address for the mail message. <add> * <add> * @param string|array $address <add> * @return $this <add> */ <add> public function to($address) <add> { <add> $this->to = $address; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Attach a file to the message. <ide> * <ide><path>tests/Notifications/NotificationMailChannelTest.php <ide> public function testMessageWithFromAddressAndNoName() <ide> <ide> $channel->send($notifiable, $notification); <ide> } <add> <add> public function testMessageWithToAddress() <add> { <add> $notification = new NotificationMailChannelTestNotificationWithToAddress; <add> $notifiable = new NotificationMailChannelTestNotifiable; <add> <add> $message = $notification->toMail($notifiable); <add> $data = $message->toArray(); <add> <add> $channel = new Illuminate\Notifications\Channels\MailChannel( <add> $mailer = Mockery::mock(Illuminate\Contracts\Mail\Mailer::class) <add> ); <add> <add> $views = ['notifications::email', 'notifications::email-plain']; <add> <add> $mailer->shouldReceive('send')->with($views, $data, Mockery::on(function ($closure) { <add> $mock = Mockery::mock('Illuminate\Mailer\Message'); <add> <add> $mock->shouldReceive('subject')->once(); <add> <add> $mock->shouldReceive('to')->once()->with('jeffrey@laracasts.com'); <add> <add> $closure($mock); <add> <add> return true; <add> })); <add> <add> $channel->send($notifiable, $notification); <add> } <ide> } <ide> <ide> class NotificationMailChannelTestNotifiable <ide> public function toMail($notifiable) <ide> ->from('test@mail.com'); <ide> } <ide> } <add> <add>class NotificationMailChannelTestNotificationWithToAddress extends Notification <add>{ <add> public function toMail($notifiable) <add> { <add> return (new MailMessage) <add> ->to('jeffrey@laracasts.com'); <add> } <add>}
3
Text
Text
translate some lines into spanish
cb35fd2d51eaaf59cb3a444edbb6b3a6c968b973
<ide><path>guide/spanish/java/abstract-class/index.md <ide> Considere el siguiente ejemplo para entender las clases abstractas: Usted tiene <ide> <ide> Vehículo público de clase amplía vehículo. { ... } <ide> <del>Clase pública de motocicleta extiende vehículo { ... } <add>Clase pública de motocicleta extiende vehíulo { ... } <ide> ``` <del>You cannot create an object of Vehicle class anywhere in your program. You can however, extend the abstract vehicle class and create objects of the child classes; <add>No puedes crear un objeto de la clase Vehículo en ninguna parte de tu programa. Pero si puedes extener la clase abstracta Vehículo y crear objetos de las clases hijos; <ide> ``` <ide> <ide> Java Vehículo newVehicle = new Vehicle (); // Invalido Vehículo de vehículo = Coche nuevo (); // válido Vehículo mBike = nueva motocicleta (); // válido <ide> <del>Car carObj = nuevo Car (); // válido Motocicleta mBikeObj = nueva motocicleta (); // válido \`\` \` <ide>\ No newline at end of file <add>Car carObj = nuevo Car (); // válido Motocicleta mBikeObj = nueva motocicleta (); // válido \`\` \`
1
Text
Text
add a changelog entry for [ci skip]
3190aab84d4a0a667f6dbc4ff61c706058cb4e5f
<ide><path>activerecord/CHANGELOG.md <del>* Emulate db trigger behaviour for after_commit :destroy, :update <add>* Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted <add> or updated because it would violate a not null constraint. <add> <add> *Ryuta Kamizono* <add> <add>* Emulate db trigger behaviour for after_commit :destroy, :update. <ide> <ide> Race conditions can occur when an ActiveRecord is destroyed <ide> twice or destroyed and updated. The callbacks should only be <ide> triggered once, similar to a SQL database trigger. <ide> <ide> *Stefan Budeanu* <ide> <del>* Moved DecimalWithoutScale, Text, and UnsignedInteger from Active Model to Active Record <add>* Moved `DecimalWithoutScale`, `Text`, and `UnsignedInteger` from Active Model to Active Record. <ide> <ide> *Iain Beeston* <ide> <ide> <ide> *Prathamesh Sonpatki* <ide> <del>* PostgreSQL & MySQL: Use big integer as primary key type for new tables <add>* PostgreSQL & MySQL: Use big integer as primary key type for new tables. <ide> <ide> *Jon McCartie*, *Pavel Pravosud* <ide> <ide> <ide> *Sergey Alekseev* <ide> <del>* Raise ActiveRecord::RecordNotFound from collection `*_ids` setters <add>* Raise `ActiveRecord::RecordNotFound` from collection `*_ids` setters <ide> for unknown IDs with a better error message. <ide> <ide> Changes the collection `*_ids` setters to cast provided IDs the data <ide> <ide> * Fixed: Optimistic locking does not work well with `null` in the database. <ide> <del> Fixes #26024 <add> Fixes #26024. <ide> <ide> *bogdanvlviv* <ide> <ide> <ide> *Edho Arief* <ide> <del>* Serialize JSON attribute value `nil` as SQL `NULL`, not JSON `null` <add>* Serialize JSON attribute value `nil` as SQL `NULL`, not JSON `null`. <ide> <ide> *Trung Duc Tran* <ide> <ide> successfully rolled back when the column was given and invalid column <ide> type. <ide> <del> Fixes #26087 <add> Fixes #26087. <ide> <ide> *Travis O'Neill* <ide> <ide> *Takeshi Akima* <ide> <ide> * Virtual attributes will no longer raise when read on models loaded from the <del> database <add> database. <ide> <ide> *Sean Griffin* <ide>
1
PHP
PHP
fix entity names for associated model date fields
85b86cb282d2a95964f127864068dbfc67b271b5
<ide><path>lib/Cake/Test/Case/View/HelperTest.php <ide> public function testSetEntityScoped() { <ide> $expected = array('HelperTestComment', 'id', 'time'); <ide> $this->assertEquals($expected, $this->Helper->entity()); <ide> <add> $this->Helper->setEntity('HelperTestComment.created.year'); <add> $expected = array('HelperTestComment', 'created', 'year'); <add> $this->assertEquals($expected, $this->Helper->entity()); <add> <ide> $this->Helper->setEntity(null); <ide> $this->Helper->setEntity('ModelThatDoesntExist.field_that_doesnt_exist'); <ide> $expected = array('ModelThatDoesntExist', 'field_that_doesnt_exist'); <ide><path>lib/Cake/View/Helper.php <ide> public function setEntity($entity, $setScope = false) { <ide> <ide> // Either 'body' or 'date.month' type inputs. <ide> if ( <del> ($count === 1 && <del> $this->_modelScope && <del> $setScope == false) || <del> (in_array($lastPart, $this->_fieldSuffixes) && <del> $this->_modelScope && <del> $parts[0] !== $this->_modelScope) <add> ($count === 1 && $this->_modelScope && $setScope == false) || <add> ( <add> $count === 2 && <add> in_array($lastPart, $this->_fieldSuffixes) && <add> $this->_modelScope && <add> $parts[0] !== $this->_modelScope <add> ) <ide> ) { <ide> $entity = $this->_modelScope . '.' . $entity; <ide> } <ide> <del> // 0.name style inputs. <add> // 0.name, 0.created.month style inputs. <ide> if ( <del> $count === 2 && <del> is_numeric($parts[0]) && <del> !is_numeric($parts[1]) <add> $count >= 2 && is_numeric($parts[0]) && !is_numeric($parts[1]) && $this->_modelScope <ide> ) { <ide> $entity = $this->_modelScope . '.' . $entity; <ide> }
2
Text
Text
remove text and add comma
bf90943f78ddb5e634a2d45c4e981cfbe8c3d867
<ide><path>guide/english/accessibility/accessibility-basics/index.md <ide> If you fall outside these rather broad categories, please let me know. I always <ide> <ide> Accessibility in itself is a bit of a misleading term sometimes, especially if English is your second language. It is sometimes referred to as "inclusive design." <ide> <del>If your site is on the Internet, reachable by anyone with a web browser, in one sense that website is accessible to everyone with a web browser. <add>If your site is on the Internet, reachable by anyone with a web browser, that website is accessible to everyone with a web browser. <ide> <del>But, is all content on your website actually readable, usable and understandable for everyone? Are there no thresholds that bar certain people from "accessing" all the information you are exposing? <add>But, is all content on your website actually readable, usable, and understandable for everyone? Are there no thresholds that bar certain people from "accessing" all the information you are exposing? <ide> <ide> You could ask yourself questions like the following: <ide>
1
Python
Python
set default connection for ssh
3c624ea44fad192b6db818313011857160d77951
<ide><path>airflow/utils.py <ide> def initdb(): <ide> models.Connection( <ide> conn_id='webhdfs_default', conn_type='hdfs', <ide> host='localhost', port=50070)) <add> merge_conn( <add> models.Connection( <add> conn_id='ssh_default', conn_type='ssh', <add> host='localhost')) <ide> <ide> # Known event types <ide> KET = models.KnownEventType
1
Python
Python
update docstrings of modules with missing params
71c673e427a89cae2a9f3174c32c5c85556d6342
<ide><path>airflow/providers/amazon/aws/hooks/redshift.py <ide> class RedshiftHook(AwsBaseHook): <ide> <ide> .. seealso:: <ide> :class:`~airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook` <add> <add> :param aws_conn_id: The Airflow connection used for AWS credentials. <add> :type aws_conn_id: str <ide> """ <ide> <ide> def __init__(self, *args, **kwargs) -> None: <ide> def cluster_status(self, cluster_identifier: str) -> str: <ide> <ide> :param cluster_identifier: unique identifier of a cluster <ide> :type cluster_identifier: str <add> :param skip_final_cluster_snapshot: determines cluster snapshot creation <add> :type skip_final_cluster_snapshot: bool <add> :param final_cluster_snapshot_identifier: Optional[str] <add> :type final_cluster_snapshot_identifier: Optional[str] <ide> """ <ide> try: <ide> response = self.get_conn().describe_clusters(ClusterIdentifier=cluster_identifier)['Clusters'] <ide><path>airflow/providers/apache/hdfs/sensors/hdfs.py <ide> class HdfsSensor(BaseSensorOperator): <ide> """ <ide> Waits for a file or folder to land in HDFS <ide> <add> :param filepath: The route to a stored file. <add> :type filepath: str <add> :param hdfs_conn_id: The Airflow connection used for HDFS credentials. <add> :type hdfs_conn_id: str <add> :param ignored_ext: This is the list of ignored extensions. <add> :type ignored_ext: Optional[List[str]] <add> :param ignore_copying: Shall we ignore? <add> :type ignore_copying: Optional[bool] <add> :param file_size: This is the size of the file. <add> :type file_size: Optional[int] <add> <ide> .. seealso:: <ide> For more information on how to use this operator, take a look at the guide: <ide> :ref:`howto/operator:HdfsSensor` <ide><path>airflow/providers/elasticsearch/hooks/elasticsearch.py <ide> <ide> <ide> class ElasticsearchHook(DbApiHook): <del> """Interact with Elasticsearch through the elasticsearch-dbapi.""" <add> """ <add> Interact with Elasticsearch through the elasticsearch-dbapi. <add> <add> This hook uses the Elasticsearch conn_id. <add> <add> :param elasticsearch_conn_id: The Airflow connection used for Elasticsearch credentials. <add> :type elasticsearch_conn_id: str <add> """ <ide> <ide> conn_name_attr = 'elasticsearch_conn_id' <ide> default_conn_name = 'elasticsearch_default' <ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> <ide> # pylint: disable=too-many-public-methods <ide> class BigQueryHook(GoogleBaseHook, DbApiHook): <del> """Interact with BigQuery. This hook uses the Google Cloud connection.""" <add> """ <add> Interact with BigQuery. This hook uses the Google Cloud connection. <add> <add> :param gcp_conn_id: The Airflow connection used for GCP credentials. <add> :type gcp_conn_id: Optional[str] <add> :param delegate_to: This performs a task on one host with reference to other hosts. <add> :type delegate_to: Optional[str] <add> :param use_legacy_sql: This specifies whether to use legacy SQL dialect. <add> :type use_legacy_sql: bool <add> :param location: The location of the BigQuery resource. <add> :type location: Optional[str] <add> :param bigquery_conn_id: The Airflow connection used for BigQuery credentials. <add> :type bigquery_conn_id: Optional[str] <add> :param api_resource_configs: This contains params configuration applied for Google BigQuery jobs. <add> :type api_resource_configs: Optional[Dict] <add> :param impersonation_chain: This is the optional service account to impersonate using short term <add> credentials. <add> :type impersonation_chain: Optional[Union[str, Sequence[str]]] <add> :param labels: The BigQuery resource label. <add> :type labels: Optional[Dict] <add> """ <ide> <ide> conn_name_attr = 'gcp_conn_id' <ide> default_conn_name = 'google_cloud_default' <ide><path>airflow/providers/google/cloud/hooks/cloud_sql.py <ide> class CloudSQLHook(GoogleBaseHook): <ide> <ide> All the methods in the hook where project_id is used must be called with <ide> keyword arguments rather than positional. <add> <add> :param api_version: This is the version of the api. <add> :type api_version: str <add> :param gcp_conn_id: The Airflow connection used for GCP credentials. <add> :type gcp_conn_id: str <add> :param delegate_to: This performs a task on one host with reference to other hosts. <add> :type delegate_to: Optional[str] <add> :param impersonation_chain: This is the optional service account to impersonate using short term <add> credentials. <add> :type impersonation_chain: Optional[str] <ide> """ <ide> <ide> conn_name_attr = 'gcp_conn_id' <ide><path>airflow/providers/mongo/hooks/mongo.py <ide> <ide> class MongoHook(BaseHook): <ide> """ <add> Interact with Mongo. This hook uses the Mongo conn_id. <ide> PyMongo Wrapper to Interact With Mongo Database <ide> Mongo Connection Documentation <ide> https://docs.mongodb.com/manual/reference/connection-string/index.html <ide> class MongoHook(BaseHook): <ide> <ide> ex. <ide> {"srv": true, "replicaSet": "test", "ssl": true, "connectTimeoutMS": 30000} <add> <add> :param conn_id: This is the Airflow connection to use for Mongo credentials. <add> :type conn_id: str <ide> """ <ide> <ide> conn_name_attr = 'conn_id' <ide><path>airflow/providers/mysql/hooks/mysql.py <ide> class MySqlHook(DbApiHook): <ide> "aws_default" connection to get the temporary token unless you override <ide> in extras. <ide> extras example: ``{"iam":true, "aws_conn_id":"my_aws_conn"}`` <add> <add> :param schema: The MySQL database schema to connect to. <add> :type schema: Optional[str] <add> :param connection: The Airflow connection used for MySQL credentials. <add> :type connection: Optional[Dict] <ide> """ <ide> <ide> conn_name_attr = 'mysql_conn_id' <ide><path>airflow/providers/oracle/hooks/oracle.py <ide> <ide> <ide> class OracleHook(DbApiHook): <del> """Interact with Oracle SQL.""" <add> """ <add> Interact with Oracle SQL. <add> <add> :param oracle_conn_id: The Airflow connection used for Oracle credentials. <add> :type oracle_conn_id: str <add> """ <ide> <ide> conn_name_attr = 'oracle_conn_id' <ide> default_conn_name = 'oracle_default' <ide> def get_conn(self) -> 'OracleHook': <ide> as in ``{ "dsn":"some.host.address" , "service_name":"some.service.name" }`` <ide> see more param detail in <ide> `cx_Oracle.connect <https://cx-oracle.readthedocs.io/en/latest/module.html#cx_Oracle.connect>`_ <add> <add> <ide> """ <ide> conn = self.get_connection( <ide> self.oracle_conn_id # type: ignore[attr-defined] # pylint: disable=no-member <ide><path>airflow/providers/zendesk/hooks/zendesk.py <ide> <ide> <ide> class ZendeskHook(BaseHook): <del> """A hook to talk to Zendesk""" <add> """ <add> Interact with Zendesk. This hook uses the Zendesk conn_id. <add> <add> :param zendesk_conn_id: The Airflow connection used for Zendesk credentials. <add> :type zendesk_conn_id: str <add> """ <ide> <ide> def __init__(self, zendesk_conn_id: str) -> None: <ide> super().__init__()
9
Javascript
Javascript
fix precompilation test in ie
041cb831cf3ed938ae765ab3b3a6484d25f0d26e
<ide><path>packages/ember-handlebars/tests/handlebars_test.js <ide> test("should be able to use unbound helper in #each helper (with objects)", func <ide> <ide> test("should work with precompiled templates", function() { <ide> var templateString = Ember.Handlebars.precompile("{{view.value}}"), <del> compiledTemplate = Ember.Handlebars.template(eval('('+templateString+')')); <add> compiledTemplate = Ember.Handlebars.template(eval(templateString)); <ide> view = Ember.View.create({ <ide> value: "rendered", <ide> template: compiledTemplate
1
Python
Python
fix failing test
fdef440289fbf381a0c97cf9b697ae2ca9780d82
<ide><path>libcloud/test/compute/test_ec2.py <ide> def test_regions_and_signature_versions(self): <ide> self.assertEqual(driver.signature_version, "4") <ide> <ide> driver = EC2NodeDriver(*EC2_PARAMS, region="af-south-1") <del> self.assertEqual(driver.signature_version, "2") <add> self.assertEqual(driver.signature_version, "4") <ide> <ide> driver = EC2NodeDriver(*EC2_PARAMS, region="af-south-1", signature_version="4") <ide> self.assertEqual(driver.signature_version, "4")
1
Ruby
Ruby
add #schema_names to postgresql adapter
577971f05a838da3ba74ba49d776a83f6bfe1aee
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb <ide> def encoding <ide> end_sql <ide> end <ide> <add> # Returns an array of schema names. <add> def schema_names <add> query(<<-SQL).flatten <add> SELECT nspname <add> FROM pg_namespace <add> WHERE nspname !~ '^pg_.*' <add> AND nspname NOT IN ('information_schema') <add> ORDER by nspname; <add> SQL <add> end <add> <ide> # Sets the schema search path to a string of comma-separated schema names. <ide> # Names beginning with $ have to be quoted (e.g. $user => '$user'). <ide> # See: http://www.postgresql.org/docs/current/static/ddl-schemas.html <ide><path>activerecord/test/cases/adapters/postgresql/schema_test.rb <ide> def teardown <ide> @connection.execute "DROP SCHEMA #{SCHEMA_NAME} CASCADE" <ide> end <ide> <add> def test_schema_names <add> assert_equal ["public", "test_schema", "test_schema2"], @connection.schema_names <add> end <add> <ide> def test_schema_change_with_prepared_stmt <ide> altered = false <ide> @connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
2
Text
Text
fix typo in readme.md
cab6341545a57b1aa36cb70f6263f9547d906cda
<ide><path>readme.md <ide> Supported options: <ide> Then, change your `start` script to `NODE_ENV=production node server.js`. <ide> <ide> #### Disabling file-system routing <del>By default, `Next` will serve eacy file in `/pages` under a pathname matching the filename (eg, `/pages/some-file.js` is served at `site.com/some-file`. <add>By default, `Next` will serve each file in `/pages` under a pathname matching the filename (eg, `/pages/some-file.js` is served at `site.com/some-file`. <ide> <ide> If your project uses custom routing, this behavior may result in the same content being served from multiple paths, which can present problems with SEO and UX. <ide>
1
PHP
PHP
remove incorrect constant
79564fb7d41bec933cdeb947b44a9eb7b1f4b42f
<ide><path>lib/Cake/Console/cake.php <ide> /** <ide> * Command-line code generation utility to automate programmer chores. <ide> * <del> * Shell dispatcher class <del> * <ide> * PHP 5 <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> <ide> if (!$found && function_exists('ini_set')) { <ide> $root = dirname(dirname(dirname(__FILE__))); <del> ini_set('include_path', __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path')); <add> ini_set('include_path', $root . $ds . PATH_SEPARATOR . ini_get('include_path')); <ide> } <ide> <ide> if (!include($dispatcher)) {
1
PHP
PHP
add links property to json pagination responses
13751a187834fabe515c14fb3ac1dc008fd23f37
<ide><path>src/Illuminate/Pagination/LengthAwarePaginator.php <ide> public function render($view = null, $data = []) <ide> ])); <ide> } <ide> <add> /** <add> * Get the paginator links as a collection (for JSON responses). <add> * <add> * @return \Illuminate\Support\Collection <add> */ <add> protected function linkCollection() <add> { <add> return collect($this->elements())->flatMap(function ($item) { <add> if (! is_array($item)) { <add> return [['url' => null, 'label' => '...', 'active' => false]]; <add> } <add> <add> return collect($item)->map(function ($url, $page) { <add> return [ <add> 'url' => $url, <add> 'label' => $page, <add> 'active' => $this->currentPage() === $page, <add> ]; <add> }); <add> })->prepend([ <add> 'url' => $this->previousPageUrl(), <add> 'label' => 'Previous', <add> 'active' => false, <add> ])->push([ <add> 'url' => $this->nextPageUrl(), <add> 'label' => 'Next', <add> 'active' => false, <add> ]); <add> } <add> <ide> /** <ide> * Get the array of elements to pass to the view. <ide> * <ide> public function toArray() <ide> 'from' => $this->firstItem(), <ide> 'last_page' => $this->lastPage(), <ide> 'last_page_url' => $this->url($this->lastPage()), <add> 'links' => $this->linkCollection(), <ide> 'next_page_url' => $this->nextPageUrl(), <ide> 'path' => $this->path(), <ide> 'per_page' => $this->perPage(),
1
Ruby
Ruby
allow brew log on deleted formulae
46d2b2165ab1f559e52d4b24cb86d96505a7f4f4
<ide><path>Library/Homebrew/cmd/log.rb <ide> def log <ide> cd HOMEBREW_REPOSITORY <ide> exec "git", "log", *ARGV.options_only <ide> else <del> path = ARGV.formulae.first.path.realpath <add> begin <add> path = ARGV.formulae.first.path.realpath <add> rescue FormulaUnavailableError <add> # Maybe the formula was deleted <add> path = HOMEBREW_REPOSITORY/"Library/Formula/#{ARGV.named.first}.rb" <add> end <ide> cd path.dirname # supports taps <del> exec "git", "log", *ARGV.options_only + [path] <add> exec "git", "log", *ARGV.options_only + ["--", path] <ide> end <ide> end <ide> end
1
Javascript
Javascript
add jscs task to test task
2a4f92ee99179513efba98d564a8795917c77ddf
<ide><path>Gruntfile.js <ide> module.exports = function(grunt) { <ide> <ide> <ide> //alias tasks <del> grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']); <add> grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'jscs', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']); <ide> grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']); <ide> grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']); <ide> grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
1
Javascript
Javascript
namespace observable methods
1dcdf4e17c89edf0bf2961f1504deb245d6ccd06
<ide><path>server/boot/authentication.js <ide> module.exports = function enableAuthentication(app) { <ide> } <ide> ); <ide> } <del> return authToken.validate() <add> return authToken.validate$() <ide> .map(isValid => { <ide> if (!isValid) { <ide> throw wrapHandledError( <ide> module.exports = function enableAuthentication(app) { <ide> } <ide> ); <ide> } <del> return authToken.destroy(); <add> return authToken.destroy$(); <ide> }) <ide> .map(() => user); <ide> }); <ide><path>server/models/auth-token.js <ide> export default function(AuthToken) { <ide> AuthToken.findOne$ = Observable.fromNodeCallback( <ide> AuthToken.findOne.bind(AuthToken) <ide> ); <del> AuthToken.prototype.validate = Observable.fromNodeCallback( <add> AuthToken.prototype.validate$ = Observable.fromNodeCallback( <ide> AuthToken.prototype.validate <ide> ); <del> AuthToken.prototype.destroy = Observable.fromNodeCallback( <add> AuthToken.prototype.destroy$ = Observable.fromNodeCallback( <ide> AuthToken.prototype.destroy <ide> ); <ide> });
2
Javascript
Javascript
use push() for transform._output()
b43e544140ccf68580c02e71c56d19b82e1e1d32
<ide><path>lib/_stream_transform.js <ide> function TransformState(stream) { <ide> this.transforming = false; <ide> this.pendingReadCb = null; <ide> this.output = function(chunk) { <del> stream._output(chunk); <add> stream.push(chunk); <ide> }; <ide> } <ide> <ide> Transform.prototype._read = function(n, readcb) { <ide> var rs = this._readableState; <ide> var ts = this._transformState; <ide> <del> if (ts.pendingReadCb) <del> throw new Error('_read while _read already in progress'); <del> <ide> ts.pendingReadCb = readcb; <ide> <ide> // if there's nothing pending, then we just wait. <ide> Transform.prototype._read = function(n, readcb) { <ide> }); <ide> }; <ide> <del>Transform.prototype._output = function(chunk) { <del> if (!chunk || !chunk.length) <del> return; <del> <del> // if we've got a pending readcb, then just call that, <del> // and let Readable take care of it. If not, then we fill <del> // the readable buffer ourselves, and emit whatever's needed. <del> var ts = this._transformState; <del> var readcb = ts.pendingReadCb; <del> if (readcb) { <del> ts.pendingReadCb = null; <del> readcb(null, chunk); <del> return; <del> } <del> <del> // otherwise, it's up to us to fill the rs buffer. <del> var rs = this._readableState; <del> var len = rs.length; <del> rs.buffer.push(chunk); <del> rs.length += chunk.length; <del> if (rs.needReadable) { <del> rs.needReadable = false; <del> this.emit('readable'); <del> } <del>}; <ide> <ide> function done(stream, er) { <ide> if (er) <ide> function done(stream, er) { <ide> if (ts.transforming) <ide> throw new Error('calling transform done when still transforming'); <ide> <del> // if we were waiting on a read, let them know that it isn't coming. <del> var readcb = ts.pendingReadCb; <del> if (readcb) <del> return readcb(); <del> <del> rs.ended = true; <del> // we may have gotten a 'null' read before, and since there is <del> // no more data coming from the writable side, we need to emit <del> // now so that the consumer knows to pick up the tail bits. <del> if (rs.length && rs.needReadable) <del> stream.emit('readable'); <del> else if (rs.length === 0) <del> stream.emit('end'); <add> return stream.push(null); <ide> } <ide><path>test/simple/test-stream2-transform.js <ide> test('passthrough event emission', function(t) { <ide> var i = 0; <ide> <ide> pt.write(new Buffer('foog')); <add> <add> console.error('need emit 0'); <ide> pt.write(new Buffer('bark')); <ide> <add> console.error('should have emitted readable now 1 === %d', emits); <add> t.equal(emits, 1); <add> <ide> t.equal(pt.read(5).toString(), 'foogb'); <ide> t.equal(pt.read(5) + '', 'null'); <ide> <del> console.error('need emit 0'); <add> console.error('need emit 1'); <ide> <ide> pt.write(new Buffer('bazy')); <ide> console.error('should have emitted, but not again'); <ide> pt.write(new Buffer('kuel')); <ide> <del> console.error('should have emitted readable now 1 === %d', emits); <del> t.equal(emits, 1); <add> console.error('should have emitted readable now 2 === %d', emits); <add> t.equal(emits, 2); <ide> <ide> t.equal(pt.read(5).toString(), 'arkba'); <ide> t.equal(pt.read(5).toString(), 'zykue'); <ide> t.equal(pt.read(5), null); <ide> <del> console.error('need emit 1'); <add> console.error('need emit 2'); <ide> <ide> pt.end(); <ide> <del> t.equal(emits, 2); <add> t.equal(emits, 3); <ide> <ide> t.equal(pt.read(5).toString(), 'l'); <ide> t.equal(pt.read(5), null); <ide> <ide> console.error('should not have emitted again'); <del> t.equal(emits, 2); <add> t.equal(emits, 3); <ide> t.end(); <ide> }); <ide> <ide> test('passthrough event emission reordered', function(t) { <ide> }); <ide> <ide> pt.write(new Buffer('foog')); <add> console.error('need emit 0'); <ide> pt.write(new Buffer('bark')); <add> console.error('should have emitted readable now 1 === %d', emits); <add> t.equal(emits, 1); <ide> <ide> t.equal(pt.read(5).toString(), 'foogb'); <ide> t.equal(pt.read(5), null); <ide> <del> console.error('need emit 0'); <add> console.error('need emit 1'); <ide> pt.once('readable', function() { <ide> t.equal(pt.read(5).toString(), 'arkba'); <ide> <ide> t.equal(pt.read(5), null); <ide> <del> console.error('need emit 1'); <add> console.error('need emit 2'); <ide> pt.once('readable', function() { <ide> t.equal(pt.read(5).toString(), 'zykue'); <ide> t.equal(pt.read(5), null); <ide> pt.once('readable', function() { <ide> t.equal(pt.read(5).toString(), 'l'); <ide> t.equal(pt.read(5), null); <del> t.equal(emits, 3); <add> t.equal(emits, 4); <ide> t.end(); <ide> }); <ide> pt.end();
2
Python
Python
update portuguese language
6c498f9ff47f9df685d6dab25b36d464e52ea37b
<ide><path>spacy/lang/pt/__init__.py <ide> from .lex_attrs import LEX_ATTRS <ide> from .lemmatizer import LOOKUP <ide> from .tag_map import TAG_MAP <add>from .norm_exceptions import NORM_EXCEPTIONS <ide> <ide> from ..tokenizer_exceptions import BASE_EXCEPTIONS <add>from .punctuation import TOKENIZER_INFIXES, TOKENIZER_PREFIXES <ide> from ..norm_exceptions import BASE_NORMS <ide> from ...language import Language <ide> from ...attrs import LANG, NORM <ide> class PortugueseDefaults(Language.Defaults): <ide> lex_attr_getters = dict(Language.Defaults.lex_attr_getters) <ide> lex_attr_getters[LANG] = lambda text: 'pt' <del> lex_attr_getters[NORM] = add_lookups(Language.Defaults.lex_attr_getters[NORM], BASE_NORMS) <add> lex_attr_getters[NORM] = add_lookups(Language.Defaults.lex_attr_getters[NORM], BASE_NORMS, NORM_EXCEPTIONS) <ide> lex_attr_getters.update(LEX_ATTRS) <ide> tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) <ide> stop_words = STOP_WORDS <ide> lemma_lookup = LOOKUP <ide> tag_map = TAG_MAP <del> <add> infixes = TOKENIZER_INFIXES <add> prefixes = TOKENIZER_PREFIXES <ide> <ide> class Portuguese(Language): <ide> lang = 'pt' <ide><path>spacy/lang/pt/lex_attrs.py <ide> <ide> <ide> def like_num(text): <del> text = text.replace(',', '').replace('.', '') <add> text = text.replace(',', '').replace('.', '').replace('º','').replace('ª','') <ide> if text.isdigit(): <ide> return True <ide> if text.count('/') == 1: <ide><path>spacy/lang/pt/norm_exceptions.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add># These exceptions are used to add NORM values based on a token's ORTH value. <add># Individual languages can also add their own exceptions and overwrite them - <add># for example, British vs. American spelling in English. <add> <add># Norms are only set if no alternative is provided in the tokenizer exceptions. <add># Note that this does not change any other token attributes. Its main purpose <add># is to normalise the word representations so that equivalent tokens receive <add># similar representations. For example: $ and € are very different, but they're <add># both currency symbols. By normalising currency symbols to $, all symbols are <add># seen as similar, no matter how common they are in the training data. <add> <add> <add>NORM_EXCEPTIONS = { <add> "R$": "$", # Real <add> "r$": "$", # Real <add> "Cz$": "$", # Cruzado <add> "cz$": "$", # Cruzado <add> "NCz$": "$", # Cruzado Novo <add> "ncz$": "$" # Cruzado Novo <add>} <ide><path>spacy/lang/pt/punctuation.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>from ..punctuation import TOKENIZER_PREFIXES as BASE_TOKENIZER_PREFIXES <add>from ..punctuation import TOKENIZER_SUFFIXES as BASE_TOKENIZER_SUFFIXES <add>from ..punctuation import TOKENIZER_INFIXES as BASE_TOKENIZER_INFIXES <add> <add>_prefixes = ([r'\w{1,3}\$'] + BASE_TOKENIZER_PREFIXES) <add> <add>_suffixes = (BASE_TOKENIZER_SUFFIXES) <add> <add>_infixes = ([r'(\w+-\w+(-\w+)*)'] + <add> BASE_TOKENIZER_INFIXES <add> ) <add> <add>TOKENIZER_PREFIXES = _prefixes <add>TOKENIZER_SUFFIXES = _suffixes <add>TOKENIZER_INFIXES = _infixes <ide><path>spacy/lang/pt/stop_words.py <ide> <ide> <ide> STOP_WORDS = set(""" <del>à às acerca adeus agora ainda algo algumas alguns ali além ambas ambos ano <del>anos antes ao aos apenas apoio apoia apontar após aquela aquelas aquele aqueles <del>aqui aquilo área as assim através atrás até aí <add>à às área acerca ademais adeus agora ainda algo algumas alguns ali além ambas ambos antes <add>ao aos apenas apoia apoio apontar após aquela aquelas aquele aqueles aqui aquilo <add>as assim através atrás até aí <ide> <ide> baixo bastante bem boa bom breve <ide> <ide> cada caminho catorze cedo cento certamente certeza cima cinco coisa com como <del>comprido comprida conhecida conhecido conselho contra corrente custa cá <add>comprida comprido conhecida conhecido conselho contra contudo corrente cuja <add>cujo custa cá <ide> <del>da daquela daquele dar das de debaixo demais dentro depois desde desligada <del>desligado dessa desse desta deste deve devem deverá dez dezanove dezasseis <del>dezassete dezoito dia diante direita diz dizem dizer do dois dos doze duas dá <del>dão dúvida <add>da daquela daquele dar das de debaixo demais dentro depois des desde dessa desse <add>desta deste deve devem deverá dez dezanove dezasseis dezassete dezoito diante <add>direita disso diz dizem dizer do dois dos doze duas dá dão <ide> <del>é ela elas ele eles em embora enquanto entre então era és essa essas esse esses <del>esta estado estar estará estas estava este estes esteve estive estivemos <del>estiveram estiveste estivestes estou está estás estão eu exemplo <add>é és ela elas ele eles em embora enquanto entre então era essa essas esse esses esta <add>estado estar estará estas estava este estes esteve estive estivemos estiveram <add>estiveste estivestes estou está estás estão eu eventual exemplo <ide> <ide> falta fará favor faz fazeis fazem fazemos fazer fazes fazia faço fez fim final <ide> foi fomos for fora foram forma foste fostes fui <ide> <ide> geral grande grandes grupo <ide> <del>hoje horas há <add>inclusive iniciar inicio ir irá isso isto <ide> <del>iniciar inicio ir irá isso isto já <add>já <ide> <del>lado ligado local logo longe lugar lá <add>lado lhe ligado local logo longe lugar lá <ide> <del>maior maioria maiorias mais mal mas me meio menor menos meses mesmo meu meus <del>mil minha minhas momento muito muitos máximo mês <add>maior maioria maiorias mais mal mas me meio menor menos meses mesmo meu meus mil <add>minha minhas momento muito muitos máximo mês <ide> <del>na nada naquela naquele nas nem nenhuma nessa nesse nesta neste no noite nome <del>nos nossa nossas nosso nossos nova novas nove novo novos num numa nunca nuns <del>não nível nós número números <add>na nada naquela naquele nas nem nenhuma nessa nesse nesta neste no nos nossa <add>nossas nosso nossos nova novas nove novo novos num numa nunca nuns não nível nós <add>número números <ide> <del>obra obrigada obrigado oitava oitavo oito onde ontem onze os ou outra outras <del>outro outros <add>obrigada obrigado oitava oitavo oito onde ontem onze ora os ou outra outras outros <ide> <del>para parece parte partir pegar pela pelas pelo pelos perto pessoas pode podem <del>poder poderá podia ponto pontos por porque porquê posição possivelmente posso <del>possível pouca pouco povo primeira primeiro próprio próxima próximo puderam pôde <del>põe põem <add>para parece parte partir pegar pela pelas pelo pelos perto pode podem poder poderá <add>podia pois ponto pontos por porquanto porque porquê portanto porém posição <add>possivelmente posso possível pouca pouco povo primeira primeiro próprio próxima <add>próximo puderam pôde põe põem <ide> <del>qual qualquer quando quanto quarta quarto quatro que quem quer querem quero <add>quais qual qualquer quando quanto quarta quarto quatro que quem quer querem quero <ide> questão quieta quieto quinta quinto quinze quê <ide> <ide> relação <ide> <ide> sabe saber se segunda segundo sei seis sem sempre ser seria sete seu seus sexta <del>sexto sim sistema sob sobre sois somente somos sou sua suas são sétima sétimo <add>sexto sim sistema sob sobre sois somente somos sou sua suas são sétima sétimo só <ide> <del>tal talvez também tanta tanto tarde te tem temos tempo tendes tenho tens tentar <del>tentaram tente tentei ter terceira terceiro teu teus teve tipo tive tivemos <del>tiveram tiveste tivestes toda todas todo todos trabalhar trabalho treze três tu <del>tua tuas tudo tão têm <add>tais tal talvez também tanta tanto tarde te tem temos tempo tendes tenho tens <add>tentar tentaram tente tentei ter terceira terceiro teu teus teve tipo tive <add>tivemos tiveram tiveste tivestes toda todas todo todos treze três tu tua tuas <add>tudo tão têm <ide> <del>último um uma umas uns usa usar <add>um uma umas uns usa usar último <ide> <del>vai vais valor veja vem vens ver verdade verdadeira verdadeiro vez vezes viagem <del>vinda vindo vinte você vocês vos vossa vossas vosso vossos vários vão vêm vós <add>vai vais valor veja vem vens ver vez vezes vinda vindo vinte você vocês vos vossa <add>vossas vosso vossos vários vão vêm vós <ide> <ide> zero <ide> """.split()) <ide><path>spacy/lang/pt/tokenizer_exceptions.py <ide> for orth in [ <ide> "Adm.", "Dr.", "e.g.", "E.g.", "E.G.", "Gen.", "Gov.", "i.e.", "I.e.", <ide> "I.E.", "Jr.", "Ltd.", "p.m.", "Ph.D.", "Rep.", "Rev.", "Sen.", "Sr.", <del> "Sra.", "vs."]: <add> "Sra.", "vs.", "tel.", "pág.", "pag."]: <ide> _exc[orth] = [{ORTH: orth}] <ide> <ide>
6
PHP
PHP
add tests for datetype
f18a11e8b90711c40c121a8eed62333167ab01c8
<ide><path>lib/Cake/Model/Datasource/Database/Type.php <ide> class Type { <ide> * @var array <ide> */ <ide> protected static $_types = [ <del> 'boolean' => '\Cake\Model\Datasource\Database\Type\BooleanType', <del> 'binary' => '\Cake\Model\Datasource\Database\Type\BinaryType', <del> 'date' => '\Cake\Model\Datasource\Database\Type\DateType', <del> 'datetime' => '\Cake\Model\Datasource\Database\Type\DateTimeType', <del> 'time' => '\Cake\Model\Datasource\Database\Type\TimeType' <add> 'boolean' => 'Cake\Model\Datasource\Database\Type\BooleanType', <add> 'binary' => 'Cake\Model\Datasource\Database\Type\BinaryType', <add> 'date' => 'Cake\Model\Datasource\Database\Type\DateType', <add> 'datetime' => 'Cake\Model\Datasource\Database\Type\DateTimeType', <add> 'time' => 'Cake\Model\Datasource\Database\Type\TimeType' <ide> ]; <ide> <ide> /** <ide> public function __construct($name = null) { <ide> * @return Type <ide> */ <ide> public static function build($name) { <del> if (isset(self::$_builtTypes[$name])) { <del> return self::$_builtTypes[$name]; <add> if (isset(static::$_builtTypes[$name])) { <add> return static::$_builtTypes[$name]; <ide> } <del> if (isset(self::$_basicTypes[$name])) { <del> return self::$_builtTypes[$name] = new self($name); <add> if (isset(static::$_basicTypes[$name])) { <add> return static::$_builtTypes[$name] = new static($name); <ide> } <del> if (!isset(self::$_types[$name])) { <del> throw new \InvalidArgumentException('No such type'); <add> if (!isset(static::$_types[$name])) { <add> throw new \InvalidArgumentException(__d('cake_dev', 'Unknown type "%s"', $name)); <ide> } <del> return self::$_builtTypes[$name] = new self::$_types[$name]($name); <add> return static::$_builtTypes[$name] = new static::$_types[$name]($name); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Model/Datasource/Database/Type/DateType.php <ide> namespace Cake\Model\Datasource\Database\Type; <ide> <ide> use Cake\Model\Datasource\Database\Driver; <del> <ide> use \DateTime; <ide> <ide> class DateType extends \Cake\Model\Datasource\Database\Type { <ide> <add>/** <add> * Convert DateTime instance into strings. <add> * <add> * @param string|Datetime $value The value to convert. <add> * @param Driver $driver The driver instance to convert with. <add> * @return string <add> */ <ide> public function toDatabase($value, Driver $driver) { <ide> if (is_string($value)) { <ide> return $value; <ide> } <ide> return $value->format('Y-m-d'); <ide> } <ide> <add>/** <add> * Convert strings into DateTime instances. <add> * <add> * @param string $value The value to convert. <add> * @param Driver $driver The driver instance to convert with. <add> * @return Datetime <add> */ <ide> public function toPHP($value, Driver $driver) { <ide> if ($value === null) { <ide> return null; <ide> } <del> $value = DateTime::createFromFormat('Y-m-d', $value); <del> return $value; <add> return DateTime::createFromFormat('Y-m-d', $value); <ide> } <ide> <ide> } <ide><path>lib/Cake/Test/TestCase/Model/Datasource/Database/Type/DateTypeTest.php <add><?php <add>/** <add> * PHP Version 5.4 <add> * <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @package Cake.Model <add> * @since CakePHP(tm) v 3.0.0 <add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <add> */ <add>namespace Cake\Test\TestCase\Model\Datasource\Database\Type; <add> <add>use Cake\Model\Datasource\Database\Type; <add>use Cake\Model\Datasource\Database\Type\DateType; <add>use Cake\TestSuite\TestCase; <add> <add>/** <add> * Test for the Date type. <add> */ <add>class DateTypeTest extends TestCase { <add> <add>/** <add> * Setup <add> * <add> * @return void <add> */ <add> public function setUp() { <add> parent::setUp(); <add> $this->type = Type::build('date'); <add> $this->driver = $this->getMock('Cake\Model\Datasource\Database\Driver'); <add> } <add> <add>/** <add> * Test toPHP <add> * <add> * @return void <add> */ <add> public function testToPHP() { <add> $this->assertNull($this->type->toPHP(null, $this->driver)); <add> <add> $result = $this->type->toPHP('2001-01-04', $this->driver); <add> $this->assertInstanceOf('DateTime', $result); <add> $this->assertEqual('2001', $result->format('Y')); <add> $this->assertEqual('01', $result->format('m')); <add> $this->assertEqual('04', $result->format('d')); <add> } <add> <add>/** <add> * Test converting to database format <add> * <add> * @return void <add> */ <add> public function testToDatabase() { <add> $value = '2001-01-04'; <add> $result = $this->type->toDatabase($value, $this->driver); <add> $this->assertEquals($value, $result); <add> <add> $date = new \DateTime('2013-08-12'); <add> $result = $this->type->toDatabase($date, $this->driver); <add> $this->assertEquals('2013-08-12', $result); <add> } <add> <add>}
3
Ruby
Ruby
use commit in the signedcookiejar
b807ac7a7a195df663bbc9dfba87d397936b50f0
<ide><path>actionpack/lib/action_dispatch/middleware/cookies.rb <ide> def digest <ide> end <ide> end <ide> <del> class SignedCookieJar #:nodoc: <del> include ChainedCookieJars <add> class SignedCookieJar < AbstractCookieJar # :nodoc: <ide> include SerializedCookieJars <ide> <ide> def initialize(parent_jar) <del> @parent_jar = parent_jar <add> super <ide> secret = key_generator.generate_key(request.signed_cookie_salt) <ide> @verifier = ActiveSupport::MessageVerifier.new(secret, digest: digest, serializer: ActiveSupport::MessageEncryptor::NullSerializer) <ide> end <ide> def [](name) <ide> end <ide> end <ide> <del> # Signs and sets the cookie named +name+. The second argument may be the cookie's <del> # value or a hash of options as documented above. <del> def []=(name, options) <del> if options.is_a?(Hash) <del> options.symbolize_keys! <add> private <add> def commit(options) <ide> options[:value] = @verifier.generate(serialize(options[:value])) <del> else <del> options = { :value => @verifier.generate(serialize(options)) } <del> end <ide> <del> raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE <del> @parent_jar[name] = options <del> end <add> raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE <add> end <ide> <del> private <ide> def verify(signed_message) <ide> @verifier.verify(signed_message) <ide> rescue ActiveSupport::MessageVerifier::InvalidSignature
1
PHP
PHP
remove hints on controller hook methods
4f287e4ca996ced5e9547de3e9e0451272cabb34
<ide><path>src/Controller/Controller.php <ide> public function isAction(string $action): bool <ide> * or perform logic that needs to happen before each controller action. <ide> * <ide> * @param \Cake\Event\EventInterface $event An Event instance <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> * @link https://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks <ide> */ <del> public function beforeFilter(EventInterface $event): ?Response <add> public function beforeFilter(EventInterface $event) <ide> { <del> return null; <ide> } <ide> <ide> /** <ide> * Called after the controller action is run, but before the view is rendered. You can use this method <ide> * to perform logic or set view variables that are required on every request. <ide> * <ide> * @param \Cake\Event\EventInterface $event An Event instance <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> * @link https://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks <ide> */ <del> public function beforeRender(EventInterface $event): ?Response <add> public function beforeRender(EventInterface $event) <ide> { <del> return null; <ide> } <ide> <ide> /** <ide> public function beforeRender(EventInterface $event): ?Response <ide> * @param string|array $url A string or array-based URL pointing to another location within the app, <ide> * or an absolute URL <ide> * @param \Cake\Http\Response $response The response object. <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> * @link https://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks <ide> */ <del> public function beforeRedirect(EventInterface $event, $url, Response $response): ?Response <add> public function beforeRedirect(EventInterface $event, $url, Response $response) <ide> { <del> return null; <ide> } <ide> <ide> /** <ide> * Called after the controller action is run and rendered. <ide> * <ide> * @param \Cake\Event\EventInterface $event An Event instance <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> * @link https://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks <ide> */ <del> public function afterFilter(EventInterface $event): ?Response <add> public function afterFilter(EventInterface $event) <ide> { <del> return null; <ide> } <ide> } <ide><path>src/Controller/ErrorController.php <ide> public function initialize(): void <ide> * beforeRender callback. <ide> * <ide> * @param \Cake\Event\EventInterface $event Event. <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> */ <del> public function beforeRender(EventInterface $event): ?Response <add> public function beforeRender(EventInterface $event) <ide> { <ide> $this->viewBuilder()->setTemplatePath('Error'); <del> <del> return null; <ide> } <ide> } <ide><path>tests/test_app/TestApp/Controller/Admin/ErrorController.php <ide> public function initialize(): void <ide> * beforeRender callback. <ide> * <ide> * @param \Cake\Event\Event $event Event. <del> * @return Cake\Http\Response|null <add> * @return Cake\Http\Response|null|void <ide> */ <del> public function beforeRender(EventInterface $event): ?Response <add> public function beforeRender(EventInterface $event) <ide> { <ide> $this->viewBuilder()->setTemplatePath('Error'); <del> <del> return null; <ide> } <ide> } <ide><path>tests/test_app/TestApp/Controller/PostsController.php <ide> public function initialize(): void <ide> /** <ide> * beforeFilter <ide> * <del> * @return \Cake\Http\Response|null <add> * @return \Cake\Http\Response|null|void <ide> */ <del> public function beforeFilter(EventInterface $event): ?Response <add> public function beforeFilter(EventInterface $event) <ide> { <ide> if ($this->request->getParam('action') !== 'securePost') { <ide> $this->getEventManager()->off($this->Security); <ide> } <del> <del> return null; <ide> } <ide> <ide> /**
4
Python
Python
add numpy.doc topical documentation framework
c114dd8293e5ab72b57f3810df476b6528966d4f
<ide><path>numpy/__init__.py <ide> def pkgload(*packages, **options): <ide> import random <ide> import ctypeslib <ide> import ma <add> import doc <ide> <ide> # Make these accessible from numpy name-space <ide> # but not imported in from numpy import * <ide> def pkgload(*packages, **options): <ide> 'show_config']) <ide> __all__.extend(core.__all__) <ide> __all__.extend(lib.__all__) <del> __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma']) <add> __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma', 'doc']) <ide> <ide><path>numpy/doc/__init__.py <add>from numpy.doc.reference import * <add>del reference <ide><path>numpy/doc/reference/__init__.py <add>import os <add> <add>ref_dir = os.path.join(os.path.dirname(__file__)) <add> <add>__all__ = [f[:-3] for f in os.listdir(ref_dir) if f.endswith('.py') and <add> not f.startswith('__')] <add> <add>__doc__ = 'The following topics are available:\n' + \ <add> '\n - '.join([''] + __all__) <add> <add>__all__.extend(['__doc__']) <ide><path>numpy/doc/reference/broadcasting.py <add>""" <add> <add>======================== <add>Broadcasting over arrays <add>======================== <add> <add>Placeholder for broadcasting documentation. <add> <add>""" <ide><path>numpy/doc/reference/indexing.py <add>""" <add> <add>============== <add>Array indexing <add>============== <add> <add>Placeholder for array indexing documentation. <add> <add>""" <ide><path>numpy/setup.py <ide> def configuration(parent_package='',top_path=None): <ide> config.add_subpackage('linalg') <ide> config.add_subpackage('random') <ide> config.add_subpackage('ma') <add> config.add_subpackage('doc') <add> config.add_subpackage('doc/reference') <ide> config.add_data_dir('doc') <ide> config.add_data_dir('tests') <ide> config.make_config_py() # installs __config__.py
6
Javascript
Javascript
address more of brendan's comments
2ce00279be41c3435c72e86aa2035817cd5e20bf
<ide><path>src/chunked_stream.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals assert, MissingDataException, isInt, NetworkManager, PDFJS, <add>/* globals assert, MissingDataException, isInt, NetworkManager, Promise, <ide> isEmptyObj */ <ide> <ide> 'use strict'; <ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() { <ide> this.requestsByChunk = {}; <ide> this.callbacksByRequest = {}; <ide> <del> this.loadedStream = new PDFJS.Promise(); <add> this.loadedStream = new Promise(); <ide> } <ide> <ide> ChunkedStreamManager.prototype = { <ide><path>src/core.js <ide> isArrayBuffer, isDict, isName, isStream, isString, Lexer, <ide> Linearization, NullStream, PartialEvaluator, shadow, Stream, <ide> StreamsSequenceStream, stringToPDFString, TODO, Util, warn, XRef, <del> MissingDataException, PDFJS */ <add> MissingDataException, Promise */ <ide> <ide> 'use strict'; <ide> <ide> var Page = (function PageClosure() { <ide> }, <ide> getOperatorList: function Page_getOperatorList(handler) { <ide> var self = this; <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> <del> var pageListPromise = new PDFJS.Promise(); <del> var annotationListPromise = new PDFJS.Promise(); <add> var pageListPromise = new Promise(); <add> var annotationListPromise = new Promise(); <ide> <ide> var pdfManager = this.pdfManager; <ide> var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', <ide> []); <ide> var resourcesPromise = pdfManager.ensure(this, 'resources'); <del> var dataPromises = PDFJS.Promise.all( <add> var dataPromises = Promise.all( <ide> [contentStreamPromise, resourcesPromise]); <ide> dataPromises.then(function(data) { <ide> var contentStream = data[0]; <ide> var resources = data[1]; <ide> var pe = self.pe = new PartialEvaluator( <add> pdfManager, <ide> self.xref, handler, self.pageIndex, <ide> 'p' + self.pageIndex + '_'); <ide> <ide> var Page = (function PageClosure() { <ide> pdfManager.ensure(this, 'getAnnotationsForDraw', []).then( <ide> function(annotations) { <ide> var annotationEvaluator = new PartialEvaluator( <del> self.xref, handler, self.pageIndex, <add> pdfManager, self.xref, handler, self.pageIndex, <ide> 'p' + self.pageIndex + '_annotation'); <ide> <ide> pdfManager.ensure(annotationEvaluator, 'getAnnotationsOperatorList', <ide> var Page = (function PageClosure() { <ide> } <ide> ); <ide> <del> PDFJS.Promise.all([pageListPromise, annotationListPromise]).then( <add> Promise.all([pageListPromise, annotationListPromise]).then( <ide> function(datas) { <ide> var pageData = datas[0]; <ide> var pageQueue = pageData.queue; <ide> var Page = (function PageClosure() { <ide> <ide> var self = this; <ide> <del> var textContentPromise = new PDFJS.Promise(); <add> var textContentPromise = new Promise(); <ide> <ide> var pdfManager = this.pdfManager; <ide> var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', <ide> []); <del> var resourcesPromise = new PDFJS.Promise(); <add> var resourcesPromise = new Promise(); <ide> pdfManager.ensure(this, 'resources').then(function(resources) { <ide> pdfManager.ensure(self.xref, 'fetchIfRef', [resources]).then( <ide> function(resources) { <ide> var Page = (function PageClosure() { <ide> ); <ide> }); <ide> <del> var dataPromises = PDFJS.Promise.all([contentStreamPromise, <del> resourcesPromise]); <add> var dataPromises = Promise.all([contentStreamPromise, <add> resourcesPromise]); <ide> dataPromises.then(function(data) { <ide> var contentStream = data[0]; <ide> var resources = data[1]; <ide> var pe = new PartialEvaluator( <add> pdfManager, <ide> self.xref, handler, self.pageIndex, <ide> 'p' + self.pageIndex + '_'); <ide> <ide><path>src/evaluator.js <ide> IDENTITY_MATRIX, info, isArray, isCmd, isDict, isEOF, isName, isNum, <ide> isStream, isString, JpegStream, Lexer, Metrics, Name, Parser, <ide> Pattern, PDFImage, PDFJS, serifFonts, stdFontMap, symbolsFonts, <del> TilingPattern, TODO, warn, Util, MissingDataException, globalScope */ <add> TilingPattern, TODO, warn, Util, MissingDataException, Promise */ <ide> <ide> 'use strict'; <ide> <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <del> function PartialEvaluator(xref, handler, pageIndex, uniquePrefix) { <add> function PartialEvaluator(pdfManager, xref, handler, pageIndex, <add> uniquePrefix) { <ide> this.state = new EvalState(); <ide> this.stateStack = []; <ide> <add> this.pdfManager = pdfManager; <ide> this.xref = xref; <ide> this.handler = handler; <ide> this.pageIndex = pageIndex; <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> buildFormXObject: function PartialEvaluator_buildFormXObject(resources, <ide> xobj, smask) { <ide> var self = this; <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> var fnArray = []; <ide> var argsArray = []; <ide> <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> fn, args, resources, pattern, patternDict) { <ide> var self = this; <ide> // Create an IR of the pattern code. <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> var opListPromise = this.getOperatorList(pattern, <ide> patternDict.get('Resources') || resources); <ide> opListPromise.then(function(data) { <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> handleSetFont: function PartialEvaluator_handleSetFont( <ide> resources, fontArgs, font) { <ide> <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> // TODO(mack): Not needed? <ide> var fontName; <ide> if (fontArgs) { <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> gStateObj.push([key, value]); <ide> break; <ide> case 'Font': <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> self.handleSetFont(resources, null, value[0]).then(function(data) { <ide> var gState = ['Font', data.loadedName, value[1]]; <ide> promise.resolve({ <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> } <ide> } <ide> <del> var promise = new PDFJS.Promise(); <del> PDFJS.Promise.all(promises).then(function(datas) { <add> var promise = new Promise(); <add> Promise.all(promises).then(function(datas) { <ide> for (var i = 0, n = datas.length; i < n; ++i) { <ide> var data = datas[i]; <ide> var index = indices[i]; <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> <ide> loadFont: function PartialEvaluator_loadFont(fontName, font, xref, <ide> resources) { <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> <ide> var fontRes = resources.get('Font'); <ide> <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> opListPromises.push( <ide> this.getOperatorList(glyphStream, fontResources)); <ide> } <del> PDFJS.Promise.all(opListPromises).then(function(datas) { <add> Promise.all(opListPromises).then(function(datas) { <ide> var charProcOperatorList = {}; <ide> var dependencies = {}; <ide> for (var i = 0, n = charProcKeys.length; i < n; ++i) { <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> // dictionary <ide> var parser = new Parser(new Lexer(stream, OP_MAP), false, xref); <ide> <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> function parseCommands() { <ide> try { <ide> parser.restoreState(); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> subQueuePromises.push(argsArray[i][0]); <ide> } <ide> } <del> PDFJS.Promise.all(subQueuePromises).then(function(datas) { <add> Promise.all(subQueuePromises).then(function(datas) { <ide> // TODO(mack): Optimize by using repositioning elements <ide> // in original queue rather than creating new queue <ide> <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> throw e; <ide> } <ide> <del> var streamManager = globalScope.pdfManager.streamManager; <del> streamManager.requestRange(e.begin, e.end, function() { <del> parseCommands(); <del> }); <add> self.pdfManager.requestRange(e.begin, e.end).then(parseCommands); <ide> } <ide> } <ide> parser.saveState(); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> getAnnotationsOperatorList: <ide> function PartialEvaluator_getAnnotationsOperatorList(annotations, <ide> dependency) { <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> <ide> // 12.5.5: Algorithm: Appearance streams <ide> function getTransformMatrix(rect, bbox, matrix) { <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> annotation.resources); <ide> opListPromises.push(opListPromise); <ide> } else { <del> var opListPromise = new PDFJS.Promise(); <add> var opListPromise = new Promise(); <ide> opListPromise.resolve(createOperatorList()); <ide> opListPromises.push(opListPromise); <ide> } <ide> } <ide> <del> PDFJS.Promise.all(opListPromises).then(function(datas) { <add> Promise.all(opListPromises).then(function(datas) { <ide> var fnArray = []; <ide> var argsArray = []; <ide> var dependencies = {}; <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> var MULTI_SPACE_FACTOR = 1.5; <ide> var self = this; <ide> <del> var statePromise = new PDFJS.Promise(); <add> var statePromise = new Promise(); <ide> <ide> function handleSetFont(fontName, fontRef, resources) { <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> self.loadFont(fontName, fontRef, self.xref, resources).then( <ide> function(data) { <ide> promise.resolve(data.font.translated); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> //.translated; <ide> break; <ide> case 'TJ': <del> var chunkPromise = new PDFJS.Promise(); <add> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <ide> fontPromise.then(function(items, font) { <ide> var chunk = ''; <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> }.bind(null, args[0])); <ide> break; <ide> case 'Tj': <del> var chunkPromise = new PDFJS.Promise(); <add> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <ide> fontPromise.then(function(charCodes, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> // For search, adding a extra white space for line breaks <ide> // would be better here, but that causes too much spaces in <ide> // the text-selection divs. <del> var chunkPromise = new PDFJS.Promise(); <add> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <ide> fontPromise.then(function(charCodes, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> break; <ide> case '"': <ide> // Note comment in "'" <del> var chunkPromise = new PDFJS.Promise(); <add> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <ide> fontPromise.then(function(charCodes, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> } <ide> } // while <ide> <del> PDFJS.Promise.all(chunkPromises).then(function(datas) { <add> Promise.all(chunkPromises).then(function(datas) { <ide> var bidiTexts = []; <ide> for (var i = 0, n = datas.length; i < n; ++i) { <ide> var bidiText = datas[i]; <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> throw e; <ide> } <ide> <del> var streamManager = globalScope.pdfManager.streamManager; <del> streamManager.requestRange(e.begin, e.end, function() { <del> parseCommands(); <del> }); <add> self.pdfManager.requestRange(e.begin, e.end).then(parseCommands); <ide> } <ide> } <ide> parser.saveState(); <ide><path>src/obj.js <ide> /* globals assertWellFormed, bytesToString, CipherTransformFactory, error, info, <ide> InvalidPDFException, isArray, isCmd, isDict, isInt, isName, isRef, <ide> isStream, JpegStream, Lexer, log, Page, Parser, Promise, shadow, <del> stringToPDFString, stringToUTF8String, warn, isString, assert, PDFJS, <del> MissingDataException, XRefParseException, Stream */ <add> stringToPDFString, stringToUTF8String, warn, isString, assert, <add> Promise, MissingDataException, XRefParseException, Stream */ <ide> <ide> 'use strict'; <ide> <ide> var Catalog = (function CatalogClosure() { <ide> <ide> getPage: function Catalog_getPage(pageIndex) { <ide> if (!(pageIndex in this.pagePromises)) { <del> this.pagePromises[pageIndex] = new PDFJS.Promise(); <add> this.pagePromises[pageIndex] = new Promise(); <ide> } <ide> return this.pagePromises[pageIndex]; <ide> }, <ide> var Catalog = (function CatalogClosure() { <ide> var page = new Page(this.pdfManager, this.xref, pageIndex, kid, <ide> kidRef); <ide> if (!(pageIndex in this.pagePromises)) { <del> this.pagePromises[pageIndex] = new PDFJS.Promise(); <add> this.pagePromises[pageIndex] = new Promise(); <ide> } <ide> this.pagePromises[pageIndex].resolve(page); <ide> <ide><path>src/pdf_manager.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals NotImplementedException, MissingDataException, PDFJS, Stream, <add>/* globals NotImplementedException, MissingDataException, Promise, Stream, <ide> PDFDocument, ChunkedStream, ChunkedStreamManager */ <ide> <ide> 'use strict'; <ide> var BasePdfManager = (function BasePdfManagerClosure() { <ide> return new NotImplementedException(); <ide> }, <ide> <add> requestRange: function BasePdfManager_ensure(begin, end) { <add> return new NotImplementedException(); <add> }, <add> <ide> requestLoadedStream: function BasePdfManager_requestLoadedStream() { <ide> return new NotImplementedException(); <ide> } <ide> var LocalPdfManager = (function LocalPdfManagerClosure() { <ide> function LocalPdfManager(data, password) { <ide> var stream = new Stream(data); <ide> this.pdfModel = new PDFDocument(this, stream, password); <del> this.loadedStream = new PDFJS.Promise(); <add> this.loadedStream = new Promise(); <ide> this.loadedStream.resolve(stream); <ide> } <ide> <ide> var LocalPdfManager = (function LocalPdfManagerClosure() { <ide> <ide> LocalPdfManager.prototype.ensure = <ide> function LocalPdfManager_ensure(obj, prop, args) { <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> try { <ide> var value = obj[prop]; <ide> var result; <ide> var LocalPdfManager = (function LocalPdfManagerClosure() { <ide> return promise; <ide> }; <ide> <add> LocalPdfManager.prototype.requestRange = <add> function LocalPdfManager_requestRange(begin, end) { <add> var promise = new Promise(); <add> promise.resolve(); <add> return promise; <add> }; <add> <ide> LocalPdfManager.prototype.requestLoadedStream = <ide> function LocalPdfManager_requestLoadedStream() { <ide> }; <ide> var NetworkPdfManager = (function NetworkPdfManagerClosure() { <ide> <ide> NetworkPdfManager.prototype.ensure = <ide> function NetworkPdfManager_ensure(obj, prop, args) { <del> var promise = new PDFJS.Promise(); <add> var promise = new Promise(); <ide> this.ensureHelper(promise, obj, prop, args); <ide> return promise; <ide> }; <ide> var NetworkPdfManager = (function NetworkPdfManagerClosure() { <ide> } <ide> }; <ide> <add> NetworkPdfManager.prototype.requestRange = <add> function NetworkPdfManager_requestRange(begin, end) { <add> var promise = new Promise(); <add> this.streamManager.requestRange(begin, end, function() { <add> promise.resolve(); <add> }); <add> return promise; <add> }; <add> <ide> NetworkPdfManager.prototype.requestLoadedStream = <ide> function NetworkPdfManager_requestLoadedStream() { <ide> this.streamManager.requestAllChunks(); <ide><path>src/worker.js <ide> var WorkerMessageHandler = { <ide> var pdfManager; <ide> <ide> function loadDocument(recoveryMode) { <del> var loadDocumentPromise = new PDFJS.Promise(); <add> var loadDocumentPromise = new Promise(); <ide> <ide> var parseSuccess = function parseSuccess() { <ide> var numPagesPromise = pdfManager.ensureModel('numPages'); <ide> var WorkerMessageHandler = { <ide> var metadataPromise = pdfManager.ensureCatalog('metadata'); <ide> var encryptedPromise = pdfManager.ensureXRef('encrypt'); <ide> var javaScriptPromise = pdfManager.ensureCatalog('javaScript'); <del> PDFJS.Promise.all([numPagesPromise, fingerprintPromise, outlinePromise, <add> Promise.all([numPagesPromise, fingerprintPromise, outlinePromise, <ide> infoPromise, metadataPromise, encryptedPromise, <ide> javaScriptPromise]).then( <ide> function onDocReady(results) { <ide> var WorkerMessageHandler = { <ide> } <ide> <ide> function getPdfManager(data) { <del> var pdfManagerPromise = new PDFJS.Promise(); <add> var pdfManagerPromise = new Promise(); <ide> <ide> var source = data.source; <ide> var disableRange = data.disableRange; <ide> var WorkerMessageHandler = { <ide> }; <ide> <ide> getPdfManager(data).then(function() { <del> globalScope.pdfManager = pdfManager; <ide> loadDocument(false).then(onSuccess, function(ex) { <ide> // Try again with recoveryMode == true <ide> if (!(ex instanceof XRefParseException)) { <ide> var WorkerMessageHandler = { <ide> var refPromise = pdfManager.ensure(page, 'ref'); <ide> var viewPromise = pdfManager.ensure(page, 'view'); <ide> <del> PDFJS.Promise.all([rotatePromise, refPromise, viewPromise]).then( <add> Promise.all([rotatePromise, refPromise, viewPromise]).then( <ide> function(results) { <ide> var page = { <ide> pageIndex: data.pageIndex, <ide><path>test/unit/evaluator_spec.js <ide> describe('evaluator', function() { <ide> } <ide> }; <ide> <add> function PdfManagerMock() { } <add> <ide> describe('splitCombinedOperations', function() { <ide> it('should reject unknown operations', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('qTT'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle one operations', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('Q'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle two glued operations', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var resources = new ResourcesMock(); <ide> resources.Res1 = {}; <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle tree glued operations', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('qqq'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle three glued operations #2', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var resources = new ResourcesMock(); <ide> resources.Res1 = {}; <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle glued operations and operands', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('q5 Ts'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> }); <ide> <ide> it('should handle glued operations and literals', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('trueifalserinullq'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> <ide> describe('validateNumberOfArgs', function() { <ide> it('should execute if correct number of arguments', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('5 1 d0'); <ide> console.log('here!'); <ide> describe('evaluator', function() { <ide> }); <ide> }); <ide> it('should execute if too many arguments', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('5 1 4 d0'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock()); <ide> describe('evaluator', function() { <ide> }); <ide> }); <ide> it('should skip if too few arguments', function() { <del> var evaluator = new PartialEvaluator(new XrefMock(), new HandlerMock(), <add> var evaluator = new PartialEvaluator(new PdfManagerMock(), <add> new XrefMock(), new HandlerMock(), <ide> 'prefix'); <ide> var stream = new StringStream('5 d0'); <ide> var promise = evaluator.getOperatorList(stream, new ResourcesMock());
7
Ruby
Ruby
dry this baby up
8bce6e761d52afd68bb06ca9ff8222f072e06cc8
<ide><path>actionpack/lib/action_view/helpers/date_helper.rb <ide> def select_minute <ide> def select_hour <ide> if @options[:use_hidden] || @options[:discard_hour] <ide> build_hidden(:hour, hour) <del> elsif @options[:ampm] <del> build_select(:hour, build_ampm_options(hour, :end => 23)) <ide> else <del> build_options_and_select(:hour, hour, :end => 23) <add> build_options_and_select(:hour, hour, :end => 23, :ampm => @options[:ampm]) <ide> end <ide> end <ide> <ide> def build_options_and_select(type, selected, options = {}) <ide> build_select(type, build_options(selected, options)) <ide> end <ide> <del> def build_ampm_options(selected, options = {}) <del> start = options.delete(:start) || 0 <del> stop = options.delete(:end) || 23 <del> step = options.delete(:step) || 1 <del> options.reverse_merge!({:leading_zeros => true}) <del> leading_zeros = options.delete(:leading_zeros) <del> <del> select_options = [] <del> start.step(stop, step) do |i| <del> text = AMPM_TRANSLATION[i] <del> value = leading_zeros ? sprintf("%02d", i) : i <del> tag_options = { :value => value } <del> tag_options[:selected] = "selected" if selected == i <del> select_options << content_tag(:option, text, tag_options) <del> end <del> (select_options.join("\n") + "\n").html_safe <del> end <del> <ide> # Build select option html from date value and options <ide> # build_options(15, :start => 1, :end => 31) <ide> # => "<option value="1">1</option> <ide> def build_options(selected, options = {}) <ide> start = options.delete(:start) || 0 <ide> stop = options.delete(:end) || 59 <ide> step = options.delete(:step) || 1 <del> options.reverse_merge!({:leading_zeros => true}) <add> options.reverse_merge!({:leading_zeros => true, :ampm => false}) <ide> leading_zeros = options.delete(:leading_zeros) <ide> <ide> select_options = [] <ide> start.step(stop, step) do |i| <ide> value = leading_zeros ? sprintf("%02d", i) : i <ide> tag_options = { :value => value } <ide> tag_options[:selected] = "selected" if selected == i <del> select_options << content_tag(:option, value, tag_options) <add> text = options[:ampm] ? AMPM_TRANSLATION[i] : value <add> select_options << content_tag(:option, text, tag_options) <ide> end <ide> (select_options.join("\n") + "\n").html_safe <ide> end
1
Javascript
Javascript
add a scale.init method
a301ca148c4536793a740e7d263e74bc258ed25b
<ide><path>src/core/core.controller.js <ide> export default class Chart { <ide> let scale = null; <ide> if (id in scales && scales[id].type === scaleType) { <ide> scale = scales[id]; <del> scale.options = scaleOptions; <del> scale.ctx = me.ctx; <del> scale.chart = me; <ide> } else { <ide> const scaleClass = scaleService.getScaleConstructor(scaleType); <ide> if (!scaleClass) { <ide> export default class Chart { <ide> scale = new scaleClass({ <ide> id, <ide> type: scaleType, <del> options: scaleOptions, <ide> ctx: me.ctx, <ide> chart: me <ide> }); <ide> scales[scale.id] = scale; <ide> } <ide> <del> scale.axis = scale.options.position === 'chartArea' ? 'r' : scale.isHorizontal() ? 'x' : 'y'; <del> <del> // parse min/max value, so we can properly determine min/max for other scales <del> scale._userMin = scale.parse(scale.options.min); <del> scale._userMax = scale.parse(scale.options.max); <add> scale.init(scaleOptions); <ide> <ide> // TODO(SB): I think we should be able to remove this custom case (options.scale) <ide> // and consider it as a regular scale part of the "scales"" map only! This would <ide><path>src/core/core.scale.js <ide> export default class Scale extends Element { <ide> /** @type {string} */ <ide> this.type = cfg.type; <ide> /** @type {object} */ <del> this.options = cfg.options; <add> this.options = undefined; <ide> /** @type {CanvasRenderingContext2D} */ <ide> this.ctx = cfg.ctx; <ide> /** @type {Chart} */ <ide> export default class Scale extends Element { <ide> this._borderValue = 0; <ide> } <ide> <add> /** <add> * @param {object} options <add> * @since 3.0 <add> */ <add> init(options) { <add> const me = this; <add> me.options = options; <add> <add> me.axis = me.isHorizontal() ? 'x' : 'y'; <add> <add> // parse min/max value, so we can properly determine min/max for other scales <add> me._userMin = me.parse(options.min); <add> me._userMax = me.parse(options.max); <add> } <add> <ide> /** <ide> * Parse a supported input value to internal representation. <ide> * @param {*} raw <del> * @param {number} index <add> * @param {number} [index] <ide> * @since 3.0 <ide> */ <ide> parse(raw, index) { // eslint-disable-line no-unused-vars <ide><path>src/scales/scale.radialLinear.js <ide> export default class RadialLinearScale extends LinearScaleBase { <ide> this.pointLabels = []; <ide> } <ide> <add> init(options) { <add> super.init(options); <add> this.axis = 'r'; <add> } <add> <ide> setDimensions() { <ide> const me = this; <ide> <ide><path>src/scales/scale.time.js <ide> export default class TimeScale extends Scale { <ide> constructor(props) { <ide> super(props); <ide> <del> const options = this.options; <del> const time = options.time || (options.time = {}); <del> const adapter = this._adapter = new adapters._date(options.adapters.date); <del> <ide> /** @type {{data: number[], labels: number[], all: number[]}} */ <ide> this._cache = { <ide> data: [], <ide> export default class TimeScale extends Scale { <ide> this._offsets = {}; <ide> /** @type {object[]} */ <ide> this._table = []; <add> } <add> <add> init(options) { <add> const time = options.time || (options.time = {}); <add> const adapter = this._adapter = new adapters._date(options.adapters.date); <ide> <ide> // Backward compatibility: before introducing adapter, `displayFormats` was <ide> // supposed to contain *all* unit/string pairs but this can't be resolved <ide> // when loading the scale (adapters are loaded afterward), so let's populate <ide> // missing formats on update <ide> mergeIf(time.displayFormats, adapter.formats()); <add> <add> super.init(options); <ide> } <ide> <ide> /** <ide><path>test/specs/scale.category.tests.js <ide> describe('Category scale tests', function() { <ide> var Constructor = Chart.scaleService.getScaleConstructor('category'); <ide> var scale = new Constructor({ <ide> ctx: {}, <del> options: config, <ide> chart: { <ide> data: mockData <ide> }, <ide> id: scaleID <ide> }); <ide> <add> scale.init(config); <ide> scale.determineDataLimits(); <ide> scale.ticks = scale.buildTicks(); <ide> expect(getValues(scale)).toEqual(mockData.xLabels); <ide> describe('Category scale tests', function() { <ide> var Constructor = Chart.scaleService.getScaleConstructor('category'); <ide> var scale = new Constructor({ <ide> ctx: {}, <del> options: config, <ide> chart: { <ide> data: mockData <ide> }, <ide> id: scaleID <ide> }); <ide> <add> scale.init(config); <ide> scale.determineDataLimits(); <ide> scale.ticks = scale.buildTicks(); <ide> expect(getValues(scale)).toEqual(mockData.yLabels);
5
PHP
PHP
add a "validated" method to the form request
eb02670211fb8eec7aaf84679301565089cbd95f
<ide><path>src/Illuminate/Foundation/Http/FormRequest.php <ide> protected function createDefaultValidator(ValidationFactory $factory) <ide> ); <ide> } <ide> <add> /** <add> * Get the validated data from the request. <add> * <add> * @return array <add> */ <add> public function validated() <add> { <add> return $this->only(array_keys($this->container->call([$this, 'rules']))); <add> } <add> <ide> /** <ide> * Get data to be validated from the request. <ide> * <ide><path>tests/Foundation/FoundationFormRequestTest.php <ide> public function tearDown() <ide> $this->mocks = []; <ide> } <ide> <add> public function test_validated_method_returns_the_validated_data() <add> { <add> $request = $this->createRequest(['name' => 'specified', 'with' => 'extras']); <add> <add> $request->validate(); <add> <add> $this->assertEquals(['name' => 'specified'], $request->validated()); <add> } <add> <ide> /** <ide> * @expectedException \Illuminate\Validation\ValidationException <ide> */
2
Text
Text
improve wording, grammar, punctuation etc
cfe283cfebd443f143ce680d10c10b78e284e3d0
<ide><path>.github/CONTRIBUTING.md <ide> To run the test cases locally use the following command: <ide> vendor/bin/phpunit <ide> <ide> You can copy file `phpunit.xml.dist` to `phpunit.xml` and modify the database <del>driver settings as required to run tests for particular database. <add>driver settings as required to run tests for a particular database. <ide> <ide> You can also register on [Travis CI](https://travis-ci.org/) and from your <ide> [profile](https://travis-ci.org/profile) page enable the service hook for your <ide> To run the sniffs for CakePHP coding standards: <ide> vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src <ide> <ide> Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer) <del>repository to setup the CakePHP standard. The [README](https://github.com/cakephp/cakephp-codesniffer/blob/master/README.md) contains installation info <add>repository to set up the CakePHP standard. The [README](https://github.com/cakephp/cakephp-codesniffer/blob/master/README.md) contains installation info <ide> for the sniff and phpcs. <ide> <ide> ## Reporting a Security Issue <ide> <del>If you've found a security related issue in CakePHP, please don't open an issue in github. Instead contact us at security@cakephp.org. For more information on how we handle security issues, [see the CakePHP Security Issue Process](https://book.cakephp.org/4/en/contributing/tickets.html#reporting-security-issues). <add>If you've found a security related issue in CakePHP, please don't open an issue in github. Instead, contact us at security@cakephp.org. For more information on how we handle security issues, [see the CakePHP Security Issue Process](https://book.cakephp.org/4/en/contributing/tickets.html#reporting-security-issues). <ide> <ide> # Additional Resources <ide> <ide><path>src/Cache/README.md <ide> $object = new FileEngine($config); <ide> Cache::config('other', $object); <ide> ``` <ide> <del>You can now read a write from the cache: <add>You can now read and write from the cache: <ide> <ide> ```php <ide> $data = Cache::remember('my_cache_key', function () { <ide><path>src/Console/README.md <ide> parsers, and dispatching commands. <ide> <ide> # Getting Started <ide> <del>To start, define an an entry point script and Application class that defines <add>To start, define an entry point script and Application class which defines <ide> bootstrap logic, and binds your commands. Lets put our entrypoint script in <ide> `bin/tool.php`: <ide> <ide><path>src/Core/README.md <ide> Configure::load('app', 'default', false); <ide> Configure::load('other_config', 'default'); <ide> ``` <ide> <del>And Write the configuration back into files: <add>And write the configuration back into files: <ide> <ide> ```php <ide> Configure::dump('my_config', 'default'); <ide><path>src/Datasource/README.md <ide> Additionally, this package provides a few traits and classes you can use in your <ide> <ide> * `EntityTrait` - Contains the default implementation for the `EntityInterface`. <ide> * `QueryTrait` - Exposes the methods for creating a query object capable of returning decoratable collections. <del>* `ResultSetDecorator` - Decorates any traversable object so it complies with `ResultSetInterface`. <add>* `ResultSetDecorator` - Decorates any traversable object, so it complies with `ResultSetInterface`. <ide> <ide> <ide> ## Connections <ide><path>src/Filesystem/README.md <ide> [![Total Downloads](https://img.shields.io/packagist/dt/cakephp/filesystem.svg?style=flat-square)](https://packagist.org/packages/cakephp/filesystem) <ide> [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt) <ide> <del># This package is deprecated. <add># This package has been deprecated. <ide> <ide> ## CakePHP Filesystem Library <ide> <ide><path>src/Http/README.md <ide> handle incoming server requests and send outgoing HTTP requests. <ide> <ide> ## Using the Http Client <ide> <del>Sending requests is straight forward. Doing a GET request looks like <add>Sending requests is straight forward. Doing a GET request looks like: <ide> <ide> ```php <ide> use Cake\Http\Client; <ide> To learn more read the [Http Client documentation](https://book.cakephp.org/4/en <ide> <ide> The Http Server allows an `HttpApplicationInterface` to process requests and <ide> emit responses. To get started first implement the <del>`Cake\Http\HttpApplicationInterface` A minimal example would could look like: <add>`Cake\Http\HttpApplicationInterface` A minimal example could look like: <ide> <ide> ```php <ide> namespace App; <ide><path>src/Log/README.md <ide> multiple logging backends using a simple interface. With the `Log` class it is <ide> possible to send a single message to multiple logging backends at the same time <ide> or just a subset of them based on the log level or context. <ide> <del>By default you can use Files or Syslog as logging backends, but you can use any <add>By default, you can use Files or Syslog as logging backends, but you can use any <ide> object implementing `Psr\Log\LoggerInterface` as an engine for the `Log` class. <ide> <ide> ## Usage <ide><path>src/ORM/README.md <ide> use Cake\ORM\Locator\LocatorAwareTrait; <ide> $articles = $this->getTableLocator()->get('Articles'); <ide> ``` <ide> <del>By default classes using `LocatorAwareTrait` will share a global locator instance. <add>By default, classes using `LocatorAwareTrait` will share a global locator instance. <ide> You can inject your own locator instance into the object: <ide> <ide> ```php <ide> In your table classes you can define the relations between your tables. CakePHP' <ide> supports 4 association types out of the box: <ide> <ide> * belongsTo - E.g. Many articles belong to a user. <del>* hasOne - E.g. A user has one profile <del>* hasMany - E.g. A user has many articles <add>* hasOne - E.g. A user has one profile. <add>* hasMany - E.g. A user has many articles. <ide> * belongsToMany - E.g. An article belongsToMany tags. <ide> <ide> You define associations in your table's `initialize()` method. See the <ide> $articles->delete($article); <ide> <ide> ## Meta Data Cache <ide> <del>It is recommended to enable meta data cache for production systems to avoid performance issues. <add>It is recommended to enable metadata cache for production systems to avoid performance issues. <ide> For e.g. file system strategy your bootstrap file could look like this: <ide> <ide> ```php <ide> $cacheConfig = [ <ide> Cache::setConfig('_cake_model_', $cacheConfig); <ide> ``` <ide> <del>Cache configs are optional so you must require ``cachephp/cache`` to add one. <add>Cache configs are optional, so you must require ``cachephp/cache`` to add one. <ide> <ide> ## Creating Custom Table and Entity Classes <ide>
9
Javascript
Javascript
fix error on empty array config
20ab1bfa7f320866340b18336c15b9a3142c52d5
<ide><path>bin/webpack.js <ide> function processOptions(options) { <ide> return; <ide> } <ide> <del> var firstOptions = Array.isArray(options) ? options[0] : options; <add> var firstOptions = Array.isArray(options) ? (options[0] || {}) : options; <ide> <ide> if(typeof options.stats === "boolean" || typeof options.stats === "string") { <ide> var statsPresetToOptions = require("../lib/Stats.js").presetToOptions;
1
Python
Python
handle possibility there are no workers
cd89518cf2ef18aaf739eac06aaf28a2e3d0fffa
<ide><path>celery/bin/graph.py <ide> def maybe_abbr(l, name, max=Wmax): <ide> workers = args['nodes'] <ide> threads = args.get('threads') or [] <ide> except KeyError: <del> replies = self.app.control.inspect().stats() <add> replies = self.app.control.inspect().stats() or {} <ide> workers, threads = [], [] <ide> for worker, reply in items(replies): <ide> workers.append(worker)
1
Javascript
Javascript
simplify image parsing
15e41aff657691220528fcd7f2c4f02572055e86
<ide><path>examples/js/loaders/FBXLoader.js <ide> <ide> // Parse FBXTree.Objects.Video for embedded image data <ide> // These images are connected to textures in FBXTree.Objects.Textures <del> // via FBXTree.Connections. Note that images can be duplicated here, in which case only one <del> // may have a .Content field - we'll check for this and duplicate the data in the imageMap <add> // via FBXTree.Connections. <ide> function parseImages( FBXTree ) { <ide> <del> var imageMap = new Map(); <del> <del> var names = {}; <del> var duplicates = []; <add> var images = {}; <add> var blobs = {}; <ide> <ide> if ( 'Video' in FBXTree.Objects ) { <ide> <ide> <ide> var id = parseInt( nodeID ); <ide> <del> // check whether the file name is used by another videoNode <del> // and if so keep a record of both ids as a duplicate pair [ id1, id2 ] <del> if ( videoNode.FileName in names ) { <add> images[ id ] = videoNode.Filename; <ide> <del> duplicates.push( [ id, names[ videoNode.FileName ] ] ); <add> // raw image data is in videoNode.Content <add> if ( 'Content' in videoNode ) { <ide> <del> } <add> var arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 ); <add> var base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' ); <ide> <del> names[ videoNode.FileName ] = id; <add> if ( arrayBufferContent || base64Content ) { <ide> <del> // raw image data is in videoNode.Content <del> if ( 'Content' in videoNode && videoNode.Content !== '' ) { <add> var image = parseImage( videoNodes[ nodeID ] ); <ide> <del> var image = parseImage( videoNodes[ nodeID ] ); <add> blobs[ videoNode.Filename ] = image; <ide> <del> imageMap.set( id, image ); <add> } <ide> <ide> } <ide> <ide> } <ide> <ide> } <ide> <add> for ( var id in images ) { <ide> <del> // check each duplicate pair - if only one is in the image map then <del> // create an entry for the other id containing the same image data <del> // Note: it seems to be possible for entries to have the same file name but different <del> // content, we won't overwrite these <del> duplicates.forEach( function ( duplicatePair ) { <del> <del> if ( imageMap.has( duplicatePair[ 0 ] ) && ! imageMap.has( duplicatePair[ 1 ] ) ) { <del> <del> var image = imageMap.get( duplicatePair[ 0 ] ); <del> imageMap.set( duplicatePair[ 1 ], image ); <add> var filename = images[ id ]; <ide> <del> } else if ( imageMap.has( duplicatePair[ 1 ] ) && ! imageMap.has( duplicatePair[ 0 ] ) ) { <add> if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ]; <add> else images[ id ] = images[ id ].split( '\\' ).pop(); <ide> <del> var image = imageMap.get( duplicatePair[ 1 ] ); <del> imageMap.set( duplicatePair[ 0 ], image ); <del> <del> } <del> <del> } ); <add> } <ide> <del> return imageMap; <add> return images; <ide> <ide> } <ide> <ide> // Parse nodes in FBXTree.Objects.Texture <ide> // These contain details such as UV scaling, cropping, rotation etc and are connected <ide> // to images in FBXTree.Objects.Video <del> function parseTextures( FBXTree, loader, imageMap, connections ) { <add> function parseTextures( FBXTree, loader, images, connections ) { <ide> <ide> var textureMap = new Map(); <ide> <ide> var textureNodes = FBXTree.Objects.Texture; <ide> for ( var nodeID in textureNodes ) { <ide> <del> var texture = parseTexture( textureNodes[ nodeID ], loader, imageMap, connections ); <add> var texture = parseTexture( textureNodes[ nodeID ], loader, images, connections ); <ide> textureMap.set( parseInt( nodeID ), texture ); <ide> <ide> } <ide> } <ide> <ide> // Parse individual node in FBXTree.Objects.Texture <del> function parseTexture( textureNode, loader, imageMap, connections ) { <add> function parseTexture( textureNode, loader, images, connections ) { <ide> <del> var texture = loadTexture( textureNode, loader, imageMap, connections ); <add> var texture = loadTexture( textureNode, loader, images, connections ); <ide> <ide> texture.ID = textureNode.id; <ide> <ide> } <ide> <ide> // load a texture specified as a blob or data URI, or via an external URL using THREE.TextureLoader <del> function loadTexture( textureNode, loader, imageMap, connections ) { <add> function loadTexture( textureNode, loader, images, connections ) { <ide> <ide> var fileName; <ide> <del> var filePath = textureNode.FileName; <del> var relativeFilePath = textureNode.RelativeFilename; <del> <ide> var children = connections.get( textureNode.id ).children; <ide> <del> if ( children !== undefined && children.length > 0 && imageMap.has( children[ 0 ].ID ) ) { <add> if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { <ide> <del> fileName = imageMap.get( children[ 0 ].ID ); <del> <del> } <del> // check that relative path is not an actually an absolute path and if so use it to load texture <del> else if ( relativeFilePath !== undefined && relativeFilePath[ 0 ] !== '/' && relativeFilePath.match( /^[a-zA-Z]:/ ) === null ) { <del> <del> fileName = relativeFilePath; <del> <del> } <del> // texture specified by absolute path <del> else { <del> <del> var split = filePath.split( /[\\\/]/ ); <del> <del> if ( split.length > 0 ) { <del> <del> fileName = split[ split.length - 1 ]; <del> <del> } else { <del> <del> fileName = filePath; <del> <del> } <add> fileName = images[ children[ 0 ].ID ]; <ide> <ide> } <ide> <ide> <ide> var tracks = []; <ide> <del> if ( rawTracks.T !== undefined && Object.keys( rawTracks.T.curves ).length > 0 ) { <add> if ( rawTracks.T !== undefined ) { <ide> <ide> var positionTrack = generateVectorTrack( rawTracks.modelName, rawTracks.T.curves, rawTracks.initialPosition, 'position' ); <ide> if ( positionTrack !== undefined ) tracks.push( positionTrack ); <ide> <ide> } <ide> <del> if ( rawTracks.R !== undefined && Object.keys( rawTracks.R.curves ).length > 0 ) { <add> if ( rawTracks.R !== undefined ) { <ide> <ide> var rotationTrack = generateRotationTrack( rawTracks.modelName, rawTracks.R.curves, rawTracks.initialRotation, rawTracks.preRotations ); <ide> if ( rotationTrack !== undefined ) tracks.push( rotationTrack ); <ide> <ide> } <ide> <del> if ( rawTracks.S !== undefined && Object.keys( rawTracks.S.curves ).length > 0 ) { <add> if ( rawTracks.S !== undefined ) { <ide> <ide> var scaleTrack = generateVectorTrack( rawTracks.modelName, rawTracks.S.curves, rawTracks.initialScale, 'scale' ); <ide> if ( scaleTrack !== undefined ) tracks.push( scaleTrack );
1
Javascript
Javascript
add test case
36d9bd555628f6470d5f0532c53a285d69a4942a
<ide><path>test/HarmonyExportImportedSpecifierDependency.test.js <add>/* globals describe, it, beforeEach */ <add>"use strict"; <add> <add>const should = require("should"); <add>const HarmonyExportImportedSpecifierDependency = require("../lib/dependencies/HarmonyExportImportedSpecifierDependency"); <add> <add>describe("HarmonyExportImportedSpecifierDependency", () => { <add> describe("getHashValue", () => { <add> it("should return empty string on missing module", () => { // see e.g. PR #4368 <add> var instance = new HarmonyExportImportedSpecifierDependency(); <add> should(instance.getHashValue(undefined)).be.eql(""); <add> should(instance.getHashValue(null)).be.eql(""); <add> }); <add> }); <add>});
1
Ruby
Ruby
add ofail command and fix bottle command output
fe969c21ad199ae27a113e9fb2f01c5bb3fbc942
<ide><path>Library/Contributions/cmds/brew-test-bot.rb <ide> def initialize arg <ide> begin <ide> Formula.factory arg <ide> rescue FormulaUnavailableError <del> ofail "#{arg} is not a pull request number or formula." unless arg.to_i > 0 <add> odie "#{arg} is not a pull request number or formula." unless arg.to_i > 0 <ide> @url = arg <ide> @formulae = [] <ide> else <ide> def cleanup <ide> test "git clean --force -dx" <ide> else <ide> `git diff --exit-code HEAD 2>/dev/null` <del> ofail "Uncommitted changes, aborting." unless $?.success? <add> odie "Uncommitted changes, aborting." unless $?.success? <ide> test "git reset --hard #{@start_sha1}" if @start_sha1 <ide> end <ide> end <ide> def self.run url <ide> end <ide> <ide> if ARGV.empty? <del> ofail 'This command requires at least one argument containing a pull request number or formula.' <add> odie 'This command requires at least one argument containing a pull request number or formula.' <ide> end <ide> <ide> Dir.chdir HOMEBREW_REPOSITORY <ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit <ide> end <ide> end <ide> <del> if errors <del> puts "#{problem_count} problems in #{brew_count} brews" <del> Homebrew.failed = true <del> end <add> ofail "#{problem_count} problems in #{brew_count} brews" if errors <ide> end <ide> end <ide><path>Library/Homebrew/cmd/bottle.rb <ide> module Homebrew extend self <ide> def bottle_formula f <ide> unless f.installed? <del> onoe "Formula not installed: #{f.name}" <del> Homebrew.failed = true <add> return ofail "Formula not installed: #{f.name}" <ide> return <ide> end <ide> <ide> unless built_bottle? f <del> onoe "Formula not installed with '--build-bottle': #{f.name}" <del> Homebrew.failed = true <add> return ofail "Formula not installed with '--build-bottle': #{f.name}" <ide> end <ide> <ide> directory = Pathname.pwd <ide><path>Library/Homebrew/cmd/doctor.rb <ide> def doctor <ide> unless out.nil? or out.empty? <ide> puts unless Homebrew.failed? <ide> lines = out.to_s.split('\n') <del> opoo lines.shift <add> ofail lines.shift <ide> puts lines <del> Homebrew.failed = true <ide> end <ide> end <ide> <ide><path>Library/Homebrew/cmd/install.rb <ide> def install_formulae formulae <ide> fi.caveats <ide> fi.finish <ide> rescue CannotInstallFormulaError => e <del> onoe e.message <del> Homebrew.failed = true <add> ofail e.message <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/cmd/test.rb <ide> def test <ide> ARGV.formulae.each do |f| <ide> # Cannot test uninstalled formulae <ide> unless f.installed? <del> puts "Testing requires the latest version of #{f.name}" <del> Homebrew.failed = true <add> ofail "Testing requires the latest version of #{f.name}" <ide> next <ide> end <ide> <ide> # Cannot test formulae without a test method <ide> unless f.respond_to? :test <del> puts "#{f.name} defines no test" <del> Homebrew.failed = true <add> ofail "#{f.name} defines no test" <ide> next <ide> end <ide> <ide> def test <ide> # tests can also return false to indicate failure <ide> raise if f.test == false <ide> rescue <del> puts "#{f.name}: failed" <del> Homebrew.failed = true <add> ofail "#{f.name}: failed" <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/cmd/uninstall.rb <ide> def uninstall <ide> end <ide> end <ide> rescue MultipleVersionsInstalledError => e <del> onoe e <add> ofail e <ide> puts "Use `brew remove --force #{e.name}` to remove all versions." <del> Homebrew.failed = true <ide> end <ide> end <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> def upgrade_formula f <ide> installer.caveats <ide> installer.finish <ide> rescue CannotInstallFormulaError => e <del> onoe e <del> Homebrew.failed = true <add> ofail e <ide> rescue BuildError => e <ide> e.dump <ide> puts <ide><path>Library/Homebrew/utils.rb <ide> def onoe error <ide> end <ide> <ide> def ofail error <add> onoe error <add> Homebrew.failed = true <add>end <add> <add>def odie error <ide> onoe error <ide> exit 1 <ide> end
9
PHP
PHP
add returntypewillchange attribute
e89ab5a8fec46f6e7d6ed7039dd8c518df1ed4fa
<ide><path>src/Illuminate/Bus/Batch.php <ide> use Illuminate\Support\Arr; <ide> use Illuminate\Support\Collection; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> use Throwable; <ide> <ide> class Batch implements Arrayable, JsonSerializable <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Collections/Traits/EnumeratesValues.php <ide> use Illuminate\Support\HigherOrderCollectionProxy; <ide> use Illuminate\Support\HigherOrderWhenProxy; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> use Symfony\Component\VarDumper\VarDumper; <ide> use Traversable; <ide> <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return array_map(function ($value) { <ide><path>src/Illuminate/Database/Eloquent/Casts/ArrayObject.php <ide> use ArrayObject as BaseArrayObject; <ide> use Illuminate\Contracts\Support\Arrayable; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class ArrayObject extends BaseArrayObject implements Arrayable, JsonSerializable <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->getArrayCopy(); <ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> use Illuminate\Support\Traits\ForwardsCalls; <ide> use JsonSerializable; <ide> use LogicException; <add>use ReturnTypeWillChange; <ide> <ide> abstract class Model implements Arrayable, ArrayAccess, HasBroadcastChannel, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable <ide> { <ide> public function toJson($options = 0) <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Http/Resources/Json/JsonResource.php <ide> use Illuminate\Http\Resources\ConditionallyLoadsAttributes; <ide> use Illuminate\Http\Resources\DelegatesToResource; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRoutable <ide> { <ide> public function toResponse($request) <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->resolve(Container::getInstance()->make('request')); <ide><path>src/Illuminate/Pagination/CursorPaginator.php <ide> use Illuminate\Support\Collection; <ide> use IteratorAggregate; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class CursorPaginator extends AbstractCursorPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Pagination/LengthAwarePaginator.php <ide> use Illuminate\Support\Collection; <ide> use IteratorAggregate; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, LengthAwarePaginatorContract <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Pagination/Paginator.php <ide> use Illuminate\Support\Collection; <ide> use IteratorAggregate; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Session/ArraySessionHandler.php <ide> namespace Illuminate\Session; <ide> <ide> use Illuminate\Support\InteractsWithTime; <add>use ReturnTypeWillChange; <ide> use SessionHandlerInterface; <ide> <ide> class ArraySessionHandler implements SessionHandlerInterface <ide> public function __construct($minutes) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function open($savePath, $sessionName) <ide> { <ide> return true; <ide> public function open($savePath, $sessionName) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function close() <ide> { <ide> return true; <ide> public function close() <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function read($sessionId) <ide> { <ide> if (! isset($this->storage[$sessionId])) { <ide> public function read($sessionId) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function write($sessionId, $data) <ide> { <ide> $this->storage[$sessionId] = [ <ide> public function write($sessionId, $data) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function destroy($sessionId) <ide> { <ide> if (isset($this->storage[$sessionId])) { <ide> public function destroy($sessionId) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function gc($lifetime) <ide> { <ide> $expiration = $this->calculateExpiration($lifetime); <ide><path>src/Illuminate/Session/NullSessionHandler.php <ide> <ide> namespace Illuminate\Session; <ide> <add>use ReturnTypeWillChange; <ide> use SessionHandlerInterface; <ide> <ide> class NullSessionHandler implements SessionHandlerInterface <ide> { <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function open($savePath, $sessionName) <ide> { <ide> return true; <ide> public function open($savePath, $sessionName) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function close() <ide> { <ide> return true; <ide> public function close() <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function read($sessionId) <ide> { <ide> return ''; <ide> public function read($sessionId) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function write($sessionId, $data) <ide> { <ide> return true; <ide> public function write($sessionId, $data) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function destroy($sessionId) <ide> { <ide> return true; <ide> public function destroy($sessionId) <ide> /** <ide> * {@inheritdoc} <ide> */ <add> #[ReturnTypeWillChange] <ide> public function gc($lifetime) <ide> { <ide> return true; <ide><path>src/Illuminate/Support/Fluent.php <ide> use Illuminate\Contracts\Support\Arrayable; <ide> use Illuminate\Contracts\Support\Jsonable; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class Fluent implements Arrayable, ArrayAccess, Jsonable, JsonSerializable <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Support/MessageBag.php <ide> use Illuminate\Contracts\Support\MessageBag as MessageBagContract; <ide> use Illuminate\Contracts\Support\MessageProvider; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> <ide> class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider <ide> { <ide> public function toArray() <ide> * <ide> * @return array <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->toArray(); <ide><path>src/Illuminate/Support/Stringable.php <ide> use Illuminate\Support\Traits\Macroable; <ide> use Illuminate\Support\Traits\Tappable; <ide> use JsonSerializable; <add>use ReturnTypeWillChange; <ide> use Symfony\Component\VarDumper\VarDumper; <ide> <ide> class Stringable implements JsonSerializable <ide> public function dd() <ide> * <ide> * @return string <ide> */ <add> #[ReturnTypeWillChange] <ide> public function jsonSerialize() <ide> { <ide> return $this->__toString(); <ide><path>tests/Database/DatabaseProcessorTest.php <ide> use Mockery as m; <ide> use PDO; <ide> use PHPUnit\Framework\TestCase; <add>use ReturnTypeWillChange; <ide> <ide> class DatabaseProcessorTest extends TestCase <ide> { <ide> public function __construct() <ide> // <ide> } <ide> <del> public function lastInsertId($sequence = null) <add> #[ReturnTypeWillChange] <add> public function lastInsertId(string $sequence = null) <ide> { <ide> // <ide> } <ide><path>tests/Http/HttpJsonResponseTest.php <ide> public function toJson($options = 0) <ide> <ide> class JsonResponseTestJsonSerializeObject implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return ['foo' => 'bar']; <ide> } <ide><path>tests/Http/HttpResponseTest.php <ide> public function toJson($options = 0) <ide> <ide> class JsonSerializableStub implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return ['foo' => 'bar']; <ide> } <ide><path>tests/Integration/Http/Fixtures/JsonSerializableResource.php <ide> public function __construct($resource) <ide> $this->resource = $resource; <ide> } <ide> <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return [ <ide> 'id' => $this->resource->id, <ide><path>tests/Integration/Http/JsonResponseTest.php <ide> public function testResponseWithInvalidJsonThrowsException() <ide> Route::get('/response', function () { <ide> return new JsonResponse(new class implements \JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): string <ide> { <ide> return "\xB1\x31"; <ide> } <ide><path>tests/Integration/Http/ResponseTest.php <ide> public function testResponseWithInvalidJsonThrowsException() <ide> Route::get('/response', function () { <ide> return (new Response())->setContent(new class implements \JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): string <ide> { <ide> return "\xB1\x31"; <ide> } <ide><path>tests/Support/SupportCollectionTest.php <ide> public function toJson($options = 0) <ide> <ide> class TestJsonSerializeObject implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return ['foo' => 'bar']; <ide> } <ide> } <ide> <ide> class TestJsonSerializeWithScalarValueObject implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): string <ide> { <ide> return 'foo'; <ide> } <ide><path>tests/Testing/TestResponseTest.php <ide> private function makeMockResponse($content) <ide> <ide> class JsonSerializableMixedResourcesStub implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return [ <ide> 'foo' => 'bar', <ide> public function jsonSerialize() <ide> <ide> class JsonSerializableSingleResourceStub implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return [ <ide> ['foo' => 'foo 0', 'bar' => 'bar 0', 'foobar' => 'foobar 0'], <ide> public function jsonSerialize() <ide> <ide> class JsonSerializableSingleResourceWithIntegersStub implements JsonSerializable <ide> { <del> public function jsonSerialize() <add> public function jsonSerialize(): array <ide> { <ide> return [ <ide> ['id' => 10, 'foo' => 'bar'],
21
Javascript
Javascript
fix regression on i9.pdf
b1a5ab6d0f24ab26a06bd37fbd0b37fbf2f19c3a
<ide><path>fonts.js <ide> var isWorker = (typeof window == 'undefined'); <ide> */ <ide> var kMaxWaitForFontFace = 1000; <ide> <add>// Unicode Private Use Area <add>var kCmapGlyphOffset = 0xE000; <add> <add> <ide> /** <ide> * Hold a map of decoded fonts and of the standard fourteen Type1 <ide> * fonts and their acronyms. <ide> var Font = (function Font() { <ide> encoding: null, <ide> <ide> checkAndRepair: function font_checkAndRepair(name, font, properties) { <del> // offset glyphs to the Unicode Private Use Area <del> var kCmapGlyphOffset = 0xE000; <del> <ide> function readTableEntry(file) { <ide> var tag = file.getBytes(4); <ide> tag = String.fromCharCode(tag[0]) + <ide> var Font = (function Font() { <ide> var index = font.getByte(); <ide> if (index) { <ide> deltas.push(index); <del> glyphs.push({ unicode: j }); <add> <add> var code = encoding[index]; <add> for (var glyph in properties.glyphs) { <add> if (properties.glyphs[glyph] == code) <add> break; <add> } <add> <add> glyphs.push({ glyph: glyph, unicode: j }); <ide> } <ide> } <ide> <ide> if (properties.firstChar < 0x20) { <del> var code = 0; <ide> for (var j = 0; j < glyphs.length; j++) { <ide> var glyph = glyphs[j]; <del> glyphs[j].unicode += 0x1F; <del> properties.glyphs[glyph.glyph] = encoding[++code] = glyph.unicode; <add> var code = glyph.unicode + kCmapGlyphOffset; <add> properties.glyphs[glyph.glyph] = encoding[glyph.unicode] = code; <add> glyph.unicode = code; <ide> } <ide> } <ide> <ide> var Type1Parser = function() { <ide> <ide> // Type1 only command with command not (yet) built-in ,throw an error <ide> '6': -1, // seac <del> '7': -1, //sbw <add> '7': -1, // sbw <ide> <ide> '11': 'sub', <ide> '12': 'div', <ide> var Type1Parser = function() { <ide> // moveto (this is a one shot positionning command). This is used only <ide> // with the return of an OtherSubrs call. <ide> // TODO Implement the OtherSubrs charstring embedding and replace this <del> // call by a no-op, like 2 'pop' commands for example. <del> '33': null //setcurrentpoint <add> // call by a no-op, like 2 'pop' commands for example. <add> '33': null // setcurrentpoint <ide> }, <ide> '13': 'hsbw', <ide> '14': 'endchar', <ide> var Type1Parser = function() { <ide> charstring.push('drop'); <ide> <ide> // If the flex mechanism is not used in a font program, Adobe <del> // state that that entries 0, 1 and 2 can simply be replace by <add> // states that entries 0, 1 and 2 can simply be replaced by <ide> // {}, which means that we can simply ignore them. <ide> if (index < 3) { <ide> continue; <ide> var Type1Parser = function() { <ide> command = charStringDictionary['12'][escape]; <ide> } else { <ide> // TODO Clean this code <del> if (value == 13) { //hsbw <add> if (value == 13) { // hsbw <ide> if (charstring.length == 2) { <ide> lsb = charstring[0]; <ide> width = charstring[1]; <ide> var Type1Parser = function() { <ide> var encoded = decrypt(data, kCharStringsEncryptionKey, lenIV); <ide> var str = decodeCharString(encoded); <ide> i = i + 1 + length; <del> t = getToken(); //read in 'NP' <add> t = getToken(); // read in 'NP' <ide> if (t == 'noaccess') <del> getToken(); //read in 'put' <add> getToken(); // read in 'put' <ide> program.subrs[index] = str.charstring; <ide> } <ide> break; <ide> var Type2CFF = (function() { <ide> var nominalWidth = privDict['nominalWidthX']; <ide> <ide> var charstrings = []; <del> var kCmapGlyphOffset = 0xE000; <ide> var differences = properties.differences; <ide> var index = 0; <ide> for (var i = 1; i < charsets.length; i++) { <ide><path>pdf.js <ide> var PartialEvaluator = (function() { <ide> var index = GlyphsUnicode[glyph] || i; <ide> glyphsMap[glyph] = encodingMap[i] = index; <ide> <del> var kCmapGlyphOffset = 0xE000; <ide> if (index <= 0x1f || (index >= 127 && index <= 255)) <ide> glyphsMap[glyph] = encodingMap[i] += kCmapGlyphOffset; <ide>
2
Python
Python
replace methods on state with frozenset properties
0c5bbe83c6b60965274496e68283ba0102eb1d06
<ide><path>airflow/api/common/experimental/mark_tasks.py <ide> def set_state( <ide> tis_altered += qry_sub_dag.with_for_update().all() <ide> for task_instance in tis_altered: <ide> task_instance.state = state <del> if state in State.finished(): <add> if state in State.finished: <ide> task_instance.end_date = timezone.utcnow() <ide> task_instance.set_duration() <ide> else: <ide><path>airflow/jobs/backfill_job.py <ide> def _per_task_process(task, key, ti, session=None): # pylint: disable=too-many- <ide> _dag_runs = ti_status.active_runs[:] <ide> for run in _dag_runs: <ide> run.update_state(session=session) <del> if run.state in State.finished(): <add> if run.state in State.finished: <ide> ti_status.finished_runs += 1 <ide> ti_status.active_runs.remove(run) <ide> executed_run_dates.append(run.execution_date) <ide> def _set_unfinished_dag_runs_to_failed(self, dag_runs, session=None): <ide> """ <ide> for dag_run in dag_runs: <ide> dag_run.update_state() <del> if dag_run.state not in State.finished(): <add> if dag_run.state not in State.finished: <ide> dag_run.set_state(State.FAILED) <ide> session.merge(dag_run) <ide> <ide><path>airflow/jobs/scheduler_job.py <ide> def _change_state_for_tis_without_dagrun( <ide> } <ide> <ide> # Only add end_date and duration if the new_state is 'success', 'failed' or 'skipped' <del> if new_state in State.finished(): <add> if new_state in State.finished: <ide> ti_prop_update.update({ <ide> models.TaskInstance.end_date: current_time, <ide> models.TaskInstance.duration: 0, <ide> def _do_scheduling(self, session) -> int: <ide> func.count(TI.execution_date.distinct()), <ide> ).filter( <ide> TI.dag_id.in_(list({dag_run.dag_id for dag_run in dag_runs})), <del> TI.state.notin_(State.finished()) <add> TI.state.notin_(list(State.finished)) <ide> ).group_by(TI.dag_id).all()) <ide> <ide> for dag_run in dag_runs: <ide><path>airflow/models/dagrun.py <ide> def get_state(self): <ide> def set_state(self, state): <ide> if self._state != state: <ide> self._state = state <del> self.end_date = timezone.utcnow() if self._state in State.finished() else None <add> self.end_date = timezone.utcnow() if self._state in State.finished else None <ide> <ide> @declared_attr <ide> def state(self): <ide> def update_state( <ide> for ti in tis: <ide> ti.task = dag.get_task(ti.task_id) <ide> <del> unfinished_tasks = [t for t in tis if t.state in State.unfinished()] <del> finished_tasks = [t for t in tis if t.state in State.finished() + [State.UPSTREAM_FAILED]] <add> unfinished_tasks = [t for t in tis if t.state in State.unfinished] <add> finished_tasks = [t for t in tis if t.state in State.finished | {State.UPSTREAM_FAILED}] <ide> none_depends_on_past = all(not t.task.depends_on_past for t in unfinished_tasks) <ide> none_task_concurrency = all(t.task.task_concurrency is None for t in unfinished_tasks) <ide> if unfinished_tasks: <ide><path>airflow/models/sensorinstance.py <ide> def try_number(self): <ide> database, in all other cases this will be incremented. <ide> """ <ide> # This is designed so that task logs end up in the right file. <del> if self.state in State.running(): <add> if self.state in State.running: <ide> return self._try_number <ide> return self._try_number + 1 <ide> <ide><path>airflow/models/taskinstance.py <ide> def try_number(self): <ide> """ <ide> # This is designed so that task logs end up in the right file. <ide> # TODO: whether we need sensing here or not (in sensor and task_instance state machine) <del> if self.state in State.running(): <add> if self.state in State.running: <ide> return self._try_number <ide> return self._try_number + 1 <ide> <ide> def set_state(self, state: str, session=None): <ide> self.log.debug("Setting task state for %s to %s", self, state) <ide> self.state = state <ide> self.start_date = current_time <del> if self.state in State.finished(): <add> if self.state in State.finished: <ide> self.end_date = current_time <ide> self.duration = 0 <ide> session.merge(self) <ide><path>airflow/sensors/smart_sensor_operator.py <ide> def _mark_multi_state(self, operator, poke_hash, encoded_poke_context, state, se <ide> def mark_state(ti, sensor_instance): <ide> ti.state = state <ide> sensor_instance.state = state <del> if state in State.finished(): <add> if state in State.finished: <ide> ti.end_date = end_date <ide> ti.set_duration() <ide> <ide><path>airflow/ti_deps/dep_context.py <ide> def ensure_finished_tasks(self, dag, execution_date: pendulum.DateTime, session: <ide> self.finished_tasks = dag.get_task_instances( <ide> start_date=execution_date, <ide> end_date=execution_date, <del> state=State.finished() + [State.UPSTREAM_FAILED], <add> state=State.finished | {State.UPSTREAM_FAILED}, <ide> session=session, <ide> ) <ide> return self.finished_tasks <ide><path>airflow/utils/state.py <ide> def color_fg(cls, state): <ide> return 'white' <ide> return 'black' <ide> <del> @classmethod <del> def running(cls): <del> """ <del> A list of states indicating that a task is being executed. <del> """ <del> return [ <del> cls.RUNNING, <del> cls.SENSING <del> ] <add> running = frozenset([ <add> RUNNING, <add> SENSING <add> ]) <add> """ <add> A list of states indicating that a task is being executed. <add> """ <ide> <del> @classmethod <del> def finished(cls): <del> """ <del> A list of states indicating that a task started and completed a <del> run attempt. Note that the attempt could have resulted in failure or <del> have been interrupted; in any case, it is no longer running. <del> """ <del> return [ <del> cls.SUCCESS, <del> cls.FAILED, <del> cls.SKIPPED, <del> ] <add> finished = frozenset([ <add> SUCCESS, <add> FAILED, <add> SKIPPED, <add> ]) <add> """ <add> A list of states indicating that a task started and completed a <add> run attempt. Note that the attempt could have resulted in failure or <add> have been interrupted; in any case, it is no longer running. <add> """ <ide> <del> @classmethod <del> def unfinished(cls): <del> """ <del> A list of states indicating that a task either has not completed <del> a run or has not even started. <del> """ <del> return [ <del> cls.NONE, <del> cls.SCHEDULED, <del> cls.QUEUED, <del> cls.RUNNING, <del> cls.SENSING, <del> cls.SHUTDOWN, <del> cls.UP_FOR_RETRY, <del> cls.UP_FOR_RESCHEDULE, <del> ] <add> unfinished = frozenset([ <add> NONE, <add> SCHEDULED, <add> QUEUED, <add> RUNNING, <add> SENSING, <add> SHUTDOWN, <add> UP_FOR_RETRY, <add> UP_FOR_RESCHEDULE, <add> ]) <add> """ <add> A list of states indicating that a task either has not completed <add> a run or has not even started. <add> """ <ide> <ide> <ide> class PokeState: <ide><path>tests/api/common/experimental/test_mark_tasks.py <ide> def verify_state(self, dag, task_ids, execution_dates, state, old_tis, session=N <ide> self.assertEqual(ti.operator, dag.get_task(ti.task_id).task_type) <ide> if ti.task_id in task_ids and ti.execution_date in execution_dates: <ide> self.assertEqual(ti.state, state) <del> if state in State.finished(): <add> if state in State.finished: <ide> self.assertIsNotNone(ti.end_date) <ide> else: <ide> for old_ti in old_tis: <ide><path>tests/jobs/test_scheduler_job.py <ide> def test_scheduler_loop_should_change_state_for_tis_without_dagrun(self, <ide> ti = dr.get_task_instance(task_id=op1.task_id, session=session) <ide> self.assertEqual(ti.state, expected_task_state) <ide> self.assertIsNotNone(ti.start_date) <del> if expected_task_state in State.finished(): <add> if expected_task_state in State.finished: <ide> self.assertIsNotNone(ti.end_date) <ide> self.assertEqual(ti.start_date, ti.end_date) <ide> self.assertIsNotNone(ti.duration) <ide><path>tests/ti_deps/deps/test_trigger_rule_dep.py <ide> def test_get_states_count_upstream_ti(self): <ide> finished_tasks = DepContext().ensure_finished_tasks(ti_op2.task.dag, ti_op2.execution_date, session) <ide> self.assertEqual(get_states_count_upstream_ti(finished_tasks=finished_tasks, ti=ti_op2), <ide> (1, 0, 0, 0, 1)) <del> finished_tasks = dr.get_task_instances(state=State.finished() + [State.UPSTREAM_FAILED], <add> finished_tasks = dr.get_task_instances(state=State.finished | {State.UPSTREAM_FAILED}, <ide> session=session) <ide> self.assertEqual(get_states_count_upstream_ti(finished_tasks=finished_tasks, ti=ti_op4), <ide> (1, 0, 1, 0, 2))
12
Java
Java
remove duplicate assertions in asyncexecutiontests
43a814b070c73b0d36701080cebfbc22ff8a9bc4
<ide><path>spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncExecutionTests.java <ide> public void asyncMethodListener() throws Exception { <ide> .atMost(1, TimeUnit.SECONDS) <ide> .pollInterval(10, TimeUnit.MILLISECONDS) <ide> .until(() -> listenerCalled == 1); <del> assertEquals(listenerCalled, 1); <ide> context.close(); <ide> } <ide> <ide> public void asyncClassListener() throws Exception { <ide> .atMost(1, TimeUnit.SECONDS) <ide> .pollInterval(10, TimeUnit.MILLISECONDS) <ide> .until(() -> listenerCalled == 2); <del> assertEquals(2, listenerCalled); <ide> assertEquals(1, listenerConstructed); <ide> } <ide> <ide> public void asyncPrototypeClassListener() throws Exception { <ide> .atMost(1, TimeUnit.SECONDS) <ide> .pollInterval(10, TimeUnit.MILLISECONDS) <ide> .until(() -> listenerCalled == 2); <del> assertEquals(2, listenerCalled); <ide> assertEquals(2, listenerConstructed); <ide> } <ide>
1
Javascript
Javascript
add a test case for the underlying cause
86c659ba61dd923439335b240d81b38cab407acc
<ide><path>test/parallel/test-stream-readable-no-unneeded-readable.js <ide> const common = require('../common'); <ide> const { Readable, PassThrough } = require('stream'); <ide> <del>const source = new Readable({ <del> read: () => {} <del>}); <add>function test(r) { <add> const wrapper = new Readable({ <add> read: () => { <add> let data = r.read(); <ide> <del>source.push('foo'); <del>source.push('bar'); <del>source.push(null); <del> <del>const pt = source.pipe(new PassThrough()); <del> <del>const wrapper = new Readable({ <del> read: () => { <del> let data = pt.read(); <del> <del> if (data) { <del> wrapper.push(data); <del> return; <del> } <del> <del> pt.once('readable', function() { <del> data = pt.read(); <ide> if (data) { <ide> wrapper.push(data); <add> return; <ide> } <del> // else the end event should fire <del> }); <del> } <del>}); <ide> <del>pt.once('end', function() { <del> wrapper.push(null); <del>}); <add> r.once('readable', function() { <add> data = r.read(); <add> if (data) { <add> wrapper.push(data); <add> } <add> // else the end event should fire <add> }); <add> }, <add> }); <add> <add> r.once('end', function() { <add> wrapper.push(null); <add> }); <add> <add> wrapper.resume(); <add> wrapper.once('end', common.mustCall()); <add>} <add> <add>{ <add> const source = new Readable({ <add> read: () => {} <add> }); <add> source.push('foo'); <add> source.push('bar'); <add> source.push(null); <add> <add> const pt = source.pipe(new PassThrough()); <add> test(pt); <add>} <add> <add>{ <add> // This is the underlying cause of the above test case. <add> const pushChunks = ['foo', 'bar']; <add> const r = new Readable({ <add> read: () => { <add> const chunk = pushChunks.shift(); <add> if (chunk) { <add> // synchronous call <add> r.push(chunk); <add> } else { <add> // asynchronous call <add> process.nextTick(() => r.push(null)); <add> } <add> }, <add> }); <ide> <del>wrapper.resume(); <del>wrapper.once('end', common.mustCall()); <add> test(r); <add>}
1
Javascript
Javascript
simplify arg parsing in string.write
29ec85047842dc4fc1a6127f90dc1110f7c5483e
<ide><path>lib/net_uv.js <ide> Socket.prototype.__defineGetter__('remotePort', function() { <ide> }); <ide> <ide> <del>Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) { <del> var encoding, fd, cb; <add>/* <add> * Arguments data, [encoding], [cb] <add> */ <add>Socket.prototype.write = function(data, arg1, arg2) { <add> var encoding, cb; <ide> <ide> // parse arguments <del> if (typeof arguments[3] == 'function') { <del> cb = arguments[3]; <del> fd = arguments[2]; <del> encoding = arguments[1]; <del> } else if (typeof arguments[2] == 'function') { <del> cb = arguments[2]; <del> if (typeof arguments[1] == 'number') { <del> fd = arguments[1]; <del> } else { <del> encoding = arguments[1]; <del> } <del> } else if (typeof arguments[1] == 'function') { <del> cb = arguments[1]; <del> } else { <del> if (typeof arguments[1] == 'number') { <del> fd = arguments[1]; <del> } else { <del> encoding = arguments[1]; <del> fd = arguments[2]; <add> if (arg1) { <add> switch (typeof arg1) { <add> case 'string': <add> encoding = arg1; <add> cb = arg2; <add> break; <add> <add> case 'function': <add> cb = arg1; <add> break; <add> <add> default: <add> throw new Error("bad arg"); <ide> } <ide> } <ide> <ide> Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) { <ide> if (this._connecting) { <ide> this._connectQueueSize += data.length; <ide> if (this._connectQueue) { <del> this._connectQueue.push([data, encoding, fd, cb]); <add> this._connectQueue.push([data, encoding, cb]); <ide> } else { <del> this._connectQueue = [[data, encoding, fd, cb]]; <add> this._connectQueue = [[data, encoding, cb]]; <ide> } <ide> return false; <ide> }
1
PHP
PHP
remove extra autoload file
8914be5fc864ebc6877be38ff3502997e0c62761
<ide><path>bootstrap/autoload.php <del><?php <del> <del>define('LARAVEL_START', microtime(true)); <del> <del>/* <del>|-------------------------------------------------------------------------- <del>| Register The Composer Auto Loader <del>|-------------------------------------------------------------------------- <del>| <del>| Composer provides a convenient, automatically generated class loader <del>| for our application. We just need to utilize it! We'll require it <del>| into the script here so that we do not have to worry about the <del>| loading of any our classes "manually". Feels great to relax. <del>| <del>*/ <del> <del>require __DIR__.'/../vendor/autoload.php'; <ide><path>public/index.php <ide> * @author Taylor Otwell <taylor@laravel.com> <ide> */ <ide> <add>define('LARAVEL_START', microtime(true)); <add> <ide> /* <ide> |-------------------------------------------------------------------------- <ide> | Register The Auto Loader <ide> | <ide> */ <ide> <del>require __DIR__.'/../bootstrap/autoload.php'; <add>require __DIR__.'/../vendor/autoload.php'; <ide> <ide> /* <ide> |--------------------------------------------------------------------------
2
Python
Python
fix syntax errors in the previous commit
870d73e3b12d576826b5eeedb9b0c0f3607956f6
<ide><path>celery/log.py <ide> import sys <ide> import time <ide> import logging <add>import traceback <ide> from celery.conf import LOG_FORMAT, DAEMON_LOG_LEVEL <ide> <ide> <ide> class LoggingProxy(object): <ide> mode = "w" <ide> name = None <ide> closed = False <add> loglevel = logging.INFO <ide> <del> def __init__(self, logger, loglevel=logging.INFO): <add> def __init__(self, logger, loglevel=None): <ide> self.logger = logger <del> self.loglevel = loglevel <add> self.loglevel = loglevel or self.logger.level or self.loglevel <ide> self._safewrap_handlers() <ide> <ide> def _safewrap_handlers(self): <ide> def _safewrap_handlers(self): <ide> <ide> def wrap_handler(handler): <ide> <del> class WithSafeHandleError(handler.__class__): <add> class WithSafeHandleError(logging.Handler): <ide> <ide> def handleError(self, record): <ide> exc_info = sys.exc_info()
1
Javascript
Javascript
enable some polyfills for compat with chrome 49
5d1c541702bd608d476d62bd4de051bb9b8d6171
<ide><path>src/shared/compatibility.js <ide> // Skip compatibility checks for the extensions and if we already ran <ide> // this module. <ide> if ((typeof PDFJSDev === 'undefined' || <del> !PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) && <add> !PDFJSDev.test('FIREFOX || MOZCENTRAL')) && <ide> (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked)) { <ide> <add>// In the Chrome extension, most of the polyfills are unnecessary. <add>// We support down to Chrome 49, because it's still commonly used by Windows XP <add>// users - https://github.com/mozilla/pdf.js/issues/9397 <add>if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) { <add> <ide> var globalScope = require('./global_scope'); <add> <ide> const isNodeJS = require('./is_node'); <ide> <ide> var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''; <ide> PDFJS.compatibilityChecked = true; <ide> }; <ide> })(); <ide> <del>// Provides support for Object.values in legacy browsers. <del>// Support: IE, Chrome<54 <del>(function checkObjectValues() { <del> if (Object.values) { <del> return; <del> } <del> Object.values = require('core-js/fn/object/values'); <del>})(); <del> <ide> // Provides support for Array.prototype.includes in legacy browsers. <ide> // Support: IE, Chrome<47 <ide> (function checkArrayIncludes() { <ide> PDFJS.compatibilityChecked = true; <ide> globalScope.URL = JURL; <ide> })(); <ide> <add>} // End of !PDFJSDev.test('CHROME') <add> <add>// Provides support for Object.values in legacy browsers. <add>// Support: IE, Chrome<54 <add>(function checkObjectValues() { <add> if (Object.values) { <add> return; <add> } <add> Object.values = require('core-js/fn/object/values'); <add>})(); <add> <ide> } <ide><path>src/shared/streams_polyfill.js <ide> if (typeof ReadableStream !== 'undefined') { <ide> if (isReadableStreamSupported) { <ide> exports.ReadableStream = ReadableStream; <ide> } else { <del> if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) { <del> throw new Error('ReadableStream polyfill is not found for Chrome bundle'); <del> } <ide> exports.ReadableStream = <ide> require('../../external/streams/streams-lib').ReadableStream; <ide> }
2
Go
Go
fix race on state serialization
f1975cbc7c5b551e5a206c15f32aef3d51904408
<ide><path>daemon/state.go <ide> package daemon <ide> <ide> import ( <add> "encoding/json" <ide> "fmt" <ide> "sync" <ide> "time" <ide> func (s *State) String() string { <ide> return fmt.Sprintf("Exited (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt))) <ide> } <ide> <add>type jState State <add> <add>// MarshalJSON for state is needed to avoid race conditions on inspect <add>func (s *State) MarshalJSON() ([]byte, error) { <add> s.RLock() <add> b, err := json.Marshal(jState(*s)) <add> s.RUnlock() <add> return b, err <add>} <add> <ide> func wait(waitChan <-chan struct{}, timeout time.Duration) error { <ide> if timeout < 0 { <ide> <-waitChan
1
Text
Text
add v3.18.0-beta.5 to changelog
88ec6feeb7e0150a6422abd3f63e9a1fdcab3a8f
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.18.0-beta.5 (April 7, 2020) <add> <add>- [#18857](https://github.com/emberjs/ember.js/pull/18857) [BUGFIX] Pass value through to `PROPERTY_DID_CHANGE` to avoid calling `get` when setting values for computed props <add>- [#18861](https://github.com/emberjs/ember.js/pull/18861) [BUGFIX] Update glimmer-vm to 0.50.1 to improve dev time performance. <add> <ide> ### v3.18.0-beta.4 (March 31, 2020) <ide> <ide> - [#18837](https://github.com/emberjs/ember.js/pull/18837) [BUGFIX] Fix `willDestroy` on class helpers
1
Javascript
Javascript
convert createclass caller
6b539f280d8b0ec4874671bae9c6bed80b788006
<ide><path>src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js <ide> describe('ReactDOMInput', () => { <ide> <ide> describe('assigning the value attribute on controlled inputs', function() { <ide> function getTestInput() { <del> return React.createClass({ <del> getInitialState: function() { <del> return { <del> value: this.props.value == null ? '' : this.props.value, <del> }; <del> }, <del> onChange: function(event) { <add> return class extends React.Component { <add> state = { <add> value: this.props.value == null ? '' : this.props.value, <add> }; <add> onChange = event => { <ide> this.setState({value: event.target.value}); <del> }, <del> render: function() { <add> }; <add> render() { <ide> var type = this.props.type; <ide> var value = this.state.value; <ide> <ide> return <input type={type} value={value} onChange={this.onChange} />; <del> }, <del> }); <add> } <add> }; <ide> } <ide> <ide> it('always sets the attribute when values change on text inputs', function() {
1