Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6670003
Bump project version to 0.1.8-SNAPSHOT
mercyblitz Nov 6, 2025
4eadcc5
Merge branch 'microsphere-projects:dev' into dev
mercyblitz Nov 6, 2025
cd0186f
Merge branch 'microsphere-projects:dev' into dev
mercyblitz Dec 23, 2025
4099b4a
Add microsphere-jdk-tools module
mercyblitz Feb 3, 2026
3e9fae4
Add Mockito and bump test dependency versions
mercyblitz Feb 3, 2026
e6d5a4a
Add microsphere-java-test module
mercyblitz Feb 3, 2026
54ce8d0
Use Invocation API for annotation processing tests
mercyblitz Feb 4, 2026
8f09056
Add TestServiceImpl tests; adjust annotation processor
mercyblitz Feb 4, 2026
658ea19
Add ThrowableUtils utility class
mercyblitz Feb 4, 2026
866143a
Add ThrowableUtils unit tests
mercyblitz Feb 4, 2026
86253ae
Add test and afterTest failure assertion
mercyblitz Feb 4, 2026
ade92cf
Add test deps; adapt annotation processing tests
mercyblitz Feb 4, 2026
3b27a3d
Remove microsphere-annotation-processor module
mercyblitz Feb 4, 2026
3404443
Add microsphere-lang-model module
mercyblitz Feb 4, 2026
94feebd
Use lang-model utilities; update deps
mercyblitz Feb 4, 2026
9cfeefb
Update modules list in parent POM
mercyblitz Feb 4, 2026
89ac266
Remove compiler and shade plugins from module POMs
mercyblitz Feb 4, 2026
7956a20
Centralize JAX API versions; remove test processor
mercyblitz Feb 4, 2026
a7185d6
Clean up imports in FieldUtils and tests
mercyblitz Feb 4, 2026
91949bd
Reorder and clean up imports across modules
mercyblitz Feb 4, 2026
ccfd344
Move annotations to dedicated module
mercyblitz Feb 4, 2026
b7f1af5
Bump parent POM version to 0.2.3
mercyblitz Feb 4, 2026
f4300ec
Add jsr305 test dependency
mercyblitz Feb 4, 2026
5116249
Update Maven Wrapper to 3.3.4
mercyblitz Feb 4, 2026
f4fca69
Update GH Actions to v5 and use Maven wrapper
mercyblitz Feb 4, 2026
7cba8eb
Upgrade GitHub Actions to v5 in Maven workflow
mercyblitz Feb 4, 2026
0d97a7f
Merge branch 'dev' into dev
mercyblitz Feb 4, 2026
6d4df33
Add UtilTest.beforeTest and super calls
mercyblitz Feb 4, 2026
2514e17
Add initTestClass to initialize test type
mercyblitz Feb 4, 2026
914e36a
Use initTestClass to initialize test class
mercyblitz Feb 4, 2026
344794c
Use initTestClass in UtilTest.beforeTest
mercyblitz Feb 4, 2026
d2dca1a
Qualify test fields with 'this.'
mercyblitz Feb 4, 2026
1532f50
Refactor JSONElementVisitor unsupported tests
mercyblitz Feb 4, 2026
ef24c72
Return early when type not supported
mercyblitz Feb 4, 2026
165e763
Merge branch 'microsphere-projects:dev' into dev
mercyblitz Feb 4, 2026
3442b9f
Use ListUtils.first for annotation retrieval
mercyblitz Feb 4, 2026
d63ffdf
Use ListUtils.first in MethodUtils
mercyblitz Feb 4, 2026
3daabb9
Remove optional flag from core dependency
mercyblitz Feb 4, 2026
0714652
Qualify echoMethod references in tests
mercyblitz Feb 4, 2026
1424da9
Test loadClass returns null for missing class
mercyblitz Feb 5, 2026
632bc1b
Re-throw test failure root cause as Error
mercyblitz Feb 5, 2026
a2d6b6a
Improve matchesElementType test assertions
mercyblitz Feb 5, 2026
31c7f9f
Make context and environment protected
mercyblitz Feb 5, 2026
1be84f7
Use PROTECTED modifier in ElementUtilsTest
mercyblitz Feb 5, 2026
3d65ddf
Fix expected type in JSONAnnotationValueVisitorTest
mercyblitz Feb 5, 2026
24cbc88
Update package refs in JSONElementVisitorTest
mercyblitz Feb 5, 2026
f16d294
Ignore testOnFailure exceptions via extension
mercyblitz Feb 5, 2026
418d96e
Remove final newline from AnnotationProcessingTest
mercyblitz Feb 5, 2026
380521c
Enable JUnit Jupiter extensions & parallelism
mercyblitz Feb 5, 2026
8b00322
Refactor getElementValue and update tests
mercyblitz Feb 5, 2026
5dfc61d
Add null-arg assertion to AnnotationUtilsTest
mercyblitz Feb 5, 2026
55628e2
Null-check declaredType in isTypeElement
mercyblitz Feb 5, 2026
6b9a35e
Make support checks explicit in JSONElementVisitor
mercyblitz Feb 5, 2026
86af034
Explicit null check in matchesDefaultAttributeValue
mercyblitz Feb 5, 2026
b52a110
Use EMPTY_CLASS_ARRAY and pass class array
mercyblitz Feb 5, 2026
5fada1f
Refactor JSON visitors and processor, add tests
mercyblitz Feb 5, 2026
a0f23dd
Check attribute name in setSources
mercyblitz Feb 5, 2026
3ac0646
Add exception-handler tests for resource processors
mercyblitz Feb 5, 2026
0ea8baf
Add TestDeque and simplify AbstractDequeTest
mercyblitz Feb 5, 2026
841f1db
Add explicit Deque method overrides in TestDeque
mercyblitz Feb 5, 2026
fc44d09
Add DelegatingIterator and update EmptyIterator
mercyblitz Feb 5, 2026
65edb6b
Refactor JSONTokener char/position handling
mercyblitz Feb 5, 2026
23d3496
Use static Scope imports and isEmpty()
mercyblitz Feb 5, 2026
c3202f0
Use cached length in single-char split loop
mercyblitz Feb 5, 2026
56e5b85
Use isObjectType check in TypeUtils loop
mercyblitz Feb 5, 2026
804fd25
Revert "Use isObjectType check in TypeUtils loop"
mercyblitz Feb 5, 2026
244a813
Enable JUnit Jupiter parallel execution
mercyblitz Feb 5, 2026
e22218d
Format signatures; remove redundant null check
mercyblitz Feb 6, 2026
95cef36
Add private constructor to Assert utility
mercyblitz Feb 6, 2026
1ab16cc
Remove super() from StringUtils constructor
mercyblitz Feb 6, 2026
00bf5eb
Refactor DelegatingURLConnectionTest to use this.
mercyblitz Feb 6, 2026
739be65
Use this.jsonBuilder in tests; add appendName test
mercyblitz Feb 6, 2026
101a86d
Simplify process id resolution with streams
mercyblitz Feb 6, 2026
f7235b1
Make load methods static and add tests
mercyblitz Feb 6, 2026
5465a76
Disable Surefire system classloader in CI
mercyblitz Feb 6, 2026
973f253
Use collection forEach instead of stream().forEach
mercyblitz Feb 6, 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
8 changes: 4 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
java: [ '8', '11' , '17' , '21' , '25' ]
steps:
- name: Checkout Source
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup JDK ${{ matrix.Java }}
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: maven

