Skip to content

Commit

Permalink
Update EA versions: 19, 20 & 21
Browse files Browse the repository at this point in the history
Signed-off-by: Aqsa Malik <aqsa.malik@bnymellon.com>
  • Loading branch information
aqsa505 committed Feb 21, 2023
1 parent 6b159c2 commit a30bf7a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/earlyaccess-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
java-version: [18]
java-version: [19, 20, 21]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/earlyaccess-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
java-version: [18]
java-version: [19, 20, 21]

runs-on: ${{ matrix.os }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;

import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.factory.SortedSets;
Expand Down Expand Up @@ -91,6 +93,17 @@ public static boolean isProperSubsetOf(Class<?> subsetClass, Class<?> supersetCl
return comparer.getMethodNames(subsetClass).isProperSubsetOf(comparer.getMethodNames(supersetClass));
}

public static boolean isProperSupersetOfInstance(Class<?> supersetClass, Class<?> subsetClass)
{
return ClassComparer.isProperSubsetOfInstance(subsetClass, supersetClass);
}

public static boolean isProperSubsetOfInstance(Class<?> subsetClass, Class<?> supersetClass)
{
ClassComparer comparer = new ClassComparer(true, true, true);
return comparer.getInstanceMethodNames(subsetClass).isProperSubsetOf(comparer.getInstanceMethodNames(supersetClass));
}

public Triplet<MutableSortedSet<String>> compare(Class<?> leftClass, Class<?> rightClass)
{
MutableSortedSet<String> intersection = this.intersect(leftClass, rightClass);
Expand Down Expand Up @@ -179,6 +192,12 @@ public MutableSortedSet<String> getMethodNames(Class<?> classOne)
return ArrayIterate.collectIf(classOne.getMethods(), this::includeMethod, this::methodName, SortedSets.mutable.empty());
}

public MutableSortedSet<String> getInstanceMethodNames(Class<?> classOne)
{
Method[] instanceMethods = Arrays.stream(classOne.getMethods()).filter(method -> !Modifier.isStatic(method.getModifiers())).toArray(Method[]::new);
return ArrayIterate.collectIf(instanceMethods, this::includeMethod, this::methodName, SortedSets.mutable.empty());
}

public void includeObjectMethods()
{
this.includeObjectMethods = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void constructorOfIterableOfPairs()
@Test
public void unifiedMapProperSuperSetOfHashMap()
{
Assert.assertTrue(ClassComparer.isProperSupersetOf(UnifiedMap.class, HashMap.class));
Assert.assertTrue(ClassComparer.isProperSupersetOfInstance(UnifiedMap.class, HashMap.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void newSetWithIterable()
@Test
public void unifiedSetProperSuperSetOfHashSet()
{
Assert.assertTrue(ClassComparer.isProperSupersetOf(UnifiedSet.class, HashSet.class));
Assert.assertTrue(ClassComparer.isProperSupersetOfInstance(UnifiedSet.class, HashSet.class));
}

@Override
Expand Down

0 comments on commit a30bf7a

Please sign in to comment.