vscode-java: Gradle using Java 8 - Any gradle build script error returns as a StreamCorruptedException with no useful content instead of the actual gradle exception

When using Gradle with java.configuration.runtimes set to a JavaSE-1.8 JVM, any problems in a build.gradle script will come up with a java.io.StreamCorruptedException instead of the actual exception.

This can be very painful to debug, because it might happen that when executing gradle manually via command line, you might find that the build itself will go through with one of the default targets, but if one of the sub projects is executed it will throw an error.

Environment
  • Operating System: Centos 7
  • JDK version: 1.8.0b252
  • Visual Studio Code version: 1.48.1
  • Java extension version: 0.65.0
Steps To Reproduce
  1. Write a gradle script with any sort of gradle parsing error
  2. See problems menu that only describes the error as
java.io.StreamCorruptedException: invalid type code: 00
invalid type code: 00

Example script:

this is just random text in a build.gradle
Current Result

Returns blank exception

Expected Result
  • What went wrong: Could not compile build file ‘build.gradle’.

startup failed: build file ‘build.gradle’: 1: unexpected token: in @ line 1, column 26. this is just random text in a build.gradle

Additional Informations

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Ok I see now. Invalid build.gradle errors don’t bubble up as diagnostics. Buildship reports it properly, so we must be something wrong:

I can’t reproduce the issue. @fbricon @jakegt1 Could you attach a project example?

gradle