{"id":335562,"date":"2022-07-11T09:00:26","date_gmt":"2022-07-11T09:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=335562"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=335562","title":{"rendered":"<span>\u041a\u0430\u043a \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u043b switch exhaustiveness checker \u0434\u043b\u044f Java 8<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 C#, Kotlin \u0438 Java \u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <i>switch exhaustiveness<\/i> \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: <i>sealed classes, records \u0438 enums<\/i>. \u042f \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <a href=\"https:\/\/www.infoq.com\/articles\/data-oriented-programming-java\/\" rel=\"nofollow noopener noreferrer\">Data Oriented Programming<\/a>. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a Java 11, \u0433\u0434\u0435 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c switch exhaustiveness \u0434\u043b\u044f Enums \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Java 8 \u0438 \u0432\u044b\u0448\u0435.<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  <b>TL;DR<\/b> \u042f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043a \u043f\u0440\u043e\u0435\u0442\u043a\u0430\u043c \u043d\u0430 maven \u0438 gradle. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442 \u2014 <a href=\"https:\/\/github.com\/Hixon10\/switch-exhaustiveness-checker\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/Hixon10\/switch-exhaustiveness-checker<\/a>.<\/p>\n<h2>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0451?<\/h2>\n<p>  \u041a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432\u0435\u0442\u043a\u0438 switch \u043f\u043e\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e Enum? \u041c\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043b\u044e\u0441\u0430\u043c\u0438 \u0438 \u043c\u0438\u043d\u0443\u0441\u0430\u043c\u0438:<\/p>\n<ol>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/checkstyle\/checkstyle\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/checkstyle\/checkstyle<\/a>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 CI, \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043f\u0430\u0434\u0430\u043b, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043e\u043a\u0440\u044b\u0442\u044b\u0435 switch-\u0431\u0440\u0430\u043d\u0447\u0438. <b>\u041f\u043b\u044e\u0441<\/b> \u2014 \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043e \u043d\u0430\u0441, \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. <b>\u041c\u0438\u043d\u0443\u0441<\/b> \u2014 \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u043c \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0434\u043e CI (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e). \u0415\u0449\u0435 \u2014 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043d\u0430 \u043c\u0435\u043b\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0433\u0434\u0435 \u0442\u043e\u0436\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0431\u0435\u0437\u0430\u043f\u0430\u0441\u0442\u043d\u043e.<\/li>\n<li>\u041f\u0438\u0441\u0430\u0442\u044c unit tests \u0434\u043b\u044f switch \u0441 enums, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0431\u0440\u0430\u043d\u0447\u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u044b. <b>\u041f\u043b\u044e\u0441<\/b> \u2014 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. <b>\u041c\u0438\u043d\u0443\u0441<\/b> \u2014 \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0434\u043d\u043e \u0438 \u0432\u0440\u0435\u043c\u044f\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u044f\u0437\u044b\u043a\u043e\u0432. <b>\u041f\u043b\u044e\u0441<\/b> \u2014 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 developer experience \u0438\u0437 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u043f\u0446\u0438\u0439. <b>\u041c\u0438\u043d\u0443\u0441<\/b> \u2014 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c.<\/li>\n<\/ol>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f, \u043d\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043a\u0443\u0447\u0443 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u044f \u043e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h2>\u041f\u0435\u0440\u0432\u0430\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u2014 \u0410\u043d\u0430\u043b\u0438\u0437 \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0430 \u0432 class-files<\/h2>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041e\u0431\u044b\u0447\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u044f \u0434\u0435\u043b\u0430\u044e \u0447\u0442\u043e-\u0442\u043e \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435, \u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e, \u043a\u0443\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f. \u0422\u0443\u0442 \u0436\u0435 \u0432\u044b\u0448\u043b\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0430\u0447\u0435. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u0440\u0435\u0434\u043a\u043e \u043f\u0438\u0448\u0443 \u0447\u0442\u043e-\u0442\u043e \u0432\u043e\u043a\u0440\u0443\u0433 \u0430\u043d\u0438\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u0442\u044c \u0441\u0435\u0440\u044b\u0435 \u043f\u044f\u0442\u043d\u0430 \u0432 \u0437\u043d\u0430\u043d\u0438\u044f\u0445.<\/p>\n<p>  \u042f \u043d\u0430\u0447\u0430\u043b \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0431\u0430\u0439\u0442\u043e\u043a\u043e\u0434\u0430 \u0438\u0437 class-\u0444\u0430\u0439\u043b\u043e\u0432, \u0438 \u043f\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438\u0445. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <i>gradle\/maven<\/i> \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u042f \u0432\u0437\u044f\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e <a href=\"https:\/\/asm.ow2.io\/\" rel=\"nofollow noopener noreferrer\">https:\/\/asm.ow2.io\/<\/a>, \u0438 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c. <\/p>\n<p>  \u0427\u0442\u043e \u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ASM \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438? \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043c\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043f\u043e\u0442\u043e\u043c \u0441\u043c\u043e\u0433\u0443 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c. \u0422\u043e \u0435\u0441\u0442\u044c, \u044f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code class=\"java\">  public example1(Ljava\/math\/RoundingMode;)V    L0     LINENUMBER 44 L0     GETSTATIC Person$1.$SwitchMap$java$math$RoundingMode : [I     ALOAD 1     INVOKEVIRTUAL java\/math\/RoundingMode.ordinal ()I     IALOAD     TABLESWITCH       1: L1       2: L2       3: L3       4: L4       5: L5       6: L6       7: L7       8: L7       default: L7 <\/code><\/pre>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e. \u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435:<\/p>\n<pre><code class=\"java\">public String[] getDisassembledViewOfClass(InputStream inputStream) {     try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {         CustomTraceClassVisitor classVisitor = new CustomTraceClassVisitor(null, new Textifier(), new PrintWriter(out, true));         new ClassReader(inputStream).accept(classVisitor, 0);         return out.toString(\"UTF-8\").split(\"\\n\");     } catch (Exception e) {         System.out.println(\"[ERROR]: getDisassembledViewOfClass(): got exception: e=\" + e.getMessage());         throw new RuntimeException(e);     } } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 <i>getDisassembledViewOfClass(..)<\/i> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u0438\u043c \u043a\u043b\u0430\u0441\u0441-\u0444\u0430\u0439\u043b\u0430, \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0435\u0433\u043e, \u0432\u044b\u0437\u0432\u0430\u044f \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u043d\u0430\u0448 Visitor. \u041d\u0438\u0447\u0435\u0433\u043e \u0445\u0438\u0442\u0440\u043e\u0433\u043e, \u0437\u0430 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c 2 \u0432\u0435\u0449\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0435 \u0437\u043d\u0430\u043b \u043f\u0440\u043e switch \u0432 java:  <\/p>\n<ol>\n<li>\u0412 \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0435 switch \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u2014 \u043b\u0438\u0431\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <i>TABLESWITCH \u0438 INVOKEVIRTUAL<\/i>.<\/li>\n<li>\u0414\u043b\u044f <i>TABLESWITCH<\/i> \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0435\u0439\u043a\u043e\u0432\u044b\u0435 \u0432\u0435\u0442\u043a\u0438 \u0432 \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0435, \u0434\u043b\u044f \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0446\u0435\u043b\u0435\u0439 \u2014 <a href=\"https:\/\/github.com\/openjdk\/jdk\/blob\/master\/src\/java.xml\/share\/classes\/com\/sun\/org\/apache\/bcel\/internal\/generic\/SWITCH.java#L85\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/openjdk\/jdk\/blob\/master\/src\/java.xml\/share\/classes\/com\/sun\/org\/apache\/bcel\/internal\/generic\/SWITCH.java#L85<\/a>.<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u0432\u043e\u043b\u043d\u0443\u0435\u0442? \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u0434\u0432\u0430 switch statements, \u0447\u0442\u043e \u0431\u0430\u0439\u0442\u043a\u043e\u0434 \u0443 \u043d\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439, \u0430 Java-\u043a\u043e\u0434 \u2014 \u0440\u0430\u0437\u043d\u044b\u0439, \u043f\u0440\u0438\u0447\u0451\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u044b \u0432\u0441\u0435 switch-\u0432\u0435\u0442\u043a\u0438, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u2014 \u043d\u0435\u0442. \u0422\u043e \u0435\u0441\u0442\u044c, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0443 \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e, \u043f\u043e\u043a\u0440\u044b\u043b \u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0435 Enum-\u0432\u0435\u0442\u043a\u0438, \u0438\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u0432\u0435\u0442\u043e\u043a \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <i>example1() \u0438 example2()<\/i> \u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e <b>case HALF_EVEN<\/b> \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 <i>example1(..)<\/i>, \u043d\u043e \u0432 \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0435 \u0432\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<pre><code class=\"java\">public void example1(RoundingMode roundingMode) {     switch (roundingMode) {         case UP:             break;         case DOWN:             break;         case CEILING:             break;         case FLOOR:             break;         case HALF_UP:             System.out.println(\"Q\");             break;         case HALF_DOWN:             break;         case HALF_EVEN:         case UNNECESSARY:         default:             System.out.println(\"Default\");             break;     } }  public void example2(RoundingMode roundingMode) {     switch (roundingMode) {         case UP:             break;         case DOWN:             break;         case CEILING:             break;         case FLOOR:             break;         case HALF_UP:             System.out.println(\"Q\");             break;         case HALF_DOWN:             break;         case UNNECESSARY:         default:             System.out.println(\"Default\");             break;     } } <\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0445\u043e\u0447\u0443 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435. <\/p>\n<h2>\u0412\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u2014 \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439<\/h2>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. Java \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0443\u0447\u0443 \u043c\u0435\u0442\u0430-\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u043e\u0434\u0435 \u0447\u0435\u0440\u0435\u0437 API \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u042f \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0438\u0442 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u0431\u0440\u0430\u043d\u0447\u0438 \u0441\u0432\u0438\u0442\u0447\u0435\u0439 \u0434\u043b\u044f Enums \u043f\u043e\u043a\u0440\u044b\u0442\u044b. <\/p>\n<p>  \u042f \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0432\u043e\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <b>@SwitchExhaustive<\/b>, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u0438\u0442\u0447 statements \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439:<\/p>\n<pre><code class=\"java\">... MethodTree methodTree = trees.getTree(method); BlockTree blockTree = methodTree.getBody();  for (StatementTree statementTree : blockTree.getStatements()) {     if (statementTree.getKind() == Tree.Kind.SWITCH) {         SwitchTree switchTree = (SwitchTree) statementTree;         ExpressionTree switchTreeExpression = switchTree.getExpression();         \/\/ \u0422\u0443\u0442 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0436\u0435 \u0442\u0438\u043f \u0443 switchTreeExpression, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Enum     } } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0436, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0435 \u0437\u043d\u0430\u043b \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0442\u0435\u043b\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c:<\/p>\n<blockquote><p>Annotation processing occurs at a specific point in the timeline of a compilation, after all source files and classes specified on the command line have been read, and analyzed for the types and members they contain, but before the contents of any method bodies have been analyzed.  <\/p><\/blockquote>\n<p>  \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u0433\u0440\u0443\u0441\u0442\u043d\u044b\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0432\u044b\u0432\u043e\u0434. \u041a\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f switch, \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u043b `null` (\u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u0435\u0433\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e) \u2014 <a href=\"https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/api\/jdk.compiler\/com\/sun\/source\/util\/TreePath.html#getPath(com.sun.source.tree.CompilationUnitTree,com.sun.source.tree.Tree)\" rel=\"nofollow noopener noreferrer\">TreePath.getPath(compilationUnit, switchTreeExpression)<\/a>.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u044f \u0443\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u0447\u0430\u0438\u043b\u0441\u044f \u0438 \u0434\u0443\u043c\u0430\u043b \u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0449\u0430\u0445:  <\/p>\n<ul>\n<li>\u0420\u0435\u0448\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u2014 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0438 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0451.<\/li>\n<li>\u041f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u0443 \u0438\u043b\u0438 \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0440\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e resolve \u0442\u0438\u043f\u0430 \u0438\u0437 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 IDEA. \u0421\u0440\u0430\u0437\u0443 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043c\u043e\u0435\u0439, \u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u044e\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f.<\/li>\n<li>\u041f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u043c\u043e\u0449\u0438 \u0443 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u043b\u0435\u0433\u043a\u043e\u043c\u0443 \u0441\u043e\u0432\u0435\u0442\u0443 \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u043e\u0432\u0435\u0442\u0430 \u043d\u0430 <a href=\"https:\/\/stackoverflow.com\/a\/72826653\/1756750\" rel=\"nofollow noopener noreferrer\">SO<\/a>. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0442\u0430\u043c \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0438.<\/p>\n<h2>\u0423\u0434\u0430\u0447\u043d\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u2014 \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0445\u0430\u043a\u043e\u043c.<\/h2>\n<p>  \u0420\u0430\u0431\u043e\u0447\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 switch-\u0431\u0440\u0430\u043d\u0447\u0435\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u041f\u041e\u0420\u0410. <\/p>\n<p>  \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e <i>TaskListener<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0435\u0432\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"java\">public class SwitchExhaustiveCheckerProcessor extends AbstractProcessor {     @Override     public synchronized void init(ProcessingEnvironment processingEnv) {         \/\/ ...         JavacTask.instance(processingEnv).addTaskListener(analyzeTaskListener);     }     \/\/ ... } <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0436\u0434\u0430\u0442\u044c <b>TaskEvent.Kind.ANALYZE<\/b> \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437 switch \u0434\u043b\u044f \u043d\u0438\u0445:<\/p>\n<pre><code class=\"java\">class AnalyzeTaskListener implements TaskListener {     \/\/ ...     @Override     public void finished(final TaskEvent e) {         if (e.getKind() != TaskEvent.Kind.ANALYZE) {             return;         }         processor.handleAnalyzedType(e.getTypeElement(), e.getCompilationUnit());     } } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u044f \u0442\u043e\u0436\u0435 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u041f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 <i>Listener<\/i> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f top-level \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u043e \u043d\u0435 \u0434\u043b\u044f inner \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0446\u0435\u043b\u0443\u044e \u043f\u0430\u0447\u043a\u0443 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439, \u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u0435\u043d\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h2>\u041f\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  \u042d\u0442\u043e \u0437\u0430\u0431\u0430\u0432\u043d\u043e, \u043d\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u0435\u0435 \u043c\u043d\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u0442\u0443\u0442 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c \u0437\u0430\u0434\u0430\u0447\u0438:  <\/p>\n<ul>\n<li>\u0418\u0437 java-\u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u043c \u0434\u043e\u043a\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 (testcontainers), \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c\u0438.<\/li>\n<li>\u041f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u0430\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c javac. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043d\u0430\u0434\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0448.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u0437 java-\u0442\u0435\u0441\u0442\u0430 \u0441\u0440\u0430\u0437\u0443 \u044d\u043a\u0437\u0435\u043c\u043b\u044f\u0440 java-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c \u0442\u0443\u0442 \u043d\u0435 \u0432\u0438\u0436\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0448\u0435\u043b \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0443\u0442\u0438.<\/li>\n<\/ul>\n<p>  \u042f \u043f\u043e\u043b\u043e\u0436\u0438\u043b \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0438\u0431\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u043b\u0438\u0431\u043e \u043d\u0435\u0442. \u0418\u0437 java-\u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0435\u0442 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043a\u043e\u0434\/\u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. <\/p>\n<pre><code class=\"java\">JavaFileObject file = new JavaSourceFromString(className, classLines);  JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector&lt;JavaFileObject> diagnostics = new DiagnosticCollector&lt;>(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singletonList(tempDir.getRoot()));  Iterable&lt;? extends JavaFileObject> compilationUnits = Collections.singletonList(file); JavaCompiler.CompilationTask compilerTask = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits); compilerTask.setProcessors(Collections.singletonList(new SwitchExhaustiveCheckerProcessor())); boolean ok = compilerTask.call(); <\/code><\/pre>\n<h2>\u041f\u0440\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u043e\u043b\u043e\u043c\u043a\u0438 \u2014 \u0432\u0435\u0440\u0441\u0438\u044f gradle\/maven, \u0432\u0435\u0440\u0441\u0438\u044f Java, \u043d\u0430\u043b\u0438\u0447\u0438\u0435 Lombok, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Spring, \u0438 \u0442\u0434. \u041f\u043e\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435:<\/p>\n<ul>\n<li>Java 8, 11, 17<\/li>\n<li>\u041a\u0430\u043a gradle, \u0442\u0430\u043a \u0438 maven<\/li>\n<li>\u041a\u0430\u043a \u0441 lombok, \u0442\u0430\u043a \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e<\/li>\n<li>\u0421\u043e spring<\/li>\n<\/ul>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0442\u0430\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0430 \u0437\u0430\u0447\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 Github Actions \u0443\u0436\u0435 \u0434\u0430\u0451\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0440\u0435\u0434\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0435\u043c\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 Java, \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Job. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0433\u0440\u044f\u0437\u043d\u043e\u0435, \u0441 \u043a\u0443\u0447\u0435\u0439 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430, \u043d\u043e \u0437\u0430\u0442\u043e \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0430 <a href=\"https:\/\/github.com\/Hixon10\/switch-exhaustiveness-checker\/blob\/main\/.github\/workflows\/ci.yaml\" rel=\"nofollow noopener noreferrer\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>, \u0430 \u0442\u0443\u0442 \u043a\u0443\u0441\u043e\u0447\u0435\u043a: <\/p>\n<pre><code class=\"plaintext\">integrationtests-jdk-11-gradle:   runs-on: ubuntu-18.04   steps:     - uses: actions\/checkout@v3     - name: Set up JDK 11       uses: actions\/setup-java@v2       with:         java-version: '11'         distribution: 'adopt'     - name: Run integration test - Java 11 + Spring + Gradle + Should Succeed       run: cd .\/integration-tests\/java11-gradle-spring-success &amp;&amp; .\/gradlew clean test -i       id: java11-gradle-spring-success     - name: Run integration test - Java 11 + Spring + Gradle + Should Fail       run: cd .\/integration-tests\/java11-gradle-spring-fail &amp;&amp; .\/gradlew clean test -i       id: java11-gradle-spring-fail       continue-on-error: true     - name: Check on failures       if: steps.java11-gradle-spring-fail.outcome != 'failure'       run: exit 1 <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e Github Actions \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0433\u0430, \u0447\u0442\u043e \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430<\/h2>\n<p>  \u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043c\u0430\u0441\u0441\u0443 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0443\u0436\u0435 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432. \u041d\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u0447\u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0448\u0442\u0443\u043a\u0443, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0448\u043b\u0438\u0442\u0435 \u0431\u0430\u0433\u0438 \u0438 \u0444\u0438\u0447\u0430 \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b, \u0438 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0445 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/676182\/\"> https:\/\/habr.com\/ru\/post\/676182\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 C#, Kotlin \u0438 Java \u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <i>switch exhaustiveness<\/i> \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: <i>sealed classes, records \u0438 enums<\/i>. \u042f \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <a href=\"https:\/\/www.infoq.com\/articles\/data-oriented-programming-java\/\" rel=\"nofollow noopener noreferrer\">Data Oriented Programming<\/a>. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a Java 11, \u0433\u0434\u0435 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c switch exhaustiveness \u0434\u043b\u044f Enums \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Java 8 \u0438 \u0432\u044b\u0448\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-335562","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=335562"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335562\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}