-JSR245のMLへ投稿
JSR245のMLへ投稿しました。昨日の議論です。
...(長文なので前略) I suggest that Using only interfaces(this is Eclipse's way), see below. API2.1 -------------------------------------------------------------------- public interface InterfaceAPI21 { void someInterfaceMethod(); } API2.2--------------------------------------------------------------------- public interface InterfaceAPI22 { /*or InterfaceAPI22 extends InterfaceAPI21*/ void anotherInterfaceMethod(); } Impl2.1-------------------------------------------------------------------- public class InterfaceAPI21Impl implements InterfaceAPI21 { public void someInterfaceMethod() { // implement here } } Impl2.2-------------------------------------------------------------------- [case1 all new implementation] public class InterfaceAPI22Impl implements InterfaceAPI21, InterfaceAPI22 { public void someInterfaceMethod() { // implement here } public void anotherInterfaceMethod() { // implement here } } [case 2 using old implementation] public class InterfaceAPI22Impl extends InterfaceAPI21Impl implements InterfaceAPI22 { public void anotherInterfaceMethod() { // implement here } } Container2.2's internal use-------------------------------------------------- [case1 needs backward compatible] public void container22Code(InterfaceAPI21 api21) { api21.someInterfaceMethod(); if(api21 instanceof InterfaceAPI22) { ((InterfaceAPI22)api21).anotherInterfaceMethod(); } } [case2 all new implmentation] public void container22Code(InterfaceAPI22 api22) { api22.someInterfaceMethod(); api22.anotherInterfaceMethod(); }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-