-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8296656: java.lang.NoClassDefFoundError exception on running fully legitimate code #12754
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
Conversation
👋 Welcome back archiecobbs! A progress list of the required criteria for merging this PR into |
@archiecobbs The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
/solves 8287885 |
@archiecobbs |
/csr |
@archiecobbs has indicated that a compatibility and specification (CSR) request is needed for this pull request. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
@archiecobbs This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 76 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
tier1-4 green |
/integrate |
@archiecobbs |
/sponsor |
Going to push as commit 14b970d.
Your commit was automatically rebased without conflicts. |
@vicente-romero-oracle @archiecobbs Pushed as commit 14b970d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Thanks @archiecobbs and @vicente-romero-oracle Sorry for having sent this so late, it's hard to keep up with the traffic of the mailing lists. I only found this because I looked up my old JBS submission from last year on a whim. What's the best way I should go about testing this? I see instructions on how to build the JDK from the source code. Is that the best way? Or are there any prebuilt versions that contain this fix that you all can think of from the top of your head? Thanks again for your time, help, and patience! |
And just for context, I am the original submitter of 8287885 |
Using whatever your original example was. Or some simple example like this on a case-insensitive filesystem: public class Test {
interface Inner {
}
interface INNER {
}
}
As far as I know that's the best way... but I could be unaware of pre-built preview images somewhere. |
Ok, beautiful. I'll get on that now. Thanks again to you both! |
Finished building the jdk from source and tested the fix. It worked! Here is a demonstration for those who are following along.
As you can see, if I use the -Xlint warning above, I now get a warning if any of my classes generate the same filename multiple times. This is perfect, as I now know at compile time that this is something to watch out for. Thank you for fixing this Archie/Vicente! |
This bug and a few others fall into the "output file clash" bucket. This is when the compiler thinks it's writing out two separate files, but due to the way the O/S filesystem maps
Path
's to actual files, it's really writing the same file twice.This is usually due to case-insensitive filesystems, but can also be due to how a filesystem "normalizes" file names. For example, on MacOS, compiling this class will generate such a clash:
The reason is that
\u0301
is the Unicode character "Combining Acute Accent" which means "stick an accent over the previous character". So MacOS normalizes ae
followed by a\u0301
into a Unicode\u00e9
, that is,é
. However, the Java language treats these the two namesCafe\u0301
andCaf\u00e9
as distinct.It's infeasible to truly "fix" this problem, so we resort here to a salve, which is to add a new compiler flag
--detect-output-file-clashes
that enables detection of output file clashes. When the flag is enabled, and a clash is detected, an error is immediately thrown. For example, compiling the example above gives this:This at least gives people at risk of encountering this problem a way to turn a runtime error into a compile-time error.
Outstanding Questions
--detect-output-file-clashes
the best way to address this?BaseFileManager.outputFilesWritten
ever need to be cleared? Can the file manager be used for multiple compilations? If so, is there some "reset" step we should hook into?Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12754/head:pull/12754
$ git checkout pull/12754
Update a local copy of the PR:
$ git checkout pull/12754
$ git pull https://git.openjdk.org/jdk.git pull/12754/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12754
View PR using the GUI difftool:
$ git pr show -t 12754
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12754.diff