Open GoogleCodeExporter opened 9 years ago
I've been able to get it down to a smaller testcase, and with it, I can confirm
your assumption that it is an issue in lombok.ast.
See the attached two files - I cut down your LintBreaker into Issue573, and
added a runner class Issue573Main. I added both to an Eclipse project in my
lombok and lombok.ast workspace.
In the current state, Issue573Main manages to run for 40 minutes straight.
Removing one of the three try-catch blocks in Issue573 and trying again still
takes a couple of seconds, but finds 8 ParseProblems, the first one at the | in
the multicatch and the subsequent as resulting errors.
Original comment by askon...@gmail.com
on 4 Sep 2013 at 9:58
Attachments:
Thank you very much for your prompt attention and effort. My initial uninformed
novice suspicion is that CatchTemplate in
lombok.ast/src/main/lombok/ast/Templates.java has a reference to a
VariableDefinition, and VariableDefinitionTemplate might not be able to
properly process multicatch syntax. Perhaps a similar
CatchVariableDefinitionTemplate that allows for the possibility of one or more
TypeReference separated by '|' instead of a single TypeReference could be one
possible approach?
I don't know nearly enough about the internals of the Lombok parser to
understand why it takes three such clauses to really freak out the parser, but
it looks to me like the file isn't really processed properly (i.e. spurious
parse errors occur) even with just one multicatch expression.
Original comment by rapro...@gmail.com
on 4 Sep 2013 at 10:15
It looks like Parboiled cannot really handle this kind of situation well; I've
seen it choke on almost-but-not-quite-legal syntax in other projects before.
That said, we should be able to parse Java 7 sugar...
Original comment by askon...@gmail.com
on 5 Sep 2013 at 8:48
I've taken a look at the parsing. Adapting the grammar wouldn't be the problem,
but storing a multicatch node properly is the difficult part here: Everything
downstream expects a variable declaration (i.e. type + name), whereas we would
suddenly, somehow, pass more than one type.
Original comment by askon...@gmail.com
on 20 Sep 2013 at 11:28
Now that Android build tools version 19 supports language features like
multicatch this is probably going to happen a lot more from android lint...
Original comment by tnor...@google.com
on 21 Dec 2013 at 1:59
I was going to see if I could work around this. Since the code hangs in the
parboiled code, I need the source code for parboiled 0.9.7.2, the version
bundled with project lombok itself (presumably because it's been tweaked?).
In lombok.ast's
buildScripts/ivy-repo/com.github.parboiled.custom-parboiled-0.9.7.2.xml it
points to the source code as this download:
http://projectlombok.org/ivyrepo/parboiled/parboiled-0.9.7.2-src.jar
However, that .jar doesn't seem to include the source code; it looks like it's
also just containing the binaries:
$ jar tvf parboiled-0.9.7.2-src.jar | grep .java | wc
0 0 0
$ jar tvf parboiled-0.9.7.2-src.jar | grep .class | wc
229 1832 18253
Does anyone know where I can find the exact parboiled sources?
(I optimistically tried using the latest parboiled release, 1.1.6, but the APIs
appear to have changed quite a lot. I don't see anything near 0.9.7 in
http://repo1.maven.org/maven2/org/parboiled/parboiled-java.)
Original comment by tnor...@google.com
on 27 Dec 2013 at 12:45
If anyone else wants to look at this, the sources are found here:
https://github.com/sirthias/parboiled/archive/v0.9.7.2.zip
I started trying to fix this, but then I realized I have a better option:
Rather than relying on the parboiled parser, I'll just make Android lint's
command line client use ECJ directly instead (we already use ECJ when lint is
running inside Eclipse). In addition to fixing this bug (and other bugs like
issue 415) it makes everything a *lot* faster - like 10x faster. In short,
while I said in an earlier comment that this bug is a big problem for us, it no
longer is.
Original comment by tnor...@google.com
on 30 Dec 2013 at 5:50
Original issue reported on code.google.com by
rapro...@gmail.com
on 4 Sep 2013 at 12:05Attachments: