File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
doma-processor/src/main/java/org/seasar/doma/internal/apt Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ public class MoreElements implements Elements {
4444
4545 private final Elements elementUtils ;
4646
47+ private final Map <Class <?>, TypeElement > typeElementCache = new HashMap <>(64 );
48+
4749 public MoreElements (Context ctx , ProcessingEnvironment env ) {
4850 assertNotNull (ctx , env );
4951 this .ctx = ctx ;
@@ -200,15 +202,16 @@ public TypeElement getTypeElementFromBinaryName(String binaryName) {
200202 return getEnclosedTypeElement (topElement , Arrays .asList (parts ).subList (1 , parts .length ));
201203 }
202204 try {
203- return elementUtils . getTypeElement (binaryName );
205+ return getTypeElement (binaryName );
204206 } catch (NullPointerException ignored ) {
205207 return null ;
206208 }
207209 }
208210
209211 public TypeElement getTypeElement (Class <?> clazz ) {
210212 assertNotNull (clazz );
211- return elementUtils .getTypeElement (clazz .getCanonicalName ());
213+ return typeElementCache .computeIfAbsent (
214+ clazz , k -> elementUtils .getTypeElement (k .getCanonicalName ()));
212215 }
213216
214217 private TypeElement getEnclosedTypeElement (TypeElement typeElement , List <String > enclosedNames ) {
Original file line number Diff line number Diff line change @@ -160,12 +160,7 @@ public TypeElement toTypeElement(TypeMirror typeMirror) {
160160 if (element == null ) {
161161 return null ;
162162 }
163- TypeElement typeElement = ctx .getMoreElements ().toTypeElement (element );
164- if (typeElement == null ) {
165- return null ;
166- }
167- // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544288
168- return ctx .getMoreElements ().getTypeElement (typeElement .getQualifiedName ());
163+ return ctx .getMoreElements ().toTypeElement (element );
169164 }
170165
171166 public DeclaredType toDeclaredType (TypeMirror typeMirror ) {
You can’t perform that action at this time.
0 commit comments