@@ -28,7 +28,7 @@ class Chi implements RouteTree {
2828 private static final byte ntParam = 2 ; // /{user}
2929 private static final byte ntCatchAll = 3 ; // /api/v1/*
3030
31- private static int NODE_SIZE = ntCatchAll + 1 ;
31+ private static final int NODE_SIZE = ntCatchAll + 1 ;
3232
3333 static final StaticRoute NO_MATCH = new StaticRoute (Collections .emptyMap ());
3434
@@ -54,10 +54,10 @@ public void put(String method, Route route) {
5454 static class ZeroCopyString {
5555 public static final ZeroCopyString EMPTY = new ZeroCopyString (new char [0 ], 0 , 0 );
5656
57- private int offset ;
58- private int length ;
57+ private final int offset ;
58+ private final int length ;
5959 private int hash = 0 ;
60- private char [] value ;
60+ private final char [] value ;
6161
6262 public ZeroCopyString (String source ) {
6363 this .offset = 0 ;
@@ -496,18 +496,14 @@ void setEndpoint(String method, Route route) {
496496 // Recursive edge traversal by checking all nodeTyp groups along the way.
497497 // It's like searching through a multi-dimensional radix trie.
498498 Route findRoute (RouterMatch rctx , String method , ZeroCopyString path ) {
499- Node n = this ;
500- Node nn = n ;
501-
502- ZeroCopyString search = path ;
503499
504500 for (int ntyp = 0 ; ntyp < NODE_SIZE ; ntyp ++) {
505- Node [] nds = nn .children [ntyp ];
501+ Node [] nds = this .children [ntyp ];
506502 if (nds != null ) {
507503 Node xn = null ;
508- ZeroCopyString xsearch = search ;
504+ ZeroCopyString xsearch = path ;
509505
510- char label = search .length () > 0 ? search .charAt (0 ) : ZERO_CHAR ;
506+ char label = path .length () > 0 ? path .charAt (0 ) : ZERO_CHAR ;
511507
512508 switch (ntyp ) {
513509 case ntStatic :
@@ -760,12 +756,12 @@ public void destroy() {
760756 }
761757 }
762758
763- private static String BASE_CATCH_ALL = "/?*" ;
759+ private static final String BASE_CATCH_ALL = "/?*" ;
764760
765- private Node root = new Node ();
761+ private final Node root = new Node ();
766762
767763 /** Not need to use a concurrent map, due we don't allow to add routes after application started. */
768- private Map <Object , StaticRoute > staticPaths = newMap (16 );
764+ private final Map <Object , StaticRoute > staticPaths = newMap (16 );
769765
770766 static <K , V > Map <K , V > newMap (int size ) {
771767 return new ConcurrentHashMap <>(size );
0 commit comments