Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
9f9c8c3
Add test: testExecute3OnHandleException
mercyblitz Feb 26, 2026
1547458
Add abstract parameterized LoggingTest
mercyblitz Feb 26, 2026
c00043c
Make ShutdownHookCallbacksThreadTest extend LoggingTest
mercyblitz Feb 26, 2026
6614752
Have test class extend LoggingTest
mercyblitz Feb 26, 2026
22f05dc
Extend ArtifactDetectorTest with LoggingTest
mercyblitz Feb 26, 2026
226fd8b
Guard trace logging with isTraceEnabled check
mercyblitz Feb 26, 2026
f7d89a6
Make JarUtilsTest extend LoggingTest
mercyblitz Feb 26, 2026
7ced9ea
Guard trace logs with isTraceEnabled checks
mercyblitz Feb 26, 2026
ed84b26
Make ClassUtilsTest extend LoggingTest
mercyblitz Feb 26, 2026
78dac16
Guard logger.trace with isTraceEnabled()
mercyblitz Feb 26, 2026
1049f2e
Make FieldUtilsTest extend LoggingTest
mercyblitz Feb 26, 2026
635ed52
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
420dc40
Guard trace logs with isTraceEnabled()
mercyblitz Feb 26, 2026
ac64d1d
Extend resolver test with LoggingTest
mercyblitz Feb 26, 2026
8482399
Convert Loggable to interface; update tests
mercyblitz Feb 26, 2026
26b214c
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
61cfb74
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
26aa1da
Make IOUtilsTest extend LoggingTest
mercyblitz Feb 26, 2026
e2bd8ae
Guard trace logs with isTraceEnabled
mercyblitz Feb 26, 2026
c7d2163
Make StandardFileWatchServiceTest extend LoggingTest
mercyblitz Feb 26, 2026
1f2f4be
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
aa2e719
Make test extend LoggingTest
mercyblitz Feb 26, 2026
5f51bf8
Guard trace log with isTraceEnabled
mercyblitz Feb 26, 2026
5b8a0d6
Make URLUtilsTest extend LoggingTest
mercyblitz Feb 26, 2026
1089014
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
96e03aa
Make ClassicProcessIdResolverTest extend LoggingTest
mercyblitz Feb 26, 2026
2850982
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
ef201f9
Extend ModernProcessIdResolverTest with LoggingTest
mercyblitz Feb 26, 2026
62ee6a3
Guard trace logging with isTraceEnabled()
mercyblitz Feb 26, 2026
d2bba53
Make ProcessExecutorTest extend LoggingTest
mercyblitz Feb 26, 2026
f7d5611
Guard trace logging with isTraceEnabled
mercyblitz Feb 26, 2026
2c6e3e1
Make VM process test extend LoggingTest
mercyblitz Feb 26, 2026
4cd9b50
Add addIfAbsent to ListUtils
mercyblitz Feb 26, 2026
72b5028
Add test for ListUtils.addIfAbsent
mercyblitz Feb 26, 2026
28c3398
Use addIfAbsent and length util in TypeFinder
mercyblitz Feb 26, 2026
cf531eb
Add tests for TypeFinder.getSuperTypes
mercyblitz Feb 26, 2026
db49d6b
Add tests for generic type helpers
mercyblitz Feb 26, 2026
6d572b2
Update FieldUtils.java
mercyblitz Feb 27, 2026
42f38c3
Use handleFieldException in FieldUtilsTest
mercyblitz Feb 27, 2026
9507cf4
Test JSONArray(JSONTokener) constructor
mercyblitz Feb 27, 2026
1b42d00
Remove redundant 'this.' in recursive scan call
mercyblitz Feb 27, 2026
d6ee1e6
Add tests for scanning empty directory and file
mercyblitz Feb 27, 2026
55f94b1
Add StackWalker & MethodHandle caller lookup
mercyblitz Mar 1, 2026
f4b3788
Enhance ReflectionUtilsTest for StackWalker
mercyblitz Mar 1, 2026
b93bf24
Refactor ReflectionUtils benchmark methods
mercyblitz Mar 1, 2026
550f41c
Make getCallerClass robust to large frames
mercyblitz Mar 1, 2026
fd6b000
Increase StackWalker depth and adjust caller offset
mercyblitz Mar 1, 2026
2f7daf2
Remove StackWalker logic from StackTraceUtils
mercyblitz Mar 1, 2026
afceab2
Reduce StackTraceUtilsTest to test getStackTrace
mercyblitz Mar 1, 2026
4cc004a
Remove StackTraceElementUtilsBenchmark test
mercyblitz Mar 1, 2026
54bb2ae
Add stack-trace based caller lookup utilities
mercyblitz Mar 1, 2026
46fcf6a
Add tests for StackTraceUtils caller methods
mercyblitz Mar 1, 2026
55b88a7
Refactor caller-class stack frame offsets
mercyblitz Mar 2, 2026
912807a
Use StackTraceUtils static import in benchmark
mercyblitz Mar 2, 2026
8a285d0
Use stack-trace caller lookup and increment frame
mercyblitz Mar 2, 2026
570c446
Increase caller depth in ClassLoaderUtils
mercyblitz Mar 2, 2026
da25f26
Add SecurityUtils and tests
mercyblitz Mar 2, 2026
3d2a2fa
Add class-load test policy granting AllPermission
mercyblitz Mar 2, 2026
f0f6caf
Use default ClassLoader for getBundle
mercyblitz Mar 3, 2026
b3dd6d5
Simplify ClassLoaderUtils null checks
mercyblitz Mar 3, 2026
d79b6ac
Add resource-type and logging tests
mercyblitz Mar 3, 2026
4342e5b
Add test for JSONStringer.toString()
mercyblitz Mar 3, 2026
74b0365
Add assertion for trailing char in JSONTokener
mercyblitz Mar 3, 2026
84aa749
Add missing assertions in MapUtilsTest
mercyblitz Mar 3, 2026
e9cd780
Add test for configure(null) handling
mercyblitz Mar 3, 2026
cc9ecfe
Add Iterators.equals for Iterator comparison
mercyblitz Mar 3, 2026
8eb74a6
Add IteratorsTest for Iterators.equals
mercyblitz Mar 3, 2026
f471c83
Add Javadoc to Iterators.equals
mercyblitz Mar 3, 2026
44a90d5
Use Iterators.equals to compare iterators
mercyblitz Mar 3, 2026
d44f5d3
Qualify instance references with this in tests
mercyblitz Mar 3, 2026
f78c871
Add test for remove(null) in ReversedDequeTest
mercyblitz Mar 3, 2026
70100cf
Extend BeanUtilsTest and add assertion
mercyblitz Mar 3, 2026
0d83b5c
Refactor MutableCollectionTest to use newComparedInstance
mercyblitz Mar 3, 2026
ba11e73
Implement DelegatingWrapper and expose delegate
mercyblitz Mar 3, 2026
91b4389
Use MutableQueueTest in DelegatingBlockingQueueTest
mercyblitz Mar 3, 2026
4e77dbd
Remove extra blank line in ArtifactDetector
mercyblitz Mar 3, 2026
72ce0b8
Use LoggingTest and explicit classLoader in test
mercyblitz Mar 3, 2026
db292ff
Use instanceof in Task.equals; update tests
mercyblitz Mar 3, 2026
3cabd0a
Extend SystemUtilsTest with LoggingTest
mercyblitz Mar 3, 2026
8ede298
Add reversed(MethodHandle) overload
mercyblitz Mar 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,4 @@ private void removeJdkClassPathURLs(Set<URL> classPathURLs) {
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ Artifact resolveArtifactMetaInfoInManifest(Manifest manifest, URL resourceURL) {
}
String version = resolveVersion(mainAttributes);
Artifact artifact = create(artifactId, version, resourceURL);
logger.trace("The artifactId was resolved from the resource URL['{}']: {}", artifactId, artifact);
if (logger.isTraceEnabled()) {
logger.trace("The artifactId was resolved from the resource URL['{}']: {}", artifactId, artifact);
}
return artifact;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public final Artifact resolve(URL resourceURL) {
Artifact artifact = null;
try {
if (archiveFile == null) {
logger.trace("The resourceURL['{}'] can't be resolved to be an archive file", resourceURL);
if (logger.isTraceEnabled()) {
logger.trace("The resourceURL['{}'] can't be resolved to be an archive file", resourceURL);
}
artifactMetadataData = readArtifactMetadataDataFromResource(resourceURL, classLoader);
} else {
artifactMetadataData = readArtifactMetadataDataFromArchiveFile(archiveFile);
Expand Down Expand Up @@ -149,7 +151,9 @@ protected InputStream readArtifactMetadataDataFromFile(File archiveFile) throws
JarFile jarFile = new JarFile(archiveFile);
JarEntry jarEntry = findArtifactMetadataEntry(jarFile);
if (jarEntry == null) {
logger.trace("The artifact metadata entry can't be resolved from the JarFile[path: '{}']", archiveFile);
if (logger.isTraceEnabled()) {
logger.trace("The artifact metadata entry can't be resolved from the JarFile[path: '{}']", archiveFile);
}
return null;
}
return jarFile.getInputStream(jarEntry);
Expand All @@ -159,7 +163,9 @@ protected InputStream readArtifactMetadataDataFromFile(File archiveFile) throws
protected InputStream readArtifactMetadataDataFromDirectory(File directory) throws IOException {
File artifactMetadataFile = findArtifactMetadata(directory);
if (artifactMetadataFile == null) {
logger.trace("The artifact metadata file can't be found in the directory[path: '{}']", directory);
if (logger.isTraceEnabled()) {
logger.trace("The artifact metadata file can't be found in the directory[path: '{}']", directory);
}
return null;
}
return new FileInputStream(artifactMetadataFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public Deque<E> getDelegate() {
* @since Java 21
*/
public Deque<E> reversed() {
return reversed(reversedMethodHandle);
}

protected Deque<E> reversed(MethodHandle reversedMethodHandle) {
if (reversedMethodHandle == null) {
return reversedDeque(getDelegate());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.microsphere.collection;

import io.microsphere.util.Utils;

import java.util.Iterator;
import java.util.Objects;

/**
* The utilties class for {@link Iterator}
*
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
* @see Iterator
* @since 1.0.0
*/
public abstract class Iterators implements Utils {

/**
* Equals two {@link Iterator Iterators}
*
* @param one {@link Iterator}
* @param another {@link Iterator}
* @return <code>true</code> if equals
*/
public static boolean equals(Iterator<?> one, Iterator<?> another) {
if (one == another) {
return true;
}
if (one == null || another == null) {
return false;
}

while (one.hasNext() && another.hasNext()) {
if (!Objects.equals(one.next(), another.next())) {
return false;
}
}
return !one.hasNext() && !another.hasNext();
}

private Iterators() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@ public static <T> void forEach(List<T> values, Consumer<T> consumer) {
forEach(values, (i, e) -> consumer.accept(e));
}

public static <T> boolean addIfAbsent(List<T> values, T newValue) {
return values.contains(newValue) ? false : values.add(newValue);
}

private ListUtils() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,7 @@ public boolean equals(Object o) {

Iterator<E> iterator = iterator();
Iterator<E> otherIterator = ((Iterable<E>) o).iterator();
while (iterator.hasNext() && otherIterator.hasNext()) {
if (!Objects.equals(iterator.next(), otherIterator.next())) {
return false;
}
}
return true;
return Iterators.equals(iterator, otherIterator);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package io.microsphere.concurrent;

import io.microsphere.lang.DelegatingWrapper;
import io.microsphere.lang.Wrapper;

import java.util.Collection;
import java.util.Iterator;
import java.util.Spliterator;
Expand Down Expand Up @@ -47,57 +50,58 @@
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
* @since 1.0.0
*/
public class DelegatingBlockingQueue<E> implements BlockingQueue<E> {
public class DelegatingBlockingQueue<E> implements BlockingQueue<E>, DelegatingWrapper {

private final BlockingQueue<E> delegate;

public DelegatingBlockingQueue(BlockingQueue<E> delegate) {
this.delegate = delegate;
BlockingQueue<E> unwrapper = Wrapper.tryUnwrap(delegate, BlockingQueue.class);
this.delegate = unwrapper == null ? delegate : unwrapper;
}

@Override
public Iterator<E> iterator() {
return delegate.iterator();
return this.delegate.iterator();
}

@Override
public Object[] toArray() {
return delegate.toArray();
return this.delegate.toArray();
}

@Override
public <T> T[] toArray(T[] a) {
return delegate.toArray(a);
return this.delegate.toArray(a);
}

@Override
public boolean containsAll(Collection<?> c) {
return delegate.containsAll(c);
return this.delegate.containsAll(c);
}

@Override
public boolean addAll(Collection<? extends E> c) {
return delegate.addAll(c);
return this.delegate.addAll(c);
}

@Override
public boolean removeAll(Collection<?> c) {
return delegate.removeAll(c);
return this.delegate.removeAll(c);
}

@Override
public boolean removeIf(Predicate<? super E> filter) {
return delegate.removeIf(filter);
return this.delegate.removeIf(filter);
}

@Override
public boolean retainAll(Collection<?> c) {
return delegate.retainAll(c);
return this.delegate.retainAll(c);
}

@Override
public void clear() {
delegate.clear();
this.delegate.clear();
}

@Override
Expand All @@ -112,121 +116,126 @@ public boolean equals(Object o) {
DelegatingBlockingQueue that = (DelegatingBlockingQueue) o;
return this.delegate.equals(that.delegate);
}
return delegate.equals(o);
return this.delegate.equals(o);
}

@Override
public int hashCode() {
return delegate.hashCode();
return this.delegate.hashCode();
}

@Override
public Spliterator<E> spliterator() {
return delegate.spliterator();
return this.delegate.spliterator();
}

@Override
public Stream<E> stream() {
return delegate.stream();
return this.delegate.stream();
}

@Override
public Stream<E> parallelStream() {
return delegate.parallelStream();
return this.delegate.parallelStream();
}

@Override
public boolean add(E e) {
return delegate.add(e);
return this.delegate.add(e);
}

@Override
public boolean offer(E e) {
return delegate.offer(e);
return this.delegate.offer(e);
}

@Override
public void put(E e) throws InterruptedException {
delegate.put(e);
this.delegate.put(e);
}

@Override
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate.offer(e, timeout, unit);
return this.delegate.offer(e, timeout, unit);
}

@Override
public E take() throws InterruptedException {
return delegate.take();
return this.delegate.take();
}

@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
return delegate.poll(timeout, unit);
return this.delegate.poll(timeout, unit);
}

@Override
public int remainingCapacity() {
return delegate.remainingCapacity();
return this.delegate.remainingCapacity();
}

@Override
public boolean remove(Object o) {
return delegate.remove(o);
return this.delegate.remove(o);
}

@Override
public boolean contains(Object o) {
return delegate.contains(o);
return this.delegate.contains(o);
}

@Override
public int drainTo(Collection<? super E> c) {
return delegate.drainTo(c);
return this.delegate.drainTo(c);
}

@Override
public int drainTo(Collection<? super E> c, int maxElements) {
return delegate.drainTo(c, maxElements);
return this.delegate.drainTo(c, maxElements);
}

@Override
public E remove() {
return delegate.remove();
return this.delegate.remove();
}

@Override
public E poll() {
return delegate.poll();
return this.delegate.poll();
}

@Override
public E element() {
return delegate.element();
return this.delegate.element();
}

@Override
public E peek() {
return delegate.peek();
return this.delegate.peek();
}

@Override
public int size() {
return delegate.size();
return this.delegate.size();
}

@Override
public boolean isEmpty() {
return delegate.isEmpty();
return this.delegate.isEmpty();
}

@Override
public void forEach(Consumer<? super E> action) {
delegate.forEach(action);
this.delegate.forEach(action);
}

@Override
public String toString() {
return delegate.toString();
return this.delegate.toString();
}

@Override
public Object getDelegate() {
return this.delegate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public static boolean shutdown(ExecutorService executorService) {
if (!executorService.isShutdown()) {
executorService.shutdown();
}
logger.trace("The ExecutorService({}) has been shutdown", executorService);
if (logger.isTraceEnabled()) {
logger.trace("The ExecutorService({}) has been shutdown", executorService);
}
return true;
}

Expand Down
Loading