-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random javac compilation error: Cannot use 'val' here #729
Comments
👤 rtiernay 🕗 Jun 13, 2014 at 18:14 UTC What steps will reproduce the problem?
You may need to repeat 3. multiple times to observe the error What is the expected output? What do you see instead? I expect the build to complete successfully, but see the following output instead: ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project dcc-etl-indexer: Compilation failure Please provide any additional information below. I have given access to my private github repo to one of the core developers (rzwitserloot) who has confirmed that this occurs randomly. Using Lombok 1.12.6 mvn -v |
👤 reinierz 🕗 Jun 28, 2014 at 22:52 UTC After A LOT of searching and trying things, it looks like this is caused by the following:
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. |
👤 r.spilker 🕗 Jun 28, 2014 at 23:15 UTC CONFIRM previous hypothesis. This test case proves it. It requires 3 files: File1.java:
File2.java:
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:
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. |
👤 rtiernay 🕗 Jul 07, 2014 at 14:00 UTC 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 |
👤 reinierz 🕗 Jan 31, 2015 at 03:54 UTC Hold on to your hats... I think I fixed this thing. Give this edge build a shot? |
End of migration |
Bumps [junit-vintage-engine](https://github.com/junit-team/junit5) from 5.5.2 to 5.6.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](junit-team/junit5@r5.5.2...r5.6.0) Signed-off-by: dependabot-preview[bot] <[email protected]>
Migrated from Google Code (issue 694)
The text was updated successfully, but these errors were encountered: