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

X.26 #638

Merged
merged 44 commits into from
May 28, 2024
Merged

X.26 #638

Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1279634
Initial branch of x.26
peter-lawrey Mar 25, 2024
b7a294f
Error on deprecated cleanup (#637)
peter-lawrey Mar 26, 2024
212cde2
Deprecate due x.26
yevgenp Mar 27, 2024
eae1252
restore UnsafeMemory.copyMemory
peter-lawrey Mar 28, 2024
e1eaebe
Remove se.eris.notnull.instrument
peter-lawrey Mar 28, 2024
077e702
Use a common configuration for the compiler-plugin where deprecation …
peter-lawrey Mar 28, 2024
5dbc1ae
sun.misc.Unsafe usage produces a warning
peter-lawrey Mar 28, 2024
d7d811d
review with lint:all (#641)
peter-lawrey Apr 3, 2024
f38d749
Tidy up compiler setting and some warnings
peter-lawrey Apr 3, 2024
515eee2
Revert changes to Jvm.parseSize
yevgenp Apr 3, 2024
75b2139
Consolidate references to Thread.currentThread.getId()
peter-lawrey Apr 3, 2024
0156d32
Add uncheckedCast to Jvm
peter-lawrey Apr 3, 2024
87f873a
Add uncheckedCast to Jvm
peter-lawrey Apr 4, 2024
c3a4ceb
Fix deprecated methods/classes in Core (#642)
peter-lawrey Apr 4, 2024
6fc1484
Tidy up code base
peter-lawrey Apr 8, 2024
b877bd6
resolve Javadoc issues
peter-lawrey Apr 10, 2024
233f7fb
Added fail on warning lint for Javadoc, and rawtypes fixes for Bytes …
peter-lawrey Apr 12, 2024
4d94a4a
review with lint:all (#641)
peter-lawrey Apr 3, 2024
d0241a7
Fix javadoc issues
peter-lawrey Apr 12, 2024
d3cc44d
Fix a rounding error
peter-lawrey Apr 15, 2024
5d86617
Javadoc fixes from x.26 (#650)
peter-lawrey Apr 15, 2024
edd7385
Deprecate due x.26
yevgenp Mar 27, 2024
de7bb6e
Remove se.eris.notnull.instrument
peter-lawrey Mar 28, 2024
0bc7839
resolve Javadoc issues
peter-lawrey Apr 10, 2024
61ee920
Fix Javadoc formatting
peter-lawrey Apr 15, 2024
3464ec5
Fix test after merge
peter-lawrey Apr 16, 2024
d50490a
Fix warnings following rebase with develop
peter-lawrey Apr 29, 2024
55003c5
Fix warnings following rebase with develop
peter-lawrey Apr 30, 2024
e8b7bc0
Fix newlines
peter-lawrey May 7, 2024
5bd791b
</p> tag in javadoc not allowed
peter-lawrey May 20, 2024
7b27376
Flaky test (#653)
peter-lawrey May 3, 2024
09d9c6b
Core/issues/656 (#657)
peter-lawrey May 20, 2024
a6cceaa
Recover from java21 failure (#658)
peter-lawrey May 20, 2024
633919b
review with lint:all (#641)
peter-lawrey Apr 3, 2024
768a692
Tidy up compiler setting and some warnings
peter-lawrey Apr 3, 2024
bd456fc
Merge with develop
peter-lawrey May 20, 2024
0926def
Merge with develop
peter-lawrey May 20, 2024
d1e9cb1
Tidy up compiler setting and some warnings
peter-lawrey Apr 3, 2024
69ccb4e
remove duplicate
peter-lawrey May 20, 2024
9f35eb7
parent poms -> x.26.0
peter-lawrey May 22, 2024
7f607b9
Where marked for removal, also mark for deprecation
peter-lawrey May 23, 2024
442b218
Allow for aarch64 CPUs
peter-lawrey May 23, 2024
2c3a43d
This class was left here for backward compatibility.
peter-lawrey May 28, 2024
8b93b0b
Merge branch 'develop' into x.26
peter-lawrey May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion assertions-disabled/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>net.openhft</groupId>
<artifactId>java-parent-pom</artifactId>
<version>1.24.0</version>
<version>1.26.0-SNAPSHOT</version>
<relativePath />
</parent>

Expand Down
2 changes: 1 addition & 1 deletion assertions-enabled/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>net.openhft</groupId>
<artifactId>java-parent-pom</artifactId>
<version>1.24.0</version>
<version>1.26.0-SNAPSHOT</version>
<relativePath />
</parent>

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>net.openhft</groupId>
<artifactId>java-parent-pom</artifactId>
<version>1.24.0</version>
<version>1.26.0-SNAPSHOT</version>
<relativePath />
</parent>

Expand All @@ -41,15 +41,15 @@
<dependency>
<groupId>net.openhft</groupId>
<artifactId>third-party-bom</artifactId>
<version>3.24.0</version>
<version>3.26.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>net.openhft</groupId>
<artifactId>chronicle-bom</artifactId>
<version>2.25ea-SNAPSHOT</version>
<version>2.26ea-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion checked-exceptions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>net.openhft</groupId>
<artifactId>java-parent-pom</artifactId>
<version>1.24.0</version>
<version>1.26.0-SNAPSHOT</version>
<relativePath/>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions checked-exceptions/src/main/java/java/lang/Appendable.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface Appendable {
/**
* Appends the specified character sequence to this <code>Appendable</code>.
* <p>
* <p> Depending on which class implements the character sequence
* Depending on which class implements the character sequence
* <code>csq</code>, the entire sequence may not be appended. For
* instance, if <code>csq</code> is a {@link java.nio.CharBuffer} then
* the subsequence to append is defined by the buffer's position and limit.
Expand All @@ -40,7 +40,7 @@ public interface Appendable {
* Appends a subsequence of the specified character sequence to this
* <code>Appendable</code>.
* <p>
* <p> An invocation of this method of the form <code>out.append(csq, start,
* An invocation of this method of the form <code>out.append(csq, start,
* end)</code> when <code>csq</code> is not <code>null</code>, behaves in
* exactly the same way as the invocation
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface CharSequence {
* index zero, the next at index one, and so on, as for array
* indexing.
* <p>
* <p>If the <code>char</code> value specified by the index is a
* If the <code>char</code> value specified by the index is a
* <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
*
Expand Down
60 changes: 9 additions & 51 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<parent>
<groupId>net.openhft</groupId>
<artifactId>java-parent-pom</artifactId>
<version>1.25.4</version>
<relativePath />
<version>1.26.0-SNAPSHOT</version>
<relativePath></relativePath>
</parent>
<artifactId>chronicle-core</artifactId>
<version>2.25ea15-SNAPSHOT</version>
<version>2.26ea0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>OpenHFT/Chronicle Core</name>
<description>Chronicle-Core</description>
Expand All @@ -48,15 +48,15 @@
<dependency>
<groupId>net.openhft</groupId>
<artifactId>third-party-bom</artifactId>
<version>3.25.0</version>
<version>3.26.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>net.openhft</groupId>
<artifactId>chronicle-bom</artifactId>
<version>2.25ea-SNAPSHOT</version>
<version>2.26ea-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -165,22 +165,6 @@

<build>
<plugins>
<!-- The parent POM defines this plugin and activates it in a profile. Unfortunately this plugin will generate
code at @NotNull call-sites that throws IllegalArgumentException rather than NullPointerException. This will
break various core tests. Chronicle have raised this issue before with the maintainers of the plugin. See:
https://github.com/osundblad/intellij-annotations-instrumenter-maven-plugin/issues/53
-->
<plugin>
<groupId>se.eris</groupId>
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<notNull>
<!-- Not ideal but this was the easiest way to effectively disable this plugin -->
<param>Ignore</param>
</notNull>
</configuration>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
Expand Down Expand Up @@ -234,7 +218,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-Xlint:deprecation</compilerArgument>
<compilerArgument>-Xlint:all,-options</compilerArgument>
<failOnWarning>false</failOnWarning>
</configuration>
<!-- build a multi-release jar -->
<executions>
Expand Down Expand Up @@ -335,38 +320,10 @@
</executions>
</plugin>

<!-- Enable once https://github.com/osundblad/intellij-annotations-instrumenter-maven-plugin/issues/53 has been fixed
<plugin>
<groupId>se.eris</groupId>
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>instrument</goal>
<goal>tests-instrument</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
</dependency>
</dependencies>
</plugin>-->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>8</source>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -380,7 +337,7 @@
<profile>
<id>java11</id>
<activation>
<jdk>[11,</jdk>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
Expand All @@ -394,6 +351,7 @@
<arg>--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED</arg>
<arg>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</arg>
</compilerArgs>
<failOnWarning>false</failOnWarning>
</configuration>
</plugin>
</plugins>
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/net/openhft/chronicle/core/ChronicleInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import java.util.ServiceLoader;

import static net.openhft.chronicle.core.internal.Bootstrap.uncheckedCast;

/**
* Handles application code which must be loaded first/run and may override system properties.
* <p>
Expand Down Expand Up @@ -50,8 +52,8 @@ private ChronicleInit() {
String initRunnableClass = System.getProperty(CHRONICLE_INIT_CLASS);
if (initRunnableClass != null && !initRunnableClass.isEmpty()) {
try {
Class<? extends Runnable> descendant = (Class<? extends Runnable>) Class.forName(initRunnableClass);
Runnable chronicleInit = descendant.newInstance();
Class<? extends Runnable> descendant = uncheckedCast(Class.forName(initRunnableClass));
Runnable chronicleInit = descendant.getConstructor().newInstance();
chronicleInit.run();
} catch (Exception ex) {
// System.err since the logging subsystem may not be up at this point
Expand Down Expand Up @@ -89,8 +91,8 @@ static void postInit() {
String initRunnableClass = System.getProperty(CHRONICLE_POSTINIT_CLASS);
if (initRunnableClass != null && !initRunnableClass.isEmpty()) {
try {
Class<? extends Runnable> descendant = (Class<? extends Runnable>) Class.forName(initRunnableClass);
Runnable chronicleInit = descendant.newInstance();
Class<? extends Runnable> descendant = uncheckedCast(Class.forName(initRunnableClass));
Runnable chronicleInit = descendant.getConstructor().newInstance();
chronicleInit.run();
} catch (Exception ex) {
// System.err since the logging subsystem may not be up at this point
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/net/openhft/chronicle/core/Jvm.java
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public static Field getFieldOrNull(@NotNull final Class<?> clazz, @NotNull final
@NotNull
public static Method getMethod(@NotNull final Class<?> clazz,
@NotNull final String methodName,
final Class... argTypes) {
final Class<?>... argTypes) {
return ClassUtil.getMethod0(clazz, methodName, argTypes, true);
}

Expand Down Expand Up @@ -618,7 +618,7 @@ public static <V> V getValue(@NotNull Object target, @NotNull final String field
}
aClass = target.getClass();
}
return (V) target;
return uncheckedCast(target);
}

/**
Expand Down Expand Up @@ -1223,8 +1223,7 @@ public static long parseSize(@NotNull String value) throws IllegalArgumentExcept
}
}
double number = Double.parseDouble(value.trim());
factor *= number;
return factor;
return Math.round(factor * number);
}

/**
Expand Down Expand Up @@ -1310,9 +1309,10 @@ private static void doNotCloseOnInterrupt9(final Class<?> clazz, final FileChann
final Class<?> interruptibleClass = field.getType();
ClassUtil.setAccessible(field);
final CommonInterruptible ci = new CommonInterruptible(clazz, fc);
Class<?>[] interfaces = {interruptibleClass};
field.set(fc, Proxy.newProxyInstance(
interruptibleClass.getClassLoader(),
new Class[]{interruptibleClass},
interfaces,
(p, m, a) -> {
if (m.getDeclaringClass() != Object.class)
ci.interrupt();
Expand Down Expand Up @@ -1450,7 +1450,7 @@ public static int objectHeaderSize() {
* @return The object header size or array base offset, depending on the class type.
*/
@Deprecated(/* to be removed in x.27, use net.openhft.chronicle.bytes.BytesUtil.triviallyCopyableStart for POJOs */)
public static int objectHeaderSize(Class type) {
public static int objectHeaderSize(Class<?> type) {
return ObjectHeaderSizeHolder.objectHeaderSize(type);
}

Expand Down Expand Up @@ -1505,7 +1505,6 @@ public static <A extends Annotation> A findAnnotation(AnnotatedElement annotated
* Typically, the name of these classes contains the "$$Lambda" substring.
* Note that this naming convention is JVM-specific and can change
* in future versions. The approach is known to work up to Java 21.
* </p>
*
* @param clazz the class to be checked.
* @return {@code true} if the class is a lambda, {@code false} otherwise.
Expand Down
41 changes: 0 additions & 41 deletions src/main/java/net/openhft/chronicle/core/Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,18 @@
package net.openhft.chronicle.core;

import net.openhft.chronicle.core.annotation.Positive;
import net.openhft.chronicle.core.util.Longs;
import net.openhft.chronicle.core.util.MisAlignedAssertionError;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.misc.Unsafe;

import java.lang.reflect.Field;
import java.nio.ByteBuffer;

import static java.util.Objects.nonNull;
import static net.openhft.chronicle.assertions.AssertUtil.SKIP_ASSERTIONS;
import static net.openhft.chronicle.core.util.Longs.assertIfEnabled;

/**
* The Memory interface provides low-level memory access methods.
*/
public interface Memory {

/**
* Retrieves the amount of heap memory currently used by the application.
*
* @return The number of bytes used in the heap memory.
*/
@Deprecated(/* remove in x.26 */)
default long heapUsed() {
Runtime runtime = Runtime.getRuntime();
return runtime.totalMemory() - runtime.freeMemory();
}

/**
* Ensures that all previous writes to memory are completed before any
* subsequent memory access instruction.
Expand Down Expand Up @@ -368,30 +351,6 @@ default long heapUsed() {
*/
void copyMemory(long fromAddress, long address, long length);

/**
* Deprecated method. Copies a range of bytes from the given byte array to the specified object at the given offset.
*
* @param bytes the source byte array
* @param offset the starting index in the byte array
* @param obj2 the destination object
* @param offset2 the starting offset in the destination object
* @param length the number of bytes to copy
* @deprecated This method is deprecated and will be removed in a future version (x.24).
*/
@Deprecated(/* to be removed in x.26 */)
default void copyMemory(byte[] src, int srcOffset, @Nullable Object dest, long destOffset, int length) {
assert SKIP_ASSERTIONS || nonNull(src);
assert SKIP_ASSERTIONS || assertIfEnabled(Longs.nonNegative(), srcOffset);
assert SKIP_ASSERTIONS || assertIfEnabled(Longs.nonNegative(), destOffset);
assert SKIP_ASSERTIONS || assertIfEnabled(Longs.nonNegative(), length);

if (dest instanceof byte[]) {
copyMemory(src, srcOffset, (byte[]) dest, Math.toIntExact(destOffset - Unsafe.ARRAY_BYTE_BASE_OFFSET), length);
} else {
copyMemory(src, Unsafe.ARRAY_BYTE_BASE_OFFSET + srcOffset, dest, destOffset, length);
}
}

/**
* Copies a range of memory from the given object to the specified memory address.
*
Expand Down