Closed GoogleCodeExporter closed 9 years ago
After _A LOT_ of searching and trying things, it looks like this is caused by
the following:
1) The order in which source files are processed is semi-random, probably
because a map with undefined order is in the process somewhere, and it sorts on
memory position which is non-deterministic.
2) You use val x = new Foo() {} syntax someplace (as in, the RHS of a val-typed
local variable declaration is or contains an anonymous inner class literal),
_AND_ this is evaluated BEFORE Foo itself. In this case, all usage of 'val' in
Foo will cause errors.
We're not 100% sure if that really is it, but so far it looks like it is. In
the original sources, the relevant line is:
dcc/dcc-etl/dcc-etl-indexer/src/main/java/org/icgc/dcc/etl/indexer/document/schema/ForwardSchemaGenerator.java:115 (method: createProcessor), which uses 'val' along with an anonymous inner class literal of DocumentProcessor on the right hand side. The actual errors which usually (but not always) occur, occur during val usage of DocumentProcessor.
So far, on successful runs, DocumentProcessor is done first and
ForwardSchemaGenerator later, and on failing runs, it's the reverse.
'unvalling' the assignment on line 115 so far has resulted in 10 successful
runs and no failures, so seems like bingo.
We're going to try and 'fix' this by eliminating the anonymous inner class
aspect of any RHS expression and then attribing it, and if that does not work,
we're probably going to declare any usage of AICLs in the RHS as invalid. Note
that our preferred solution does mean that this:
val x = new Object() { public int someNewMethodThatDoesntOverrideAnything() {
return 5; }}.someNewMethodThatDoesntOverrideAnything();
would NOT be equivalent to 'final int x = ...' even though it should be, but
we'll assume that the above is pretty much never used by any java programmers
ever. So, that particular bit being broken is fine in my book, I think.
Original comment by reini...@gmail.com
on 28 Jun 2014 at 10:52
CONFIRM previous hypothesis. This test case proves it. It requires 3 files:
File1.java:
public class File1 {{
lombok.val f2 = new File2() {};
}}
File2.java:
public class File2 {{
lombok.val f3 = 0;
}}
now compile with:
javac -cp lombok.jar *.java
in a dir with just the above 2 files.
Half of the time it fails, the other half it succeeds. (It succeeds if File2 is
processed first, fails if File1 is processed first). If you remove the {} on
line 2 of File1.java (remove the anonymous inner class literal aspect of it),
the problem ceases to exist, and all compiles always succeed, regardless of
whether File1 or File2 ends up getting processed first.
NB: The following replacement for File1.java also causes the compile run to
fail 50% of the time:
public class File1 {{
class F2 extends File2 {}
lombok.val f2 = new File2();
}}
essentially, any method local thing that extends a source-path type will 'ruin'
val in that source-path type if ANY attributing is done of any member anywhere
in that scope. Most likely the solution is to update our tree copier to be more
careful about how to handle this, because right now evidently the 'real' File2
nodes are being modified somehow.
Original comment by r.spilker
on 28 Jun 2014 at 11:15
Wow, I really appreciate all your hard work here. Great investigating!
Any idea on when you might be able to handle this or throw an error in eclipse
/ cli?
Thanks again
Original comment by rtier...@gmail.com
on 7 Jul 2014 at 2:00
Hold on to your hats... I think I fixed this thing.
Give this edge build a shot?
http://projectlombok.org/download-edge.html
Original comment by reini...@gmail.com
on 31 Jan 2015 at 3:54
Original issue reported on code.google.com by
rtier...@gmail.com
on 13 Jun 2014 at 6:14