diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml
index 61db0dc6d..dd76c6718 100644
--- a/.github/workflows/maven-publish.yml
+++ b/.github/workflows/maven-publish.yml
@@ -14,9 +14,9 @@ on:
workflow_dispatch:
inputs:
revision:
- description: 'The version to release'
+ description: 'The version to publish (must match ${major}.${minor}.${patch})'
required: true
- default: '0.0.1-SNAPSHOT'
+ default: '${major}.${minor}.${patch}'
jobs:
build:
@@ -26,6 +26,13 @@ jobs:
- name: Checkout Source
uses: actions/checkout@v5
+ - name: Validate version format
+ run: |
+ if ! echo "${{ inputs.revision }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
+ echo "Error: version '${{ inputs.revision }}' does not match the required pattern major.minor.patch"
+ exit 1
+ fi
+
- name: Setup Maven Central Repository
uses: actions/setup-java@v5
with:
@@ -51,3 +58,57 @@ jobs:
SIGN_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID_LONG }}
SIGN_KEY: ${{ secrets.OSS_SIGNING_KEY }}
SIGN_KEY_PASS: ${{ secrets.OSS_SIGNING_PASSWORD }}
+
+ release:
+ runs-on: ubuntu-latest
+ needs: build
+ permissions:
+ contents: write
+ steps:
+ - name: Checkout Source
+ uses: actions/checkout@v5
+ with:
+ fetch-depth: 0
+
+ - name: Create Tag
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ if git rev-parse "${{ inputs.revision }}" >/dev/null 2>&1; then
+ echo "Tag ${{ inputs.revision }} already exists, skipping."
+ else
+ git tag ${{ inputs.revision }}
+ git push origin ${{ inputs.revision }}
+ fi
+
+ - name: Create Release
+ run: |
+ if gh release view "v${{ inputs.revision }}" >/dev/null 2>&1; then
+ echo "Release v${{ inputs.revision }} already exists, skipping."
+ else
+ gh release create v${{ inputs.revision }} \
+ --title "v${{ inputs.revision }}" \
+ --generate-notes \
+ --latest
+ fi
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Increment patch version
+ run: |
+ CURRENT="${{ inputs.revision }}"
+ MAJOR=$(echo "$CURRENT" | cut -d. -f1)
+ MINOR=$(echo "$CURRENT" | cut -d. -f2)
+ PATCH=$(echo "$CURRENT" | cut -d. -f3)
+ NEXT_PATCH=$((PATCH + 1))
+ NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT"
+ sed -i "s|^\( *\)[^<]*|\1${NEXT_VERSION}|" pom.xml
+ echo "Bumped version from ${CURRENT} to ${NEXT_VERSION}"
+
+ - name: Commit and push next version
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git add pom.xml
+ git diff --cached --quiet && echo "No changes to commit" || \
+ git commit -m "chore: bump version to next patch after publishing ${{ inputs.revision }}" && git push
diff --git a/.github/workflows/merge-main-to-branches.yml b/.github/workflows/merge-main-to-branches.yml
new file mode 100644
index 000000000..f47152388
--- /dev/null
+++ b/.github/workflows/merge-main-to-branches.yml
@@ -0,0 +1,66 @@
+# This workflow automatically merges the 'main' branch into 'dev' and 'release' branches
+# whenever changes are pushed to 'main', without requiring manual confirmation.
+
+name: Merge Main to Dev and Release
+
+on:
+ push:
+ branches:
+ - main
+
+concurrency:
+ group: merge-main-to-branches
+ cancel-in-progress: false
+
+jobs:
+ merge-to-dev:
+ name: Merge main → dev
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v5
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Merge main into dev
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ if ! git checkout dev; then
+ echo "::error::Branch 'dev' does not exist. Skipping merge."
+ exit 1
+ fi
+ if ! git merge --no-ff origin/main -m "chore: merge main into dev [skip ci]"; then
+ echo "::error::Merge conflict detected when merging main into dev. Manual intervention required."
+ exit 1
+ fi
+ git push origin dev
+
+ merge-to-release:
+ name: Merge main → release
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v5
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Merge main into release
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ if ! git checkout release; then
+ echo "::error::Branch 'release' does not exist. Skipping merge."
+ exit 1
+ fi
+ if ! git merge --no-ff origin/main -m "chore: merge main into release [skip ci]"; then
+ echo "::error::Merge conflict detected when merging main into release. Manual intervention required."
+ exit 1
+ fi
+ git push origin release
diff --git a/microsphere-java-core/src/main/java/io/microsphere/collection/Lists.java b/microsphere-java-core/src/main/java/io/microsphere/collection/Lists.java
index 6407c2d61..f5851a805 100644
--- a/microsphere-java-core/src/main/java/io/microsphere/collection/Lists.java
+++ b/microsphere-java-core/src/main/java/io/microsphere/collection/Lists.java
@@ -117,11 +117,15 @@ public abstract class Lists implements Utils {
@Nonnull
@Immutable
public static List ofList() {
- if (of0MethodHandle == null) {
+ return ofList0(of0MethodHandle);
+ }
+
+ static List ofList0(MethodHandle methodHandle) {
+ if (methodHandle == null) {
return emptyList();
}
try {
- return (List) of0MethodHandle.invokeExact();
+ return (List) methodHandle.invokeExact();
} catch (Throwable e) {
return emptyList();
}
@@ -146,11 +150,15 @@ public static List ofList() {
@Nonnull
@Immutable
public static List ofList(E e1) {
- if (of1MethodHandle == null) {
+ return ofList1(of1MethodHandle, e1);
+ }
+
+ static List ofList1(MethodHandle methodHandle, E e1) {
+ if (methodHandle == null) {
return singletonList(e1);
}
try {
- return (List) of1MethodHandle.invokeExact(e1);
+ return (List) methodHandle.invokeExact(e1);
} catch (Throwable e) {
return singletonList(e1);
}
@@ -176,11 +184,15 @@ public static List ofList(E e1) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2) {
- if (of2MethodHandle == null) {
+ return ofList2(of2MethodHandle, e1, e2);
+ }
+
+ static List ofList2(MethodHandle methodHandle, E e1, E e2) {
+ if (methodHandle == null) {
return of(e1, e2);
}
try {
- return (List) of2MethodHandle.invokeExact(e1, e2);
+ return (List) methodHandle.invokeExact(e1, e2);
} catch (Throwable e) {
return of(e1, e2);
}
@@ -207,11 +219,15 @@ public static List ofList(E e1, E e2) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3) {
- if (of3MethodHandle == null) {
+ return ofList3(of3MethodHandle, e1, e2, e3);
+ }
+
+ static List ofList3(MethodHandle methodHandle, E e1, E e2, E e3) {
+ if (methodHandle == null) {
return of(e1, e2, e3);
}
try {
- return (List) of3MethodHandle.invokeExact(e1, e2, e3);
+ return (List) methodHandle.invokeExact(e1, e2, e3);
} catch (Throwable e) {
return of(e1, e2, e3);
}
@@ -239,11 +255,15 @@ public static List ofList(E e1, E e2, E e3) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3, E e4) {
- if (of4MethodHandle == null) {
+ return ofList4(of4MethodHandle, e1, e2, e3, e4);
+ }
+
+ static List ofList4(MethodHandle methodHandle, E e1, E e2, E e3, E e4) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4);
}
try {
- return (List) of4MethodHandle.invokeExact(e1, e2, e3, e4);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4);
} catch (Throwable e) {
return of(e1, e2, e3, e4);
}
@@ -272,11 +292,15 @@ public static List ofList(E e1, E e2, E e3, E e4) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3, E e4, E e5) {
- if (of5MethodHandle == null) {
+ return ofList5(of5MethodHandle, e1, e2, e3, e4, e5);
+ }
+
+ static List ofList5(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5);
}
try {
- return (List) of5MethodHandle.invokeExact(e1, e2, e3, e4, e5);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5);
}
@@ -298,11 +322,15 @@ public static List ofList(E e1, E e2, E e3, E e4, E e5) {
@Nonnull
@Immutable
static List ofList(E e1, E e2, E e3, E e4, E e5, E e6) {
- if (of6MethodHandle == null) {
+ return ofList6(of6MethodHandle, e1, e2, e3, e4, e5, e6);
+ }
+
+ static List ofList6(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6);
}
try {
- return (List) of6MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6);
}
@@ -333,11 +361,15 @@ static List ofList(E e1, E e2, E e3, E e4, E e5, E e6) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
- if (of7MethodHandle == null) {
+ return ofList7(of7MethodHandle, e1, e2, e3, e4, e5, e6, e7);
+ }
+
+ static List ofList7(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7);
}
try {
- return (List) of7MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7);
}
@@ -369,11 +401,15 @@ public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
- if (of8MethodHandle == null) {
+ return ofList8(of8MethodHandle, e1, e2, e3, e4, e5, e6, e7, e8);
+ }
+
+ static List ofList8(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7, e8);
}
try {
- return (List) of8MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7, e8);
}
@@ -406,11 +442,15 @@ public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)
@Nonnull
@Immutable
public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
- if (of9MethodHandle == null) {
+ return ofList9(of9MethodHandle, e1, e2, e3, e4, e5, e6, e7, e8, e9);
+ }
+
+ static List ofList9(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7, e8, e9);
}
try {
- return (List) of9MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8, e9);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8, e9);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7, e8, e9);
}
@@ -436,11 +476,15 @@ public static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8,
@Nonnull
@Immutable
static List ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
- if (of10MethodHandle == null) {
+ return ofList10(of10MethodHandle, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
+ }
+
+ static List ofList10(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
}
try {
- return (List) of10MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
+ return (List) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
}
@@ -470,11 +514,15 @@ public static List ofList(E... elements) {
if (length(elements) < 1) {
return ofList();
}
- if (ofMethodHandle == null) {
+ return ofListElements(ofMethodHandle, elements);
+ }
+
+ static List ofListElements(MethodHandle methodHandle, E[] elements) {
+ if (methodHandle == null) {
return of(elements);
}
try {
- return (List) ofMethodHandle.invokeExact(elements);
+ return (List) methodHandle.invokeExact(elements);
} catch (Throwable e) {
return of(elements);
}
diff --git a/microsphere-java-core/src/main/java/io/microsphere/collection/Maps.java b/microsphere-java-core/src/main/java/io/microsphere/collection/Maps.java
index a3716cf12..093ec44c4 100644
--- a/microsphere-java-core/src/main/java/io/microsphere/collection/Maps.java
+++ b/microsphere-java-core/src/main/java/io/microsphere/collection/Maps.java
@@ -114,11 +114,15 @@ public abstract class Maps implements Utils {
@Nonnull
@Immutable
public static Map ofMap() {
- if (of0MethodHandle == null) {
+ return ofMap0(of0MethodHandle);
+ }
+
+ static Map ofMap0(MethodHandle methodHandle) {
+ if (methodHandle == null) {
return emptyMap();
}
try {
- return (Map) of0MethodHandle.invokeExact();
+ return (Map) methodHandle.invokeExact();
} catch (Throwable e) {
return emptyMap();
}
@@ -144,11 +148,15 @@ public static Map ofMap() {
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1) {
- if (of1MethodHandle == null) {
+ return ofMap1(of1MethodHandle, k1, v1);
+ }
+
+ static Map ofMap1(MethodHandle methodHandle, K k1, V v1) {
+ if (methodHandle == null) {
return singletonMap(k1, v1);
}
try {
- return (Map) of1MethodHandle.invokeExact(k1, v1);
+ return (Map) methodHandle.invokeExact(k1, v1);
} catch (Throwable e) {
return singletonMap(k1, v1);
}
@@ -175,11 +183,15 @@ public static Map ofMap(K k1, V v1) {
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2) {
- if (of2MethodHandle == null) {
+ return ofMap2(of2MethodHandle, k1, v1, k2, v2);
+ }
+
+ static Map ofMap2(MethodHandle methodHandle, K k1, V v1, K k2, V v2) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2);
}
try {
- return (Map) of2MethodHandle.invokeExact(k1, v1, k2, v2);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2);
} catch (Throwable e) {
return of(k1, v1, k2, v2);
}
@@ -208,11 +220,15 @@ public static Map ofMap(K k1, V v1, K k2, V v2) {
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3) {
- if (of3MethodHandle == null) {
+ return ofMap3(of3MethodHandle, k1, v1, k2, v2, k3, v3);
+ }
+
+ static Map ofMap3(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3);
}
try {
- return (Map) of3MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3);
}
@@ -243,11 +259,15 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3) {
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
- if (of4MethodHandle == null) {
+ return ofMap4(of4MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4);
+ }
+
+ static Map ofMap4(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4);
}
try {
- return (Map) of4MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4);
}
@@ -280,11 +300,15 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
- if (of5MethodHandle == null) {
+ return ofMap5(of5MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
+ }
+
+ static Map ofMap5(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
}
try {
- return (Map) of5MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
}
@@ -319,11 +343,15 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) {
- if (of6MethodHandle == null) {
+ return ofMap6(of6MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
+ }
+
+ static Map ofMap6(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
}
try {
- return (Map) of6MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
}
@@ -361,11 +389,15 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Nonnull
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) {
- if (of7MethodHandle == null) {
+ return ofMap7(of7MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
+ }
+
+ static Map ofMap7(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
}
try {
- return (Map) of7MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
}
@@ -406,11 +438,16 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
K k8, V v8) {
- if (of8MethodHandle == null) {
+ return ofMap8(of8MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
+ }
+
+ static Map ofMap8(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
+ K k8, V v8) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
}
try {
- return (Map) of8MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
}
@@ -453,11 +490,16 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
K k8, V v8, K k9, V v9) {
- if (of9MethodHandle == null) {
+ return ofMap9(of9MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9);
+ }
+
+ static Map ofMap9(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
+ K k8, V v8, K k9, V v9) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9);
}
try {
- return (Map) of9MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9);
}
@@ -503,11 +545,16 @@ public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V
@Immutable
public static Map ofMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
K k8, V v8, K k9, V v9, K k10, V v10) {
- if (of10MethodHandle == null) {
+ return ofMap10(of10MethodHandle, k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9, k10, v10);
+ }
+
+ static Map ofMap10(MethodHandle methodHandle, K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7,
+ K k8, V v8, K k9, V v9, K k10, V v10) {
+ if (methodHandle == null) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9, k10, v10);
}
try {
- return (Map) of10MethodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9, k10, v10);
+ return (Map) methodHandle.invokeExact(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9, k10, v10);
} catch (Throwable e) {
return of(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8, k9, v9, k10, v10);
}
@@ -539,11 +586,15 @@ public static Map ofMap(Map.Entry extends K, ? extends V>... entr
if (length(entries) < 1) {
return emptyMap();
}
- if (ofEntriesMethodHandle == null) {
+ return ofMapEntries(ofEntriesMethodHandle, entries);
+ }
+
+ static Map ofMapEntries(MethodHandle methodHandle, Map.Entry extends K, ? extends V>[] entries) {
+ if (methodHandle == null) {
return of(entries);
}
try {
- return (Map) ofEntriesMethodHandle.invokeExact(entries);
+ return (Map) methodHandle.invokeExact(entries);
} catch (Throwable e) {
return of(entries);
}
diff --git a/microsphere-java-core/src/main/java/io/microsphere/collection/Sets.java b/microsphere-java-core/src/main/java/io/microsphere/collection/Sets.java
index 9c4891a43..f8effe0e5 100644
--- a/microsphere-java-core/src/main/java/io/microsphere/collection/Sets.java
+++ b/microsphere-java-core/src/main/java/io/microsphere/collection/Sets.java
@@ -119,11 +119,15 @@ public abstract class Sets implements Utils {
@Nonnull
@Immutable
public static Set ofSet() {
- if (of0MethodHandle == null) {
+ return ofSet0(of0MethodHandle);
+ }
+
+ static Set ofSet0(MethodHandle methodHandle) {
+ if (methodHandle == null) {
return emptySet();
}
try {
- return (Set) of0MethodHandle.invokeExact();
+ return (Set) methodHandle.invokeExact();
} catch (Throwable e) {
return emptySet();
}
@@ -152,11 +156,15 @@ public static Set ofSet() {
@Nonnull
@Immutable
public static Set ofSet(E e1) {
- if (of1MethodHandle == null) {
+ return ofSet1(of1MethodHandle, e1);
+ }
+
+ static Set ofSet1(MethodHandle methodHandle, E e1) {
+ if (methodHandle == null) {
return singleton(e1);
}
try {
- return (Set) of1MethodHandle.invokeExact(e1);
+ return (Set) methodHandle.invokeExact(e1);
} catch (Throwable e) {
return singleton(e1);
}
@@ -185,11 +193,15 @@ public static Set ofSet(E e1) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2) {
- if (of2MethodHandle == null) {
+ return ofSet2(of2MethodHandle, e1, e2);
+ }
+
+ static Set ofSet2(MethodHandle methodHandle, E e1, E e2) {
+ if (methodHandle == null) {
return of(e1, e2);
}
try {
- return (Set) of2MethodHandle.invokeExact(e1, e2);
+ return (Set) methodHandle.invokeExact(e1, e2);
} catch (Throwable e) {
return of(e1, e2);
}
@@ -219,11 +231,15 @@ public static Set ofSet(E e1, E e2) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3) {
- if (of3MethodHandle == null) {
+ return ofSet3(of3MethodHandle, e1, e2, e3);
+ }
+
+ static Set ofSet3(MethodHandle methodHandle, E e1, E e2, E e3) {
+ if (methodHandle == null) {
return of(e1, e2, e3);
}
try {
- return (Set) of3MethodHandle.invokeExact(e1, e2, e3);
+ return (Set) methodHandle.invokeExact(e1, e2, e3);
} catch (Throwable e) {
return of(e1, e2, e3);
}
@@ -254,11 +270,15 @@ public static Set ofSet(E e1, E e2, E e3) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3, E e4) {
- if (of4MethodHandle == null) {
+ return ofSet4(of4MethodHandle, e1, e2, e3, e4);
+ }
+
+ static Set ofSet4(MethodHandle methodHandle, E e1, E e2, E e3, E e4) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4);
}
try {
- return (Set) of4MethodHandle.invokeExact(e1, e2, e3, e4);
+ return (Set) methodHandle.invokeExact(e1, e2, e3, e4);
} catch (Throwable e) {
return of(e1, e2, e3, e4);
}
@@ -279,11 +299,15 @@ public static Set ofSet(E e1, E e2, E e3, E e4) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3, E e4, E e5) {
- if (of5MethodHandle == null) {
+ return ofSet5(of5MethodHandle, e1, e2, e3, e4, e5);
+ }
+
+ static Set ofSet5(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5);
}
try {
- return (Set) of5MethodHandle.invokeExact(e1, e2, e3, e4, e5);
+ return (Set) methodHandle.invokeExact(e1, e2, e3, e4, e5);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5);
}
@@ -316,11 +340,15 @@ public static Set ofSet(E e1, E e2, E e3, E e4, E e5) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3, E e4, E e5, E e6) {
- if (of6MethodHandle == null) {
+ return ofSet6(of6MethodHandle, e1, e2, e3, e4, e5, e6);
+ }
+
+ static Set ofSet6(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6);
}
try {
- return (Set) of6MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6);
+ return (Set) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6);
}
@@ -354,11 +382,15 @@ public static Set ofSet(E e1, E e2, E e3, E e4, E e5, E e6) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
- if (of7MethodHandle == null) {
+ return ofSet7(of7MethodHandle, e1, e2, e3, e4, e5, e6, e7);
+ }
+
+ static Set ofSet7(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7);
}
try {
- return (Set) of7MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7);
+ return (Set) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7);
}
@@ -393,11 +425,15 @@ public static Set ofSet(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
@Nonnull
@Immutable
public static Set ofSet(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
- if (of8MethodHandle == null) {
+ return ofSet8(of8MethodHandle, e1, e2, e3, e4, e5, e6, e7, e8);
+ }
+
+ static Set ofSet8(MethodHandle methodHandle, E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
+ if (methodHandle == null) {
return of(e1, e2, e3, e4, e5, e6, e7, e8);
}
try {
- return (Set) of8MethodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8);
+ return (Set) methodHandle.invokeExact(e1, e2, e3, e4, e5, e6, e7, e8);
} catch (Throwable e) {
return of(e1, e2, e3, e4, e5, e6, e7, e8);
}
@@ -433,11 +469,15 @@ public static