[CONTAINER-284] [S2Container] 継承元クラスと派生クラスに同名のフィールドがあると PropertyInterType で例外が発生する問題を修正しました. Created: 17/Oct/08  Updated: 17/Oct/08  Resolved: 17/Oct/08

Status: Resolved
Project: S2Container
Component/s: S2Container
Affects Version/s: 2.4.30
Fix Version/s: 2.4.31

Type: Bug Priority: Minor
Reporter: kaiseh Assignee: koichik
Resolution: Fixed Votes: 0
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



 Comments   
Comment by koichik [ 17/Oct/08 ]

対応しました.
http://svn.seasar.org/browse/?view=rev&root=s2container&revision=3991

Comment by koichik [ 17/Oct/08 ]

SNAPSHOT をデプロイしました.

http://maven.seasar.org/maven2-snapshot/org/seasar/container/s2-framework/2.4.31-SNAPSHOT/s2-framework-2.4.31-20081017.142438-3.jar
http://maven.seasar.org/maven2-snapshot/org/seasar/container/s2-extension/2.4.31-SNAPSHOT/s2-extension-2.4.31-20081017.142438-3.jar
http://maven.seasar.org/maven2-snapshot/org/seasar/container/s2-tiger/2.4.31-SNAPSHOT/s2-tiger-2.4.31-20081017.142740-3.jar

Generated at Sat Aug 24 18:11:52 JST 2019 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.