Skip to content

Commit 232379e

Browse files
committed
Merge master HEAD into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 22f4881 + 55eb24c commit 232379e

32 files changed

+186
-65
lines changed

src/java.base/share/classes/java/util/Formatter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4249,8 +4249,8 @@ private int adjustWidth(int width, int flags, boolean neg) {
42494249

42504250
// Add trailing zeros
42514251
private void trailingZeros(StringBuilder sb, int nzeros) {
4252-
for (int i = 0; i < nzeros; i++) {
4253-
sb.append('0');
4252+
if (nzeros > 0) {
4253+
sb.repeat('0', nzeros);
42544254
}
42554255
}
42564256

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedClass.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@ public final class RecordedClass extends RecordedObject {
4949
* @see java.lang.reflect.Modifier
5050
*/
5151
public int getModifiers() {
52-
return getTyped("modifiers", Integer.class, -1);
52+
return getTyped("modifiers", Integer.class, INTEGER_MINUS_ONE);
5353
}
5454

5555
/**

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedFrame.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@ public boolean isJavaFrame() {
6565
* @return byte code index, or {@code -1} if doesn't exist
6666
*/
6767
public int getBytecodeIndex() {
68-
return getTyped("bytecodeIndex", Integer.class, Integer.valueOf(-1));
68+
return getTyped("bytecodeIndex", Integer.class, INTEGER_MINUS_ONE);
6969
}
7070

7171
/**
@@ -75,7 +75,7 @@ public int getBytecodeIndex() {
7575
* @return the line number, or {@code -1} if doesn't exist
7676
*/
7777
public int getLineNumber() {
78-
return getTyped("lineNumber", Integer.class, Integer.valueOf(-1));
78+
return getTyped("lineNumber", Integer.class, INTEGER_MINUS_ONE);
7979
}
8080

8181
/**

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedMethod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@ public String getDescriptor() {
9494
* @see RecordedFrame#isJavaFrame
9595
*/
9696
public int getModifiers() {
97-
return getTyped("modifiers", Integer.class, Integer.valueOf(0));
97+
return getTyped("modifiers", Integer.class, INTEGER_ZERO);
9898
}
9999

100100
/**

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -154,6 +154,9 @@ public MetadataEvent newMetadataEvent(List<EventType> previous, List<EventType>
154154

155155
private static final record UnsignedValue(Object value) {
156156
}
157+
static final Integer INTEGER_MINUS_ONE = Integer.valueOf(-1);
158+
static final Integer INTEGER_ZERO = Integer.valueOf(0);
159+
static final Long LONG_MINUS_ONE = Long.valueOf(-1L);
157160

158161
final Object[] objects;
159162
final ObjectContext objectContext;

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedThread.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ public long getOSThreadId() {
5959
if (isVirtual()) {
6060
return -1L;
6161
}
62-
Long l = getTyped("osThreadId", Long.class, -1L);
62+
Long l = getTyped("osThreadId", Long.class, LONG_MINUS_ONE);
6363
return l.longValue();
6464
}
6565

@@ -92,7 +92,7 @@ public String getJavaName() {
9292
* @see java.lang.Thread#threadId()
9393
*/
9494
public long getJavaThreadId() {
95-
Long l = getTyped("javaThreadId", Long.class, -1L);
95+
Long l = getTyped("javaThreadId", Long.class, LONG_MINUS_ONE);
9696
long id = l.longValue();
9797
return id == 0 ? -1L : id;
9898
}

src/jdk.jfr/share/classes/jdk/jfr/events/AbstractBufferStatisticsEvent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
3030
import jdk.jfr.*;
3131

3232
@Category({ "Java Application", "Statistics" })
33-
public abstract class AbstractBufferStatisticsEvent extends AbstractPeriodicEvent {
33+
abstract class AbstractBufferStatisticsEvent extends AbstractPeriodicEvent {
3434

3535
protected AbstractBufferStatisticsEvent(BufferPool bufferPool) {
3636
count = bufferPool.getCount();

src/jdk.jfr/share/classes/jdk/jfr/events/ActiveRecordingEvent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import jdk.jfr.Label;
3030
import jdk.jfr.DataAmount;
3131
import jdk.jfr.Name;
32-
import jdk.jfr.StackTrace;
3332
import jdk.jfr.Timespan;
3433
import jdk.jfr.Timestamp;
3534
import jdk.jfr.internal.RemoveFields;

src/jdk.jfr/share/classes/jdk/jfr/events/ActiveSettingEvent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import jdk.jfr.Category;
2929
import jdk.jfr.Label;
3030
import jdk.jfr.Name;
31-
import jdk.jfr.StackTrace;
3231
import jdk.jfr.internal.RemoveFields;
3332
import jdk.jfr.internal.Type;
3433

src/jdk.jfr/share/classes/jdk/jfr/events/ExceptionStatisticsEvent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import jdk.jfr.Description;
3030
import jdk.jfr.Label;
3131
import jdk.jfr.Name;
32-
import jdk.jfr.StackTrace;
3332
import jdk.jfr.internal.MirrorEvent;
3433
import jdk.jfr.internal.RemoveFields;
3534
import jdk.jfr.internal.Type;

src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import jdk.jfr.Threshold;
4747
import jdk.jfr.events.ActiveSettingEvent;
4848
import jdk.jfr.events.StackFilter;
49-
import jdk.jfr.internal.JVM;
5049
import jdk.jfr.internal.settings.CutoffSetting;
5150
import jdk.jfr.internal.settings.EnabledSetting;
5251
import jdk.jfr.internal.settings.LevelSetting;

src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
import jdk.jfr.EventType;
4545
import jdk.jfr.Name;
4646
import jdk.jfr.Period;
47-
import jdk.jfr.StackTrace;
48-
import jdk.jfr.Threshold;
4947
import jdk.jfr.ValueDescriptor;
5048
import jdk.jfr.internal.consumer.RepositoryFiles;
5149
import jdk.jfr.internal.event.EventConfiguration;

src/jdk.jfr/share/classes/jdk/jfr/internal/OldObjectSample.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
3333
import jdk.jfr.RecordingState;
3434
import jdk.jfr.internal.settings.CutoffSetting;
3535
import jdk.jfr.internal.test.WhiteBox;
36-
import jdk.jfr.internal.util.Utils;
3736

3837
// The Old Object event could have been implemented as a periodic event, but
3938
// due to chunk rotations and how settings are calculated when multiple recordings

src/jdk.jfr/share/classes/jdk/jfr/internal/RepositoryChunk.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -29,10 +29,7 @@
2929
import java.io.RandomAccessFile;
3030
import java.nio.channels.ReadableByteChannel;
3131
import java.time.Instant;
32-
import java.time.Period;
33-
import java.time.Duration;
3432
import java.util.Comparator;
35-
import java.util.Optional;
3633

3734
import jdk.jfr.internal.SecuritySupport.SafePath;
3835

src/jdk.jfr/share/classes/jdk/jfr/internal/ShutdownHook.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@
2525

2626
package jdk.jfr.internal;
2727

28-
import java.io.IOException;
2928
import java.security.AccessControlContext;
3029
import java.security.AccessController;
3130
import java.security.PrivilegedActionException;
3231
import java.security.PrivilegedExceptionAction;
3332

3433
import jdk.jfr.RecordingState;
35-
import jdk.jfr.internal.util.Utils;
3634

3735
/**
3836
* Class responsible for dumping recordings on exit

src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/QueryRecording.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
2727
import java.io.IOException;
2828
import java.time.Duration;
2929
import java.time.Instant;
30-
import java.util.ArrayList;
3130
import java.util.List;
3231
import java.util.ListIterator;
3332

@@ -37,12 +36,8 @@
3736
import jdk.jfr.internal.PrivateAccess;
3837
import jdk.jfr.internal.RepositoryChunk;
3938
import jdk.jfr.internal.query.Configuration;
40-
import jdk.jfr.internal.query.QueryPrinter;
41-
import jdk.jfr.internal.query.ViewPrinter;
4239
import jdk.jfr.internal.query.Configuration.Truncate;
4340
import jdk.jfr.internal.util.UserDataException;
44-
import jdk.jfr.internal.util.UserSyntaxException;
45-
import jdk.jfr.internal.util.Output;
4641

4742
/**
4843
* Helper class that holds recording chunks alive during a query. It also helps

src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/JFC.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,7 @@ public static Reader newReader(SafePath sf) throws IOException {
293293
public static String formatException(String prefix, Exception e, String input) {
294294
String message = prefix + " " + JFC.exceptionToVerb(e) + " file '" + input + "'";
295295
String details = e.getMessage();
296-
if (e instanceof JFCModelException m) {
296+
if (e instanceof JFCModelException) {
297297
return message + ". " + details;
298298
}
299299
if (e instanceof ParseException && !details.isEmpty()) {

src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlSetting.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ public void onChange() {
5959
@Override
6060
final void setContent(String value) {
6161
super.setContent(value);
62-
if (getParent() instanceof XmlEvent event) {
62+
if (getParent() instanceof XmlEvent) {
6363
SettingsLog.log(this, value);
6464
}
6565
}

src/jdk.jfr/share/classes/jdk/jfr/internal/query/Row.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,6 @@ public void putText(int index, String text) {
5353

5454
@Override
5555
public String toString() {
56-
return Arrays.asList(values).toString();
56+
return Arrays.toString(values);
5757
}
5858
}

src/jdk.jfr/share/classes/jdk/jfr/internal/query/TableSorter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,7 @@
2424
*/
2525
package jdk.jfr.internal.query;
2626

27-
import java.util.ArrayList;
28-
import java.util.Collections;
2927
import java.util.Comparator;
30-
import java.util.List;
3128
import java.util.function.Predicate;
3229

3330
import jdk.jfr.internal.query.Query.OrderElement;

src/jdk.jfr/share/classes/jdk/jfr/internal/settings/LevelSetting.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
3939
@MetadataDefinition
4040
@Label("Level")
4141
@Name(Type.SETTINGS_PREFIX + "Level")
42-
public class LevelSetting extends JDKSettingControl {
42+
public final class LevelSetting extends JDKSettingControl {
4343
private final PlatformEventType eventType;
4444
private final List<String> levels;
4545
private String value;

src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Disassemble.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -223,9 +223,9 @@ private void splitFile(Path directory, Path file, List<Long> splitPositions) thr
223223
Path p = directory.resolve(formattedFilename);
224224
File splittedFile = p.toFile();
225225
println("Writing " + splittedFile + " ... " + bytes.length);
226-
FileOutputStream fos = new FileOutputStream(splittedFile);
227-
fos.write(bytes);
228-
fos.close();
226+
try (var fos = new FileOutputStream(splittedFile)) {
227+
fos.write(bytes);
228+
}
229229
}
230230
} catch (IOException ioe) {
231231
throw new UserDataException("i/o error writing file " + file);

src/jdk.jfr/share/classes/jdk/jfr/internal/tool/PrettyWriter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
3030
import java.time.OffsetDateTime;
3131
import java.time.format.DateTimeFormatter;
3232
import java.time.temporal.ChronoUnit;
33-
import java.util.ArrayList;
3433
import java.util.List;
3534
import java.util.StringJoiner;
3635

src/jdk.jfr/share/classes/jdk/jfr/internal/tool/View.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
3333
import java.util.List;
3434

3535
import jdk.jfr.consumer.EventStream;
36-
import jdk.jfr.internal.util.Columnizer;
3736
import jdk.jfr.internal.query.ViewPrinter;
3837
import jdk.jfr.internal.query.Configuration;
3938
import jdk.jfr.internal.query.Configuration.Truncate;

src/jdk.jfr/share/classes/jdk/jfr/internal/util/ValueParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
3131
import static java.util.concurrent.TimeUnit.MINUTES;
3232
import static java.util.concurrent.TimeUnit.SECONDS;
3333

34-
public class ValueParser {
34+
public final class ValueParser {
3535
private static final String INFINITY = "infinity";
3636

3737
public static long parseTimespanWithInfinity(String s) {

0 commit comments

Comments
 (0)