- name: Build with Maven
run: mvn
run: ./mvnw
--batch-mode
--update-snapshots
--file pom.xml
-Drevision=0.0.1-SNAPSHOT
-Dsurefire.useSystemClassLoader=false
test
--activate-profiles test,coverage

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
if: ${{ inputs.revision }}
steps:
- name: Checkout Source
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup Maven Central Repository
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '11'
distribution: 'temurin'
Expand Down
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
19 changes: 3 additions & 16 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2013-2023 the original author or authors.
#
# Licensed 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
#
# https://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.

distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://maven.aliyun.com/repository/public/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
30 changes: 23 additions & 7 deletions microsphere-annotation-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
<name>Microsphere :: Java :: Annotation Processor</name>
<description>Microsphere Annotation Processor</description>

<properties>
<javax.ws.rs.version>2.1</javax.ws.rs.version>
<jaxws-api.version>2.3.1</jaxws-api.version>
</properties>

<dependencies>

<!-- Microsphere Java Core -->
Expand All @@ -32,6 +27,13 @@
<version>${revision}</version>
</dependency>

<!-- Microsphere Language Model -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-lang-model</artifactId>
<version>${revision}</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -45,6 +47,22 @@
<scope>test</scope>
</dependency>

<!-- Microsphere JDK Tools -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-jdk-tools</artifactId>
<version>${revision}</version>
<scope>test</scope>
</dependency>

