Skip to content
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

8347840: Fix testlibrary compilation warnings #23143

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

lmesnik
Copy link
Member

@lmesnik lmesnik commented Jan 15, 2025

There few compiler warning disabled in the testlibary build.
They should be fixed or localized and removed from build to prevent new possible issues.

The main goal is to avoid new such issues in the testlibrary.
Tested with tier1-5 to ensure that all tests were passed.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8347840: Fix testlibrary compilation warnings (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23143/head:pull/23143
$ git checkout pull/23143

Update a local copy of the PR:
$ git checkout pull/23143
$ git pull https://git.openjdk.org/jdk.git pull/23143/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23143

View PR using the GUI difftool:
$ git pr show -t 23143

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23143.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 15, 2025

👋 Welcome back lmesnik! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jan 15, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 15, 2025
@openjdk
Copy link

openjdk bot commented Jan 15, 2025

@lmesnik The following labels will be automatically applied to this pull request:

  • build
  • core-libs
  • hotspot
  • net
  • serviceability

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.

@mlbridge
Copy link

mlbridge bot commented Jan 15, 2025

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good - sometimes a bit of a puzzler understanding what warning is being addressed. :)

Only one thing I'm concerned may be an issue. Also a couple of suggestions.

Thanks

@@ -107,7 +107,7 @@ public static ArrayDiff<?> of(Object first, Object second) {
* @throws NullPointerException if at least one of the arrays is null
* @return an ArrayDiff instance for the two arrays and formatting parameters provided
*/
@SuppressWarnings("rawtypes")
@SuppressWarnings({"rawtypes", "unchecked"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering where the unchecked warning arises in the code?

Comment on lines -39 to 42
/**
/*
*
* @author Bill Foote
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest deleting any comment blocks that just have the @author tag, and deleting the @author elsewhere. All these files (lib/hprof) already have an author attribution comment.

@@ -43,4 +43,5 @@ public interface ReadBuffer extends AutoCloseable {
public short getShort(long pos) throws IOException;
public int getInt(long pos) throws IOException;
public long getLong(long pos) throws IOException;
public void close() throws IOException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this redefined to throw IOException rather than just Exception?

Comment on lines +98 to +100
if ((X) ex == ex) {
throw (X) ex;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense to me.

@@ -93,7 +93,6 @@ public static Snapshot readFile(String heapFile, boolean callStack,
return r.read();
} else if ((i >>> 8) == GZIP_HEADER_MAGIC) {
// Possible gziped file, try decompress it and get the stack trace.
in.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not obvious to me that there may not be a reason for closing all of the streams before opening new ones below.

@@ -166,7 +165,6 @@ public static String getStack(String heapFile, int debugLevel)
return r.printStackTraces();
} else if ((i >>> 8) == GZIP_HEADER_MAGIC) {
// Possible gziped file, try decompress it and get the stack trace.
in.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not obvious to me that there may not be a reason for closing all of the streams before opening new ones below.

@@ -94,6 +94,7 @@ private static void callback() {
* Runs the given task on a virtual thread pinned to its carrier. If called from a
* virtual thread then it invokes the task directly.
*/
@SuppressWarnings("unchecked")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the code to the follow, same in VThreadRunner then it would avoid the the SW on the method and avoid the other change you have to VThreadRunner.

            @SuppressWarnings("unchecked")
            var x = (X) ex;
            throw x;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants