Skip to content

Commit 4e92c3f

Browse files
authored
Merge pull request #215 from makotok/fix-issue214
TypeDeclaration#removeOverriddenMethodDeclarationsでIllegalStateExceptionが発生する問題を修正
2 parents 935f470 + 1cb909f commit 4e92c3f

File tree

10 files changed

+276
-0
lines changed

10 files changed

+276
-0
lines changed

src/main/java/org/seasar/doma/internal/apt/decl/TypeDeclaration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ protected void removeHiddenFieldDeclarations(
286286
if (env.getElementUtils().hides(hider.getElement(),
287287
hidden.getElement())) {
288288
it.remove();
289+
break;
289290
}
290291
}
291292
}
@@ -395,6 +396,7 @@ protected void removeOverriddenMethodDeclarations(
395396
if (elements.overrides(overrider.getElement(),
396397
overridden.getElement(), overriderTypeElement)) {
397398
it.remove();
399+
break;
398400
}
399401
}
400402
}
@@ -416,6 +418,7 @@ protected void removeHiddenMethodDeclarations(
416418
if (env.getElementUtils().hides(hider.getElement(),
417419
hidden.getElement())) {
418420
it.remove();
421+
break;
419422
}
420423
}
421424
}

src/test/java/org/seasar/doma/internal/apt/dao/DaoProcessorTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,4 +1119,13 @@ public void testMultiDaoExtends() throws Exception {
11191119
assertMessage(Message.DOMA4188);
11201120
}
11211121

