1717
1818import java .lang .annotation .Annotation ;
1919import java .util .ArrayList ;
20- import java .util .HashSet ;
2120import java .util .Iterator ;
21+ import java .util .LinkedHashSet ;
2222import java .util .List ;
2323import java .util .Set ;
2424
@@ -54,8 +54,7 @@ public Configuration getConfiguration(ServletContext servletContext)
5454 {
5555
5656 /*
57- * ======================================================
58- * ============[ Configuration parameters ]==============
57+ * ====================================================== ============[ Configuration parameters ]==============
5958 * ======================================================
6059 */
6160
@@ -65,32 +64,34 @@ public Configuration getConfiguration(ServletContext servletContext)
6564 // does the user want to scan the WEB-INF/lib directory
6665 boolean scanLibDir = false ;
6766 String jarConfig = servletContext .getInitParameter (CONFIG_SCAN_LIB_DIR );
68- if ((jarConfig != null ) && jarConfig .trim ().equalsIgnoreCase ("true" )) {
67+ if ((jarConfig != null ) && jarConfig .trim ().equalsIgnoreCase ("true" ))
68+ {
6969 scanLibDir = true ;
7070 }
7171
7272 // users can disable annotation scanning
73- if ((packageFilters != null ) && packageFilters .trim ().equalsIgnoreCase ("none" )) {
73+ if ((packageFilters != null ) && packageFilters .trim ().equalsIgnoreCase ("none" ))
74+ {
7475 log .debug ("Annotation scanning is disabled!" );
7576 return null ;
7677 }
7778
7879 /*
79- * ======================================================
80- * ============[ Prepare scanning process ]==============
80+ * ====================================================== ============[ Prepare scanning process ]==============
8181 * ======================================================
8282 */
8383
8484 // the byte code filter needs to know the annotations to look for
85- Set <Class <? extends Annotation >> annotationType = new HashSet <Class <? extends Annotation >>();
85+ Set <Class <? extends Annotation >> annotationType = new LinkedHashSet <Class <? extends Annotation >>();
8686
8787 // list of annotation handlers for the ClassVisitor
8888 List <AnnotationHandler <Annotation >> annotationHandlers = new ArrayList <AnnotationHandler <Annotation >>();
8989
9090 // load the implementations of the AnnotationHandler SPI
9191 @ SuppressWarnings ("unchecked" )
9292 Iterator <AnnotationHandler <Annotation >> handlerIterator = ServiceLoader .load (AnnotationHandler .class ).iterator ();
93- while (handlerIterator .hasNext ()) {
93+ while (handlerIterator .hasNext ())
94+ {
9495 AnnotationHandler <Annotation > handler = handlerIterator .next ();
9596 annotationHandlers .add (handler );
9697 annotationType .add (handler .handles ());
@@ -107,26 +108,28 @@ public Configuration getConfiguration(ServletContext servletContext)
107108
108109 // fallback to some other classloder if there is no context class loader
109110 ClassLoader classloader = Thread .currentThread ().getContextClassLoader ();
110- if (classloader == null ) {
111+ if (classloader == null )
112+ {
111113 classloader = this .getClass ().getClassLoader ();
112114 }
113115
114116 /*
115- * ======================================================
116- * =============[ Scanning process starts ]==============
117+ * ====================================================== =============[ Scanning process starts ]==============
117118 * ======================================================
118119 */
119120
120121 // TODO this should be pulled out into a utility allowing it to run in Java SE
121122 // compile a list of class finders to run
122123 List <ClassFinder > classFinders = new ArrayList <ClassFinder >();
123124 classFinders .add (new WebClassesFinder (servletContext , classloader , packageFilter , byteCodeFilter ));
124- if (scanLibDir ) {
125+ if (scanLibDir )
126+ {
125127 classFinders .add (new WebLibFinder (servletContext , classloader , packageFilter , byteCodeFilter ));
126128 }
127129
128130 // start the scanning process
129- for (ClassFinder finder : classFinders ) {
131+ for (ClassFinder finder : classFinders )
132+ {
130133 finder .findClasses (classVisitor );
131134 }
132135
0 commit comments