File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/main/java/org/apache/ibatis/type Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 3
3
import org .apache .ibatis .io .ResolverUtil ;
4
4
5
5
import java .lang .annotation .Annotation ;
6
+ import java .lang .reflect .Modifier ;
6
7
import java .math .BigDecimal ;
7
8
import java .math .BigInteger ;
8
9
import java .util .Date ;
@@ -184,13 +185,15 @@ public void register(String packageName) {
184
185
ResolverUtil <Class <?>> resolverUtil = new ResolverUtil <Class <?>>();
185
186
resolverUtil .find (new ResolverUtil .IsA (TypeHandler .class ), packageName );
186
187
Set <Class <? extends Class <?>>> handlerSet = resolverUtil .getClasses ();
187
-
188
188
for (Class <?> type : handlerSet ) {
189
- try {
190
- TypeHandler handler = (TypeHandler ) type .getConstructor ().newInstance ();
191
- register (handler );
192
- } catch (Exception e ) {
193
- throw new RuntimeException ("Unable to find a usable constructor for " + type , e );
189
+ //Ignore inner classes and interfaces (including package-info.java) and abstract classes
190
+ if (!type .isAnonymousClass () && !type .isInterface () && !Modifier .isAbstract (type .getModifiers ())) {
191
+ try {
192
+ TypeHandler handler = (TypeHandler ) type .getConstructor ().newInstance ();
193
+ register (handler );
194
+ } catch (Exception e ) {
195
+ throw new RuntimeException ("Unable to find a usable constructor for " + type , e );
196
+ }
194
197
}
195
198
}
196
199
}
You can’t perform that action at this time.
0 commit comments