From fda373c706612d314c0d711709d3ecab08374141 Mon Sep 17 00:00:00 2001 From: jrm Date: Mon, 22 Jun 2015 11:55:29 -0700 Subject: [PATCH] [infer][Java] Deal with empty strings '' in the classpath Summary: @public The empty string '' is a valid classpath information. This diff parses it and skips it when detecting the parts of the classpath. This case is happening when analyzing Buck. This one be one possibility why Infer does not load any bytecode in some cases, leading the TODO: print error message failure happening with the release (now `Failed to load any Java source code`). Test Plan: Infer CI. --- infer/src/java/jVerboseLexer.mll | 1 + infer/src/java/jVerboseParser.mly | 3 +++ 2 files changed, 4 insertions(+) diff --git a/infer/src/java/jVerboseLexer.mll b/infer/src/java/jVerboseLexer.mll index c568b97c3..9252bc607 100644 --- a/infer/src/java/jVerboseLexer.mll +++ b/infer/src/java/jVerboseLexer.mll @@ -37,6 +37,7 @@ rule token = parse | ']' { RIGHT_SQUARE_BRACKET } | ':' { COLON } | ',' { COMMA } +| "\'\'" { EMPTY } | "parsing" { PARSING } | "started" { STARTED } | "wrote" { WROTE } diff --git a/infer/src/java/jVerboseParser.mly b/infer/src/java/jVerboseParser.mly index 53eb990e6..0cf47e64b 100644 --- a/infer/src/java/jVerboseParser.mly +++ b/infer/src/java/jVerboseParser.mly @@ -5,6 +5,7 @@ %token EOL EOF %token LEFT_SQUARE_BRACKET RIGHT_SQUARE_BRACKET %token COLON COMMA +%token EMPTY %token PARSING STARTED WROTE SEARCH_PATH %token REGULARFILEOBJECT ZIPFILEINDEXFILEOBJECT %token CLASS_FILENAME @@ -34,6 +35,8 @@ classpath: ; classpath_parts: + | EMPTY { [] } | PATH { [$1] } + | EMPTY COMMA classpath_parts { $3 } | PATH COMMA classpath_parts { $1 :: $3 } ;