src/share/classes/com/sun/tools/apt/comp/Apt.java

Print this page




 440                     } catch (Exception e ) {
 441                         bark.aptWarning("FactoryCantInstantiate", working.getName());
 442                     } catch(Throwable t) {
 443                         throw new AnnotationProcessingError(t);
 444                     }
 445                 }
 446             }
 447 
 448             if (unmatchedAnnotations.size() > 0)
 449                 bark.aptWarning("AnnotationsWithoutProcessors", unmatchedAnnotations);
 450 
 451             Set<AnnotationProcessor> processors = new LinkedHashSet<AnnotationProcessor>();
 452 
 453             // If there were no source files AND no factory matching "*",
 454             // make sure the usage message is printed
 455             if (spectypedecls.size() == 0 &&
 456                 factoryToAnnotation.keySet().size() == 0 )
 457                 throw new UsageMessageNeededException();
 458 
 459             try {
 460                 for(AnnotationProcessorFactory apFactory: factoryToAnnotation.keySet()) {
 461                     AnnotationProcessor processor = apFactory.getProcessorFor(factoryToAnnotation.get(apFactory),


 462                                                                               trivAPE);
 463                     if (processor != null)
 464                         processors.add(processor);
 465                     else
 466                         bark.aptWarning("NullProcessor", apFactory.getClass().getName());
 467                 }
 468             } catch(Throwable t) {
 469                 throw new AnnotationProcessingError(t);
 470             }
 471 
 472             LinkedList<AnnotationProcessor> temp = new LinkedList<AnnotationProcessor>();
 473             temp.addAll(processors);
 474 
 475             AnnotationProcessor proc = AnnotationProcessors.getCompositeAnnotationProcessor(temp);
 476 
 477             try {
 478                 proc.process();
 479             } catch (Throwable t) {
 480                 throw new AnnotationProcessingError(t);
 481             }




 440                     } catch (Exception e ) {
 441                         bark.aptWarning("FactoryCantInstantiate", working.getName());
 442                     } catch(Throwable t) {
 443                         throw new AnnotationProcessingError(t);
 444                     }
 445                 }
 446             }
 447 
 448             if (unmatchedAnnotations.size() > 0)
 449                 bark.aptWarning("AnnotationsWithoutProcessors", unmatchedAnnotations);
 450 
 451             Set<AnnotationProcessor> processors = new LinkedHashSet<AnnotationProcessor>();
 452 
 453             // If there were no source files AND no factory matching "*",
 454             // make sure the usage message is printed
 455             if (spectypedecls.size() == 0 &&
 456                 factoryToAnnotation.keySet().size() == 0 )
 457                 throw new UsageMessageNeededException();
 458 
 459             try {
 460                 for(Map.Entry<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> entry :
 461                         factoryToAnnotation.entrySet()) {
 462                     AnnotationProcessorFactory  apFactory = entry.getKey();
 463                     AnnotationProcessor processor = apFactory.getProcessorFor(entry.getValue(),
 464                                                                               trivAPE);
 465                     if (processor != null)
 466                         processors.add(processor);
 467                     else
 468                         bark.aptWarning("NullProcessor", apFactory.getClass().getName());
 469                 }
 470             } catch(Throwable t) {
 471                 throw new AnnotationProcessingError(t);
 472             }
 473 
 474             LinkedList<AnnotationProcessor> temp = new LinkedList<AnnotationProcessor>();
 475             temp.addAll(processors);
 476 
 477             AnnotationProcessor proc = AnnotationProcessors.getCompositeAnnotationProcessor(temp);
 478 
 479             try {
 480                 proc.process();
 481             } catch (Throwable t) {
 482                 throw new AnnotationProcessingError(t);
 483             }