-
Notifications
You must be signed in to change notification settings - Fork 139
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
Different inner class references generated for same code #1631
Comments
@srikanth-sankaran : could you please check if that
I assume this is similar to another known ecj issue, where (numeric) lambda names are generated based on code visit order, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578351#c25. |
Trying to come up with a standalone test is challenging so far, although I have been able to minimize the program size needed to reproduce:
This minimal version of BatchingLock.java in place, not as a standalone java program is enough to see the problem. Bizarrely most any change you make to the minimal version above makes the problem disappear (E.g getting rid of the |
Problem arises from the differences between When doing a clean and full build, signature of
|
To address the question of whether the
In the minimal example above (which pretty much retains the original form for IFlushOperation) the type involved is:
Will the constant pool of this type That said, it appears javac and ecj gloss over this point and generate an inner class attribute entry for more cases than strictly necessary. |
JVMS 4.7 says this:
|
Given:
Javac from JDK21 generates this code:
The These are long standing behaviors - this attribute got introduced in Java 1.1 and behaviors are best left untouched unless absolutely needed. In this case, I think we should continue to emit an |
So here is a summary of what is going on: There are two I have a standalone regression test that demonstrates the behavior. Plausible fixes are - (a) to align the two signature methods wrt to flagging uses of nested classes (b) figure out if we can always use the "better" method. This is under study. |
I think so.
This behavior has been there for a long time. I tested 4.10 and it behaves the same way - I am fairly certain it goes back even many years more. Also given JVMS 4.7 wording cited above (Ten attributes are not critical to correct interpretation of the class file by the Java Virtual Machine and it includes InnerClasses) I would say not critical. But given the investment I have made spending nearly a day on it, I will wrap it up and include for 4.31 M1.
I don't think so except at an abstract level of a race/ordering influencing the outcome |
* Extract signature computation into a method of its own; Ensure nested type references are tracked properly * Fixes #1631
@iloveeclipse, With this merge, we may see some comparator errors. Now clean + build and incremental build both emit two inner class entries for the problem scenario. For many many releases, we have seen only one entry for a full build. But emitting two entries aligns us with Javac. Also to note: This fix backs out the code change brought in by https://bugs.eclipse.org/bugs/show_bug.cgi?id=575503 - the test brought in by that fix is still intact and passes without a problem even after the code change that supposedly fixes it is withdrawn. (The concerned fix does not look right to me) |
@srikanth-sankaran : many thanks! Instabilities in environment are really bad, nice to eliminate another one.
@akurtakov : I see there are many merges on aggregator today. Not sure what else you have planned, but in case you are done with aggregator, a new I build would be nice to see how much bundles would be affected because of compiler change here. |
This commit lacks version bump for org.eclipse.jdt.core.tests.builder and fails master branch build - https://ci.eclipse.org/jdt/job/eclipse.jdt.core-Github/job/master/296/console . Please fix and once this is done just start an I-bulid. |
@akurtakov : I will push the version bump for JDT. However there is another issue with PDE that bumped bundle version too much, see comment on https://github.com/eclipse-pde/eclipse.pde/pull/940/files. |
Fixed this and PDE problem and triggered new I Build: https://ci.eclipse.org/releng/job/Builds/job/I-build-4.31/9/ |
Fortunately, we only have one single class changed, so not much trouble here. |
…-jdt#1635) * Extract signature computation into a method of its own; Ensure nested type references are tracked properly * Fixes eclipse-jdt#1631
…-jdt#1635) * Extract signature computation into a method of its own; Ensure nested type references are tracked properly * Fixes eclipse-jdt#1631
Found in eclipse-platform/eclipse.platform.releng.aggregator#1557 (comment)
org.eclipse.team.core
source codeorg/eclipse/team/internal/core/subscribers/BatchingLock.java
in the editorBatchingLock.IFlushOperation.flush(ThreadInfo, IProgressMonitor)
methodBatchingLock.IFlushOperation.flush(ThreadInfo, IProgressMonitor)
method in the editor againorg.eclipse.team.core
project and do a "Clean Build".TO BE
I would expect compiler generates the inner class reference only if it needed, and if it is needed, always generates this reference and not based on the compilation order or number of compiled classes.
The text was updated successfully, but these errors were encountered: