Skip to content

Commit

Permalink
Moved SuppressForbidden to an internal package (not exposed by the mo…
Browse files Browse the repository at this point in the history
…dule). Minor cleanups. Add static require on jdk.management for RamUsageEstimator.
  • Loading branch information
dweiss committed May 22, 2024
1 parent aa872e8 commit f30bbf6
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
package com.carrotsearch.hppc.examples;

import com.carrotsearch.hppc.SuppressForbidden;
import com.carrotsearch.hppc.internals.SuppressForbidden;
import java.util.Locale;

class Helpers {
Expand Down
2 changes: 1 addition & 1 deletion hppc/src/main/java/com/carrotsearch/hppc/BitSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @see #asLongLookupContainer()
*/
public class BitSet implements Cloneable {
/** The initial default number of bits ({@value #DEFAULT_NUM_BITS}). */
/** The initial default number of bits. */
private static final long DEFAULT_NUM_BITS = 64;

/** Internal representation of bits in this bit set. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.IllegalFormatException;
import java.util.Locale;

@SuppressWarnings("serial")
public class BufferAllocationException extends RuntimeException {
public BufferAllocationException(String message) {
super(message);
Expand Down
1 change: 1 addition & 0 deletions hppc/src/main/java/com/carrotsearch/hppc/Containers.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package com.carrotsearch.hppc;

import com.carrotsearch.hppc.internals.SuppressForbidden;
import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down
2 changes: 1 addition & 1 deletion hppc/src/main/java/com/carrotsearch/hppc/PgmIndexUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
package com.carrotsearch.hppc;

/** Utility methods for {@code KTypePgmIndex}. */
class PgmIndexUtil {
final class PgmIndexUtil {

/** Adds the first key of the current segment to the segment data bytes. */
static <KType> void addKey(KType key, IntArrayList segmentData) {
Expand Down
17 changes: 4 additions & 13 deletions hppc/src/main/java/com/carrotsearch/hppc/RamUsageEstimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
* <p>Mostly forked from Lucene tag releases/lucene-solr/8.5.1
*/
final class RamUsageEstimator {
/** One kilobyte bytes. */
static final long ONE_KB = 1024;

/** One megabyte bytes. */
static final long ONE_MB = ONE_KB * ONE_KB;

/** One gigabyte bytes. */
static final long ONE_GB = ONE_KB * ONE_MB;

/** No instantiation. */
private RamUsageEstimator() {}

Expand Down Expand Up @@ -84,7 +75,7 @@ private RamUsageEstimator() {}
if (datamodel != null) {
is64Bit = datamodel.contains("64");
}
} catch (SecurityException ex) {
} catch (SecurityException ignored) {
}
if (datamodel == null) {
is64Bit = OS_ARCH != null && OS_ARCH.contains("64");
Expand All @@ -110,17 +101,17 @@ private RamUsageEstimator() {}
compressedOops =
Boolean.parseBoolean(
vmOption.getClass().getMethod("getValue").invoke(vmOption).toString());
} catch (ReflectiveOperationException | RuntimeException e) {
} catch (ReflectiveOperationException | RuntimeException ignored) {
}
try {
final Object vmOption = getVMOptionMethod.invoke(hotSpotBean, "ObjectAlignmentInBytes");
objectAlignment =
Integer.parseInt(
vmOption.getClass().getMethod("getValue").invoke(vmOption).toString());
} catch (ReflectiveOperationException | RuntimeException e) {
} catch (ReflectiveOperationException | RuntimeException ignored) {
}
}
} catch (ReflectiveOperationException | RuntimeException e) {
} catch (ReflectiveOperationException | RuntimeException ignored) {
}
COMPRESSED_REFS_ENABLED = compressedOops;
NUM_BYTES_OBJECT_ALIGNMENT = objectAlignment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package com.carrotsearch.hppc;
package com.carrotsearch.hppc.internals;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
2 changes: 2 additions & 0 deletions hppc/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module com.carrotsearch.hppc {
requires java.logging;
requires static jdk.management;

exports com.carrotsearch.hppc;
exports com.carrotsearch.hppc.cursors;
exports com.carrotsearch.hppc.procedures;
exports com.carrotsearch.hppc.comparators;
exports com.carrotsearch.hppc.predicates;
exports com.carrotsearch.hppc.sorting;
exports com.carrotsearch.hppc.internals;
}

0 comments on commit f30bbf6

Please sign in to comment.