Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java @ 8244:10d37f893471
Fixed import generation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 06 Mar 2013 18:27:57 +0100 |
parents | c8e1c5abf6ed |
children | 67bee207f20c |
comparison
equal
deleted
inserted
replaced
8243:d81ff782fa1a | 8244:10d37f893471 |
---|---|
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 public void visitAnnotation(AnnotationMirror e) { | 360 public void visitAnnotation(AnnotationMirror e) { |
361 addImport(e.getAnnotationType()); | 361 addImport(e.getAnnotationType()); |
362 if (!e.getElementValues().isEmpty()) { | |
363 Map<? extends ExecutableElement, ? extends AnnotationValue> values = e.getElementValues(); | |
364 Set<? extends ExecutableElement> methodsSet = values.keySet(); | |
365 List<ExecutableElement> methodsList = new ArrayList<>(); | |
366 for (ExecutableElement method : methodsSet) { | |
367 if (values.get(method) == null) { | |
368 continue; | |
369 } | |
370 methodsList.add(method); | |
371 } | |
372 | |
373 for (int i = 0; i < methodsList.size(); i++) { | |
374 AnnotationValue value = values.get(methodsList.get(i)); | |
375 visitAnnotationValue(value); | |
376 } | |
377 } | |
378 } | |
379 | |
380 public void visitAnnotationValue(AnnotationValue e) { | |
381 e.accept(new AnnotationValueReferenceVisitor(), null); | |
382 } | |
383 | |
384 private class AnnotationValueReferenceVisitor extends AbstractAnnotationValueVisitor7<Void, Void> { | |
385 | |
386 @Override | |
387 public Void visitBoolean(boolean b, Void p) { | |
388 return null; | |
389 } | |
390 | |
391 @Override | |
392 public Void visitByte(byte b, Void p) { | |
393 return null; | |
394 } | |
395 | |
396 @Override | |
397 public Void visitChar(char c, Void p) { | |
398 return null; | |
399 } | |
400 | |
401 @Override | |
402 public Void visitDouble(double d, Void p) { | |
403 return null; | |
404 } | |
405 | |
406 @Override | |
407 public Void visitFloat(float f, Void p) { | |
408 return null; | |
409 } | |
410 | |
411 @Override | |
412 public Void visitInt(int i, Void p) { | |
413 return null; | |
414 } | |
415 | |
416 @Override | |
417 public Void visitLong(long i, Void p) { | |
418 return null; | |
419 } | |
420 | |
421 @Override | |
422 public Void visitShort(short s, Void p) { | |
423 return null; | |
424 } | |
425 | |
426 @Override | |
427 public Void visitString(String s, Void p) { | |
428 return null; | |
429 } | |
430 | |
431 @Override | |
432 public Void visitType(TypeMirror t, Void p) { | |
433 addImport(t); | |
434 return null; | |
435 } | |
436 | |
437 @Override | |
438 public Void visitEnumConstant(VariableElement c, Void p) { | |
439 addImport(c.asType()); | |
440 return null; | |
441 } | |
442 | |
443 @Override | |
444 public Void visitAnnotation(AnnotationMirror a, Void p) { | |
445 ReferenceCollector.this.visitAnnotation(a); | |
446 return null; | |
447 } | |
448 | |
449 @Override | |
450 public Void visitArray(List<? extends AnnotationValue> vals, Void p) { | |
451 for (int i = 0; i < vals.size(); i++) { | |
452 ReferenceCollector.this.visitAnnotationValue(vals.get(i)); | |
453 } | |
454 return null; | |
455 } | |
362 } | 456 } |
363 | 457 |
364 @Override | 458 @Override |
365 public void visitImport(CodeImport e, Void p) { | 459 public void visitImport(CodeImport e, Void p) { |
366 } | 460 } |