<!-- Microsphere Java Test -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-java-test</artifactId>
<version>${revision}</version>
<scope>test</scope>
</dependency>

<!-- Logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
Expand All @@ -56,15 +74,13 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax.ws.rs.version}</version>
<scope>test</scope>
</dependency>

<!-- JAX-WS API-->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws-api.version}</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package io.microsphere.annotation.processor;

import io.microsphere.annotation.ConfigurationProperty;
import io.microsphere.annotation.processor.model.util.ConfigurationPropertyJSONElementVisitor;
import io.microsphere.constants.ResourceConstants;
import io.microsphere.json.JSONArray;
import io.microsphere.metadata.ConfigurationPropertyGenerator;

Expand All @@ -35,12 +35,12 @@
import java.util.List;
import java.util.Set;

import static io.microsphere.annotation.processor.model.util.ConfigurationPropertyJSONElementVisitor.CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME;
import static io.microsphere.annotation.processor.util.MessagerUtils.printNote;
import static io.microsphere.annotation.processor.ConfigurationPropertyJSONElementVisitor.CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME;
import static io.microsphere.constants.ResourceConstants.CONFIGURATION_PROPERTY_METADATA_RESOURCE;
import static io.microsphere.constants.SymbolConstants.COMMA_CHAR;
import static io.microsphere.constants.SymbolConstants.LEFT_SQUARE_BRACKET_CHAR;
import static io.microsphere.constants.SymbolConstants.RIGHT_SQUARE_BRACKET_CHAR;
import static io.microsphere.lang.model.util.MessagerUtils.printNote;
import static io.microsphere.metadata.ConfigurationPropertyLoader.loadAll;
import static javax.lang.model.SourceVersion.latestSupported;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
Expand All @@ -62,7 +62,7 @@
* </li>
* <li>{@link #resolveMetadata(RoundEnvironment)} traverses all root elements to extract configuration property metadata.</li>
* <li>{@link #writeMetadata()} writes the generated metadata into a JSON file under
* {@value #CONFIGURATION_PROPERTY_METADATA_RESOURCE_NAME} using a writer.</li>
* {@value ResourceConstants#CONFIGURATION_PROPERTY_METADATA_RESOURCE} using a writer.</li>
* </ul>
*
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
Expand Down Expand Up @@ -106,24 +106,28 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment

private void resolveMetadata(RoundEnvironment roundEnv) {
Set<? extends Element> elements = roundEnv.getRootElements();
if (!elements.isEmpty()) {
resolveMetadata(elements);
}

void resolveMetadata(Set<? extends Element> elements) {
jsonBuilder.append(LEFT_SQUARE_BRACKET_CHAR);

// Resolve the content
if (!elements.isEmpty()) {
Iterator<? extends Element> iterator = elements.iterator();
jsonBuilder.append(LEFT_SQUARE_BRACKET_CHAR);
while (iterator.hasNext()) {
Element element = iterator.next();
element.accept(jsonElementVisitor, jsonBuilder);
}

// append the JSON content generated by ConfigurationPropertyGenerator SPI
appendGeneratedConfigurationPropertyJSON(jsonBuilder);
}

int lastIndex = jsonBuilder.length() - 1;
if (COMMA_CHAR == jsonBuilder.charAt(lastIndex)) {
jsonBuilder.setCharAt(lastIndex, RIGHT_SQUARE_BRACKET_CHAR);
} else {
jsonBuilder.append(RIGHT_SQUARE_BRACKET_CHAR);
}
int lastIndex = jsonBuilder.length() - 1;
if (COMMA_CHAR == jsonBuilder.charAt(lastIndex)) {
jsonBuilder.setCharAt(lastIndex, RIGHT_SQUARE_BRACKET_CHAR);
} else {
jsonBuilder.append(RIGHT_SQUARE_BRACKET_CHAR);
}
}

Expand Down Expand Up @@ -151,9 +155,12 @@ private void writeMetadata() {
});
}

String toJSON() {
return jsonBuilder.toString();
}

@Override
public SourceVersion getSupportedSourceVersion() {
return latestSupported();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,31 @@
* limitations under the License.
*/

package io.microsphere.annotation.processor.model.util;
package io.microsphere.annotation.processor;

import io.microsphere.annotation.ConfigurationProperty;
import io.microsphere.beans.ConfigurationProperty.Metadata;
import io.microsphere.lang.model.util.AnnotatedElementJSONElementVisitor;
import io.microsphere.metadata.ConfigurationPropertyGenerator;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
import java.util.List;
import java.util.Map;

import static io.microsphere.annotation.processor.util.AnnotationUtils.getAnnotation;
import static io.microsphere.annotation.processor.util.AnnotationUtils.getAttributeName;
import static io.microsphere.annotation.processor.util.AnnotationUtils.getElementValues;
import static io.microsphere.annotation.processor.util.AnnotationUtils.matchesDefaultAttributeValue;
import static io.microsphere.annotation.processor.util.ClassUtils.getClassName;
import static io.microsphere.annotation.processor.util.TypeUtils.getTypeName;
import static io.microsphere.constants.SymbolConstants.COMMA_CHAR;
import static io.microsphere.lang.model.util.AnnotationUtils.getAnnotation;
import static io.microsphere.lang.model.util.AnnotationUtils.getAttributeName;
import static io.microsphere.lang.model.util.AnnotationUtils.getElementValues;
import static io.microsphere.lang.model.util.AnnotationUtils.matchesDefaultAttributeValue;
import static io.microsphere.lang.model.util.ClassUtils.getClassName;
import static io.microsphere.lang.model.util.TypeUtils.getTypeName;
import static io.microsphere.util.ServiceLoaderUtils.loadFirstService;
import static io.microsphere.util.StringUtils.isBlank;

Expand All @@ -51,13 +53,13 @@
* @see io.microsphere.beans.ConfigurationProperty
* @since 1.0.0
*/
public class ConfigurationPropertyJSONElementVisitor extends AnnotatedElementJSONElementVisitor {
class ConfigurationPropertyJSONElementVisitor extends AnnotatedElementJSONElementVisitor {

public static final String CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME = "io.microsphere.annotation.ConfigurationProperty";
static final String CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME = "io.microsphere.annotation.ConfigurationProperty";

private final ConfigurationPropertyGenerator generator;

public ConfigurationPropertyJSONElementVisitor(ProcessingEnvironment processingEnv) {
ConfigurationPropertyJSONElementVisitor(ProcessingEnvironment processingEnv) {
super(processingEnv, CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME);
this.generator = loadFirstService(ConfigurationPropertyGenerator.class);
}
Expand Down Expand Up @@ -87,8 +89,8 @@ public Boolean visitVariableAsField(VariableElement field, StringBuilder jsonBui
} else if ("description".equals(attributeName)) {
String description = resolveDescription(field, attributeMethod, annotationValue);
configurationProperty.setDescription(description);
} else if ("source".equals(attributeName)) {
setSources(configurationProperty, annotationValue);
} else {
setSources(configurationProperty, attributeName, annotationValue);
}
}
setDeclaredClass(configurationProperty, field);
Expand All @@ -102,6 +104,11 @@ public Boolean visitVariableAsField(VariableElement field, StringBuilder jsonBui
return false;
}

@Override
protected boolean supportsType(TypeElement e) {
return true;
}

public ConfigurationPropertyGenerator getGenerator() {
return generator;
}
Expand Down Expand Up @@ -130,12 +137,14 @@ private String resolveStringValue(ExecutableElement attributeMethod, AnnotationV
return (String) value;
}

private void setSources(io.microsphere.beans.ConfigurationProperty configurationProperty, AnnotationValue annotationValue) {
List<? extends AnnotationValue> sources = (List<? extends AnnotationValue>) annotationValue.getValue();
Metadata metadata = configurationProperty.getMetadata();
for (AnnotationValue source : sources) {
String sourceValue = (String) source.getValue();
metadata.getSources().add(sourceValue);
void setSources(io.microsphere.beans.ConfigurationProperty configurationProperty, String attributeName, AnnotationValue annotationValue) {
if ("source".equals(attributeName)) {
List<? extends AnnotationValue> sources = (List<? extends AnnotationValue>) annotationValue.getValue();
Metadata metadata = configurationProperty.getMetadata();
for (AnnotationValue source : sources) {
String sourceValue = (String) source.getValue();
metadata.getSources().add(sourceValue);
}
}
}

Expand All @@ -149,5 +158,4 @@ private void setDeclaredField(io.microsphere.beans.ConfigurationProperty configu
String declaredFieldName = field.getSimpleName().toString();
configurationProperty.getMetadata().setDeclaredField(declaredFieldName);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import javax.tools.JavaFileManager;
import java.util.function.BiFunction;

import static io.microsphere.annotation.processor.util.MessagerUtils.printMandatoryWarning;
import static io.microsphere.lang.model.util.MessagerUtils.printMandatoryWarning;
import static io.microsphere.reflect.FieldUtils.getFieldValue;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import java.util.function.BiFunction;
import java.util.function.Function;

import static io.microsphere.annotation.processor.util.MessagerUtils.printNote;
import static io.microsphere.annotation.processor.util.MessagerUtils.printWarning;
import static io.microsphere.lang.model.util.MessagerUtils.printNote;
import static io.microsphere.lang.model.util.MessagerUtils.printWarning;
import static io.microsphere.util.ExceptionUtils.wrap;
import static java.util.Optional.empty;
import static java.util.Optional.of;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@

package io.microsphere.annotation.processor;

import io.microsphere.annotation.ConfigurationProperty;
import io.microsphere.classloading.ManifestArtifactResourceResolver;
import io.microsphere.io.IOUtils;
import io.microsphere.io.StandardFileWatchService;
import io.microsphere.reflect.MethodUtils;
import io.microsphere.reflect.TypeUtils;
import io.microsphere.util.ServiceLoaderUtils;
import io.microsphere.test.annotation.processing.AbstractAnnotationProcessingTest;
import org.junit.jupiter.api.Test;

import java.util.Set;

import static io.microsphere.annotation.processor.model.util.ConfigurationPropertyJSONElementVisitor.CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static io.microsphere.util.Assert.assertNotNull;
import static java.util.Collections.emptySet;

/**
* {@link ConfigurationPropertyAnnotationProcessor} Test
Expand All @@ -40,24 +32,12 @@
*/
class ConfigurationPropertyAnnotationProcessorTest extends AbstractAnnotationProcessingTest {

@Override
protected void beforeTest() {
super.beforeTest();
}

@Override
protected void addCompiledClasses(Set<Class<?>> compiledClasses) {
compiledClasses.add(ManifestArtifactResourceResolver.class);
compiledClasses.add(IOUtils.class);
compiledClasses.add(StandardFileWatchService.class);
compiledClasses.add(TypeUtils.class);
compiledClasses.add(ServiceLoaderUtils.class);
compiledClasses.add(MethodUtils.class);
compiledClasses.add(ConfigurationProperty.class);
}

@Test
void testConstants() {
assertEquals("io.microsphere.annotation.ConfigurationProperty", CONFIGURATION_PROPERTY_ANNOTATION_CLASS_NAME);
void testResolveMetadataOnEmptySet() {
ConfigurationPropertyAnnotationProcessor processor = new ConfigurationPropertyAnnotationProcessor();
processor.init(super.processingEnv);
processor.resolveMetadata(emptySet());
String json = processor.toJSON();
assertNotNull("[]", json);
}
}
}
Loading