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
nested throwingFunction() doesn't work on AdoptOpenJDK #144
Comments
Interesting; this doesn't seem to be related to the nesting of FauxPas methods. I removed a //look for a per-page navigation definition file in the form `.filename.ext.navigation.*`
final Optional<Stream<NavigationItem>> pageNavigationDefinition = pageFilename.flatMap(filename -> {
try {
final Set<String> navigationFilenames = SUPPORTED_NAVIGATION_FILE_EXTENSIONS.stream()
.map(ext -> addExtension(DOTFILE_PREFIX + filename + navigationBaseName, ext)).collect(toCollection(LinkedHashSet::new));
return findAncestorFileByName(sourceDirectory, navigationFilenames, Files::isRegularFile, sourceDirectory)
.map(throwingFunction(file -> loadNavigationFile(context, contextArtifact, file)));
} catch(final IOException ioException) {
//TODO replace with FauxPas.throwingFunction() when OpenJDK supports it; see https://github.com/zalando/faux-pas/issues/144
throw new UncheckedIOException(ioException);
}
}); So maybe it's something to do with the depth of nesting of streams and lambdas? I want to emphasize that this compiles fine on Eclipse 2019-12 (4.14.0). |
I've made two commits (in Bitbucket) so that you can see exactly what I'm talking about. The first commit compiles on Eclipse but not on OpenJDK, as described above. https://bitbucket.org/globalmentor/guise/commits/d16b0478d1225bc02b6f37d737f9735cb3169018 The OpenJDK errors are:
The second commit provides the workaround: https://bitbucket.org/globalmentor/guise/commits/4e6b92b7cf6baf632d00df2615794d3079cb9e13 |
…initions. As-yet untested. Compiles fine on Eclipse 2019-12 (4.14.0) but produces an error with OpenJDK 11.0.5 making FauxPas ineffective. See zalando/faux-pas#144 .
Interesting! Faux Pas relies on Lombok's I suspect that this ability to cheat the compiler into believing you're throwing an unchecked exception while it is in fact a checked exception might not work in your environment anymore. I'm also using AdoptOpenJDK, but for MacOS. Seems to work just fine though. |
I just double checked again and I'm able to successfully run the build in the following configurations:
They all work on MacOS. My AdoptOpenJDK version is:
I can not reproduce it. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
This is likely a bug in the OpenJDK, but I wanted to report it first here to see if you could give me a more definitive direction to investigate further, as well as indicate a workaround.
I'm using
org.zalando.faux-pas.0.8.0
with OpenJDK 11 on Windows 10:I have a section of code that looks like this. Note that it has nested FauxPas
throwingFunction()
, although I don't know if the nesting has anything to do with it.That compiles just fine on Eclipse 2019-12 (4.14.0). But on AdoptOpenJDK I get this:
This error refers to the following line from the code above, because
loadNavigationFile()
throws anIOException
.This same problem occurs in another location, inside a
throwingFunction()
that is wrapped in athrowingSupplier()
.Should this code be allowed? Which is correct here: the Eclipse compiler or the OpenJDK compiler?
And do you know of a workaround, apart from splitting the code sections out and making the stream logic harder to read?
The text was updated successfully, but these errors were encountered: