Skip to content

Commit bd6efa8

Browse files
committed
Issue #23.
1 parent 304a7be commit bd6efa8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public boolean isAbstract() {
120120
}
121121

122122
protected MClassRef<NType, NClass> createClassRef(Class<?> _class) {
123-
return new CMClassRef<NType, NClass>(getClazz(_class),
123+
return new CMClassRef<NType, NClass>(getClazz(_class), _class,
124124
getPackage(_class), getContainer(_class), getLocalName(_class));
125125
}
126126

@@ -137,8 +137,9 @@ protected MClassRef<NType, NClass> getTypeInfo(CClassRef info) {
137137
}
138138

139139
protected MClassRef<NType, NClass> createClassRef(CClassRef info) {
140-
return new CMClassRef<NType, NClass>(getClazz(info), getPackage(info),
141-
getContainer(info), getLocalName(info));
140+
final NClass targetType = getClazz(info);
141+
return new CMClassRef<NType, NClass>(targetType, loadClass(targetType),
142+
getPackage(info), getContainer(info), getLocalName(info));
142143
}
143144

144145
@Override
@@ -391,4 +392,14 @@ protected MClassTypeInfo<NType, NClass> createBaseTypeInfo(CClassInfo info) {
391392
return null;
392393
}
393394
}
395+
396+
@Override
397+
protected Class<?> loadClass(NType referencedType) {
398+
final String name = referencedType.fullName();
399+
try {
400+
return Class.forName(name);
401+
} catch (ClassNotFoundException cnfex) {
402+
return null;
403+
}
404+
}
394405
}

0 commit comments

Comments
 (0)