1122+
public void testIssue214() throws Exception {
1123+
Class<?> target = Issue214Dao.class;
1124+
DaoProcessor processor = new DaoProcessor();
1125+
addProcessor(processor);
1126+
addCompilationUnit(target);
1127+
compile();
1128+
assertTrue(getCompiledResult());
1129+
}
1130+
11221131
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
public class Issue214AbstractEntity implements Issue214EntityInterface2 {
4+
5+
public static final String SATIC_FIELD = "";
6+
7+
public final String instanceField = "";
8+
9+
public static String staticMethod() {
10+
return null;
11+
}
12+
13+
@Override
14+
public String instanceMethod() {
15+
return null;
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
public class Issue214AbstractEntity2 extends Issue214AbstractEntity {
4+
5+
public static final String SATIC_FIELD = "";
6+
7+
public final String instanceField = "";
8+
9+
public static String staticMethod() {
10+
return null;
11+
}
12+
13+
@Override
14+
public String instanceMethod() {
15+
return null;
16+
}
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
import org.seasar.doma.Dao;
4+
import org.seasar.doma.Select;
5+
6+
@Dao
7+
public interface Issue214Dao {
8+
9+
@Select
10+
Issue214Entity select(Issue214Entity entity);
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
import org.seasar.doma.Entity;
4+
5+
@Entity
6+
public class Issue214Entity extends Issue214AbstractEntity2 {
7+
8+
public static final String SATIC_FIELD = "";
9+
10+
public String instanceField = "";
11+
12+
public static String staticMethod() {
13+
return null;
14+
}
15+
16+
@Override
17+
public String instanceMethod() {
18+
return null;
19+
}
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
public interface Issue214EntityInterface {
4+
5+
String STATIC_FIELD = "";
6+
7+
static String staticMethod() {
8+
return "";
9+
}
10+
11+
String instanceMethod();
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
public interface Issue214EntityInterface2 extends Issue214EntityInterface {
4+
5+
public static final String SATIC_FIELD = "";
6+
7+
public static String staticMethod() {
8+
return null;
9+
}
10+
11+
@Override
12+
String instanceMethod();
13+
}
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
package org.seasar.doma.internal.apt.dao;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
import java.util.function.BiFunction;
6+
7+
import org.seasar.doma.jdbc.entity.AbstractEntityType;
8+
import org.seasar.doma.jdbc.entity.EntityPropertyType;
9+
import org.seasar.doma.jdbc.entity.GeneratedIdPropertyType;
10+
import org.seasar.doma.jdbc.entity.NamingType;
11+
import org.seasar.doma.jdbc.entity.PostDeleteContext;
12+
import org.seasar.doma.jdbc.entity.PostInsertContext;
13+
import org.seasar.doma.jdbc.entity.PostUpdateContext;
14+
import org.seasar.doma.jdbc.entity.PreDeleteContext;
15+
import org.seasar.doma.jdbc.entity.PreInsertContext;
16+
import org.seasar.doma.jdbc.entity.PreUpdateContext;
17+
import org.seasar.doma.jdbc.entity.Property;
18+
import org.seasar.doma.jdbc.entity.TenantIdPropertyType;
19+
import org.seasar.doma.jdbc.entity.VersionPropertyType;
20+
21+
public class _Issue214Entity extends AbstractEntityType<Issue214Entity> {
22+
23+
@Override
24+
public String getCatalogName() {
25+
26+
return null;
27+
}
28+
29+
@Override
30+
public Class<Issue214Entity> getEntityClass() {
31+
32+
return null;
33+
}
34+
35+
@Override
36+
public EntityPropertyType<Issue214Entity, ?> getEntityPropertyType(
37+
String name) {
38+
39+
return null;
40+
}
41+
42+
@Override
43+
public List<EntityPropertyType<Issue214Entity, ?>> getEntityPropertyTypes() {
44+
45+
return null;
46+
}
47+
48+
@Override
49+
public GeneratedIdPropertyType<Object, Issue214Entity, ?, ?> getGeneratedIdPropertyType() {
50+
51+
return null;
52+
}
53+
54+
@Override
55+
public List<EntityPropertyType<Issue214Entity, ?>> getIdPropertyTypes() {
56+
57+
return null;
58+
}
59+
60+
@Override
61+
public String getName() {
62+
63+
return null;
64+
}
65+
66+
@Override
67+
public Issue214Entity getOriginalStates(Issue214Entity entity) {
68+
69+
return null;
70+
}
71+
72+
@Override
73+
public String getSchemaName() {
74+
75+
return null;
76+
}
77+
78+
@Override
79+
public String getTableName() {
80+
81+
return null;
82+
}
83+
84+
@Override
85+
public String getTableName(
86+
BiFunction<NamingType, String, String> namingFunction) {
87+
88+
return null;
89+
}
90+
91+
@Override
92+
public VersionPropertyType<Object, Issue214Entity, ?, ?> getVersionPropertyType() {
93+
94+
return null;
95+
}
96+
97+
@Override
98+
public TenantIdPropertyType<Object, Issue214Entity, ?, ?> getTenantIdPropertyType() {
99+
return null;
100+
}
101+
102+
@Override
103+
public void preDelete(Issue214Entity entity,
104+
PreDeleteContext<Issue214Entity> context) {
105+
}
106+
107+
@Override
108+
public void preInsert(Issue214Entity entity,
109+
PreInsertContext<Issue214Entity> context) {
110+
}
111+
112+
@Override
113+
public void preUpdate(Issue214Entity entity,
114+
PreUpdateContext<Issue214Entity> context) {
115+
}
116+
117+
@Override
118+
public void postDelete(Issue214Entity entity,
119+
PostDeleteContext<Issue214Entity> context) {
120+
}
121+
122+
@Override
123+
public void postInsert(Issue214Entity entity,
124+
PostInsertContext<Issue214Entity> context) {
125+
}
126+
127+
@Override
128+
public void postUpdate(Issue214Entity entity,
129+
PostUpdateContext<Issue214Entity> context) {
130+
}
131+
132+
@Override
133+
public void saveCurrentStates(Issue214Entity entity) {
134+
135+
}
136+
137+
@Override
138+
public NamingType getNamingType() {
139+
return null;
140+
}
141+
142+
public static _Issue214Entity getSingletonInternal() {
143+
return null;
144+
}
145+
146+
@Override
147+
public boolean isImmutable() {
148+
return false;
149+
}
150+
151+
@Override
152+
public Issue214Entity newEntity(
153+
Map<String, Property<Issue214Entity, ?>> args) {
154+
return null;
155+
}
156+
157+
@Override
158+
public boolean isQuoteRequired() {
159+
return false;
160+
}
161+
162+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
select
2+
*
3+
from
4+
issue214
5+
where
6+
STATIC_FIELD = /* entity.STATIC_FIELD */''
7+
and
8+
instanceField = /* entity.instanceField */''
9+
and
10+
staticMethod = /* entity.staticMethod() */''
11+
and
12+
instanceMethod = /* entity.instanceMethod() */''

0 commit comments

Comments
 (0)