Uploaded image for project: 'S2Container'
  1. S2Container
  2. CONTAINER-284

[S2Container] 継承元クラスと派生クラスに同名のフィールドがあると PropertyInterType で例外が発生する問題を修正しました.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.30
    • Fix Version/s: 2.4.31
    • Component/s: S2Container
    • Labels:
      None

      Description

      継承元と継承先のクラスが同名のフィールドを持っている場合、継承先のクラスに対してPropertyInterTypeを適用すると、同じ名前のgetter/setterを複数回作成しようとして例外になります。

      再現例は以下です。

      public class Test {
      public static class Aaa

      { public String someProperty; }

      public static class Bbb extends Aaa { public String someProperty; }

      public static void main(String[] args) {
      AspectWeaver weaver = new AspectWeaver(Bbb.class, Collections
      .emptyMap());
      weaver.setInterTypes(new InterType[]

      { new PropertyInterType() }

      );
      weaver.generateClass();
      }
      }

      Exception in thread "main" org.seasar.framework.exception.CannotCompileRuntimeException: [ESSR0017]例外が発生しました。理由はjavassist.bytecode.DuplicateMemberException: duplicate method: getSomeProperty in com.openknow.viewer.server.Test$Bbb$$EnhancedByS2AOP$$cdedfd
      at org.seasar.framework.aop.intertype.AbstractInterType.addMethod(AbstractInterType.java:547)
      at org.seasar.framework.aop.intertype.AbstractInterType.addMethod(AbstractInterType.java:381)
      at org.seasar.framework.aop.intertype.PropertyInterType.createGetter(PropertyInterType.java:214)
      at org.seasar.framework.aop.intertype.PropertyInterType.introduce(PropertyInterType.java:175)
      at org.seasar.framework.aop.intertype.AbstractInterType.introduce(AbstractInterType.java:62)
      at org.seasar.framework.aop.javassist.EnhancedClassGenerator.applyInterType(EnhancedClassGenerator.java:102)
      at org.seasar.framework.aop.javassist.AspectWeaver.setInterTypes(AspectWeaver.java:158)
      at com.openknow.viewer.server.Test.main(Test.java:29)
      Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: getSomeProperty in com.openknow.viewer.server.Test$Bbb$$EnhancedByS2AOP$$cdedfd
      at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:552)
      at javassist.bytecode.ClassFile.addMethod(ClassFile.java:532)
      at javassist.CtClassType.addMethod(CtClassType.java:1170)
      at org.seasar.framework.aop.intertype.AbstractInterType.addMethod(AbstractInterType.java:545)
      ... 7 more

        Attachments

          Activity

            People

            • Assignee:
              koichik koichik
              Reporter:
              kaiseh kaiseh
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: