Skip to content

Commit

Permalink
Version 2.2.1, fix inverted condition in CopyRecordParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
DenWav committed Jul 31, 2023
1 parent 00d95b0 commit 5198b29
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group = dev.denwav.hypo
version = 2.2.1-SNAPSHOT
version = 2.2.1

org.gradle.parallel=true
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public void testAbstractEnums() throws Exception {
assertTrue(testClass.isAll(ClassKind.ENUM, ClassKind.ABSTRACT_CLASS));
assertTrue(testClass.isAll(EnumSet.of(ClassKind.ENUM, ClassKind.ABSTRACT_CLASS)));

// `true` isNot
assertTrue(testClass.isNot(ClassKind.INTERFACE));
assertTrue(testClass.isNot(ClassKind.RECORD));

// `false` is
assertFalse(testClass.is(ClassKind.INTERFACE));
assertFalse(testClass.is(ClassKind.RECORD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ private static <T> boolean containsAny(final Set<T> set, final List<T> list) {
return false;
}

@SuppressWarnings("ReferenceEquality")
private @NotNull Graph<HydrationProvider<?>, DefaultEdge> createProviderGraph() {
final ArrayList<HydrationProvider<?>> allProviders =
new ArrayList<>(this.classProviders.size() + this.methodProviders.size() + this.fieldProviders.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void contribute(
return;
}

if (currentClass.is(ClassKind.RECORD)) {
if (currentClass.isNot(ClassKind.RECORD)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,13 @@ abstract class HypoModelUtilHelper {
*/
abstract <T> @NotNull List<T> asImmutableList(final @NotNull Collection<T> list);

/**
* Create an immutable list from the given array.
*
* @param array The arry to return as an immutable list.
* @return The new immutable list.
* @param <T> The type param of the list.
*/
@SuppressWarnings("unchecked")
abstract <T> @NotNull List<T> immutableListOf(final @NotNull T @NotNull ... array);
}
10 changes: 10 additions & 0 deletions hypo-model/src/main/java/dev/denwav/hypo/model/data/ClassData.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ default boolean is(final @NotNull ClassKind kind) {
return this.kinds().contains(kind);
}

/**
* Returns {@code true} if this class data does not represent the given kind. This is the inverse of {@link #is(ClassKind)}.
* @param kind The {@link ClassKind} to test against this class data
* @return {@code true} if this class data does not represent the given kind.
* @see #is(ClassKind)
*/
default boolean isNot(final @NotNull ClassKind kind) {
return !this.is(kind);
}

/**
* Returns {@code true} if this class data represents <b>any</b> of the given kinds.
* @param kinds The array of {@link ClassKind kinds} to test against this class data.
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hypo
====

[![Maven Central Version 2.2.0](https://img.shields.io/badge/Maven_Central-2.2.0-blue?logo=apache-maven&style=flat)](https://search.maven.org/search?q=g:dev.denwav.hypo)
[![Maven Central Version 2.2.1](https://img.shields.io/badge/Maven_Central-2.2.1-blue?logo=apache-maven&style=flat)](https://search.maven.org/search?q=g:dev.denwav.hypo)
[![Test](https://github.com/DenWav/Hypo/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/DenWav/Hypo/actions/workflows/test.yml)

Hypo is a model for Java bytecode inspection. The main idea behind Hypo is to separate the process of determining
Expand Down Expand Up @@ -51,7 +51,7 @@ If you're using Gradle 7.0+ you can also use `hypo-catalog` if you like.
> }
>
> dependencies {
> implementation(platform("dev.denwav.hypo:hypo-platform:2.2.0"))
> implementation(platform("dev.denwav.hypo:hypo-platform:2.2.1"))
> // Whichever modules you need:
> implementation("dev.denwav.hypo:hypo-model")
> implementation("dev.denwav.hypo:hypo-core")
Expand All @@ -74,7 +74,7 @@ If you're using Gradle 7.0+ you can also use `hypo-catalog` if you like.
> }
>
> dependencies {
> implementation platform('dev.denwav.hypo:hypo-platform:2.2.0')
> implementation platform('dev.denwav.hypo:hypo-platform:2.2.1')
> // Whichever modules you need:
> implementation 'dev.denwav.hypo:hypo-model'
> implementation 'dev.denwav.hypo:hypo-core'
Expand All @@ -98,7 +98,7 @@ If you're using Gradle 7.0+ you can also use `hypo-catalog` if you like.
> <dependency>
> <groupId>dev.denwav.hypo</groupId>
> <artifactId>hypo-platform</artifactId>
> <version>2.2.0</version>
> <version>2.2.1</version>
> </dependency>
> </dependencies>
> </dependencyManagement>
Expand Down

0 comments on commit 5198b29

Please sign in to comment.