[GRADLE-3157] Test class detection fails when using jdk8 '-parameters' compiler option Created: 25/Aug/14 Updated: 13/Jan/15 Resolved: 03/Dec/14 |
|
| Status: | Resolved |
| Project: | Gradle |
| Affects Version/s: | None |
| Fix Version/s: | 2.3-rc-1 |
| Type: | Bug | ||
| Reporter: | Gradle Forums | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 1 |
| Description |
|
My project contains the single file "src/test/java/test/Fail.java": package test; My file "build.gradle" is: apply plugin: 'java' If I run: set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_20 I'll get the following exception: C:\data\Dropbox\user\development\gradle-parameters-bug>set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_20 FAILURE: Build failed with an exception.
BUILD FAILED |
| Comments |
| Comment by Gradle Forums [ 25/Aug/14 ] |
|
Is this problem specific to JDK 1.8.0_20, or does it also occur with earlier JDK 8 versions? |
| Comment by Gradle Forums [ 25/Aug/14 ] |
|
It happens with all JDK 1.8 versions. |
| Comment by Andrew Kowal [ 27/Nov/14 ] |
|
The problem is that org.gradle.api.internal.tasks.testing.detection.TestClassVisitor#TestClassVisitor passes Opcodes.ASM4 to ClassVisitor.super(). At the same time in org.objectweb.asm.MethodVisitor#visitParameter there is an explicit API version check:
if (api < Opcodes.ASM5) {
throw new RuntimeException();
}
Changing Opcodes.ASM4 to Opcodes.ASM5 does the trick, here's the diff: https://gist.github.com/akowal/0199b49bcb62c5fff61c |
| Comment by Marcin Erdmann [ 27/Nov/14 ] |
|
Submitting a pull request with your fix and test coverage is the quickest way to get this issue fixed. Would you mind doing that? |
| Comment by Andrew Kowal [ 28/Nov/14 ] |
|
Yep, I'll submit it once I sort out test coverage. |
| Comment by Matt Byrne [ 13/Jan/15 ] |
|
Any chance of cherry picking this across to 2.2 since it's a blocker with no known workaround? |
| Comment by Luke Daley [ 13/Jan/15 ] |
|
Matt Byrne sorry, not going to happen. 2.3 RC will be out next week. |
| Comment by Matt Byrne [ 13/Jan/15 ] |
|
Ah ok, 2.3 RC release is promising - thanks for feedback. |