-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8341778: Some javac tests ignore the result of JavacTask::call #25645
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
8341778: Some javac tests ignore the result of JavacTask::call #25645
Conversation
👋 Welcome back vromero! A progress list of the required criteria for merging this PR into |
@vicente-romero-oracle 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 185 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. ➡️ To integrate this PR with the above commit message to the |
@vicente-romero-oracle The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
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, but I have question about hunks that are not about wrapping call()
-s. Those look like fixing the actual test bugs?
@@ -50,7 +50,8 @@ public static void main(String... args) throws Throwable { | |||
|
|||
final PrintWriter out = new PrintWriter(System.err, true); | |||
|
|||
Iterable<String> flags = Arrays.asList("-processorpath", testClassDir, | |||
Iterable<String> flags = Arrays.asList("--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", |
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.
Why --add-exports
? Did this test actually failed without us noticing?
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.
correct, as we were ignoring the result of the ::call invocation it was returning false but the test went on and seemed to be OK
@@ -75,6 +76,12 @@ public static void main(String... args) throws Exception { | |||
} | |||
} | |||
|
|||
static final List<String> OPTIONS = List.of( |
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.
Same question here...
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.
same answer here
@@ -34,7 +34,7 @@ | |||
|
|||
public class SOEDeeplyNestedBlocksTest { | |||
|
|||
static final int NESTING_DEPTH = 1000; | |||
static final int NESTING_DEPTH = 500; |
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.
Same question here.
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.
With a NESTING_DEPTH of 1000 javac will run into a StackOverflowError, but it still completes and task.call() returns false. Using 500 javac can compile without error. Not sure what this test wants to prove. If it wants to show that javac can complete without throwing an SOE then it should keep depth 1000 and test that task.call() returns false.
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.
yes this one was failing quietly, this test is stressing a code that was modified due to pattern matching. It is testing that javac can deal with deeply nested code without throwing SOE. 1000 depth was too much and the test was quietly failing
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.
It is testing that javac can deal with deeply nested code without throwing SOE.
The current summary Javac fails with StackOverflowError when compiling deeply nested synchronized blocks
is confusing and I don't know how it relates to your statement. Does it describe a bug or does it state the purpose of the test? Anyway, why not test with nesting levels of 500 and 1000, assert that task.call() returns true (500) and false (1000), but in the later case does not panic and terminate with a SOE.
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.
the original version of the test was included as part of the fix for [1] as you can see in the related PR [2] method com.sun.tools.javac.jvm.Gen::visitBlock was visiting every block assuming that every one of them had pattern matching expressions in it. This implied a visitBlock with a higher number of local variables even for 90-98% of blocks that didn't have any pattern matching in them. So the test is checking that javac is not failing with SOE while generating code for a method with deeply nested blocks. Testing that javac will produce SOE after a given threshold is passed adds no information as there always be resource limits for any process. This is why I don't see the value of having a test that passes that threshold, which by the way could move over time and then we will need to go back and fix the test. While on the other hand having a test that will keep javac in check, as in being able to still compile without issues a nested enough code, seems more valuable to me.
I believe we are still not in RDP1? Do you want to get it in JDK 25? Put |
I prefer to wait until 26, this is not a high priority issue |
Tests P1-P5 can be fixed during RDP1 and RDP2: https://openjdk.org/jeps/3#rdp-2 |
thanks for the reviews |
/integrate |
Going to push as commit 8adb052.
Your commit was automatically rebased without conflicts. |
@vicente-romero-oracle Pushed as commit 8adb052. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Several tests are ignoring the result of invoking com.sun.source.util.JavacTask::call which returns a
Boolean
. This implies that tests could seem to pass when in reality they are silently failing. This PR is fixing this issue by checking, in all applicable cases the result of the invocation.TIA
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25645/head:pull/25645
$ git checkout pull/25645
Update a local copy of the PR:
$ git checkout pull/25645
$ git pull https://git.openjdk.org/jdk.git pull/25645/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25645
View PR using the GUI difftool:
$ git pr show -t 25645
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25645.diff
Using Webrev
Link to Webrev Comment