@Override public Void visitLiteral(LiteralTree tree,AnnotatedTypeMirror type){
  if (!type.isAnnotatedInHierarchy(REGEX)) {
    String regex=null;
    if (tree.getKind() == Tree.Kind.STRING_LITERAL) {
      regex=(String)tree.getValue();
    }
 else     if (tree.getKind() == Tree.Kind.CHAR_LITERAL) {
      regex=Character.toString((Character)tree.getValue());
    }
    if (regex != null) {
      if (isRegex(regex)) {
        int groupCount=getGroupCount(regex);
        type.addAnnotation(createRegexAnnotation(groupCount));
      }
 else {
        type.addAnnotation(createPartialRegexAnnotation(regex));
      }
    }
  }
  return super.visitLiteral(tree,type);
}

@ Override public Void visitLiteral ( LiteralTree tree , AnnotatedTypeMirror type ) { if ( ! type . isAnnotatedInHierarchy ( REGEX ) ) { String regex = null ; if ( tree . getKind ( ) == Tree . Kind . STRING_LITERAL ) { regex = ( String ) tree . getValue ( ) ; } else if ( tree . getKind ( ) == Tree . Kind . CHAR_LITERAL ) { regex = Character . toString ( ( Character ) tree . getValue ( ) ) ; } if ( regex != null ) { if ( isRegex ( regex ) ) { int groupCount = getGroupCount ( regex ) ; type . addAnnotation ( createRegexAnnotation ( groupCount ) ) ; } else { type . addAnnotation ( createPartialRegexAnnotation ( regex ) ) ; } } } return super . visitLiteral ( tree , type ) ; }
case 1 : valid regular expression string or char literal . adds partialregex annotation to string literals that are not valid regular expressions .
