@@ -57,7 +57,7 @@ public static Tree findByLocationInfoNoLookAhead(Tree tree, LocationInfo locatio
5757 return treeBetweenPositions ;
5858 }
5959
60- public static Tree findByLocationInfo (Tree tree , LocationInfo locationInfo , String type ){
60+ public static Tree findByLocationInfo (Tree tree , LocationInfo locationInfo , String ... type ){
6161 int startoffset = locationInfo .getStartOffset ();
6262 int endoffset = locationInfo .getEndOffset ();
6363 return getTreeBetweenPositions (tree , startoffset , endoffset ,type );
@@ -71,7 +71,7 @@ public static Tree getTreeBetweenPositions(Tree tree, int position, int endPosit
7171 return null ;
7272 }
7373
74- public static Tree getTreeBetweenPositions (Tree tree , int position , int endPosition ,String type ) {
74+ public static Tree getTreeBetweenPositions (Tree tree , int position , int endPosition ,String ... type ) {
7575 for (Tree t : tree .preOrder ()) {
7676 if (t .getPos () >= position && t .getEndPos () <= endPosition )
7777 if (isFromType (t , type ))
@@ -301,8 +301,12 @@ public static boolean areBothFromThisType(Tree t1, Tree t2, String type) {
301301 && isFromType (t2 , type );
302302 }
303303
304- public static boolean isFromType (Tree t1 , String type ) {
305- return t1 .getType ().name .equals (type );
304+ public static boolean isFromType (Tree t1 , String ... type ) {
305+ if (t1 == null ) return false ;
306+ for (String t : type )
307+ if (t1 .getType ().name .equals (t ))
308+ return true ;
309+ return false ;
306310 }
307311
308312 public static Tree findFirstByType (Tree inputTree , String typeName ) {
0 commit comments