Skip to content

Move Constants.java to annot#2786

Merged
predic8 merged 1 commit into
masterfrom
move-constants-to-yaml
Feb 13, 2026
Merged

Move Constants.java to annot#2786
predic8 merged 1 commit into
masterfrom
move-constants-to-yaml

Conversation

@christiangoerdes
Copy link
Copy Markdown
Collaborator

@christiangoerdes christiangoerdes commented Feb 13, 2026

Summary by CodeRabbit

  • Refactor
    • Reorganized internal constant definitions for improved code structure and maintainability. Updated all related imports throughout the codebase to reference the new organization. Reduced wildcard imports in favor of explicit, specific imports for better code clarity. No impact on application functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

This PR relocates the Constants.java file from the com.predic8.membrane.core package to com.predic8.membrane.annot package and updates all static and regular imports across approximately 70 files in the codebase to reference the new package location.

Changes

Cohort / File(s) Summary
Constants Relocation
annot/src/main/java/com/predic8/membrane/annot/Constants.java
Moved from core package; package declaration updated from com.predic8.membrane.core to com.predic8.membrane.annot with two unused core-related imports removed.
HTTP Components
core/src/main/java/com/predic8/membrane/core/http/Chunk.java, ChunkedBody.java, ChunkedBodyTransferer.java, Header.java, HeaderField.java, Message.java, Request.java, Response.java
Updated static imports from com.predic8.membrane.core.Constants to com.predic8.membrane.annot.Constants; some files replaced wildcard imports with specific Constants imports.
HTTP XML Components
core/src/main/java/com/predic8/membrane/core/http/xml/Exchange.java, Request.java, Response.java
Updated import paths for Constants from core to annot package.
Interceptors — Core
core/src/main/java/com/predic8/membrane/core/interceptor/HTTPClientInterceptor.java, IndexInterceptor.java, MessageAnalyser.java, WSDLInterceptor.java, AdminPageBuilder.java, DynamicAdminPageInterceptor.java
Updated Constants imports; some files consolidated wildcard imports to explicit imports (HTTPClientInterceptor added specific static imports for Flow.Set and Outcome).
Interceptors — Schema/XML
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java, WSDLValidator.java, XMLSchemaValidator.java, xmlcontentfilter/SOAPStackTraceFilterInterceptor.java
Updated Constants imports from core to annot package.
Interceptors — REST/SOAP
core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java, XML2HTTP.java, soap/SampleSoapServiceInterceptor.java, SoapOperationExtractor.java, WebServiceExplorerInterceptor.java
Updated static imports for Constants; removed wildcard imports in some files.
Interceptors — OAuth2 & Telemetry
core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/AuthorizationService.java, opentelemetry/OpenTelemetryConfigurator.java
Updated Constants imports to reference annot package.
Interceptors — Load Balancer
core/src/main/java/com/predic8/membrane/core/interceptor/balancer/XMLElementSessionIdExtractor.java
Consolidated imports: removed broad wildcard imports and added explicit imports for MCAttribute, MCElement, Required, and other annotation/utility classes.
Core Infrastructure
core/src/main/java/com/predic8/membrane/core/cli/RouterCLI.java, exchange/ExchangesUtil.java, exchangestore/FileExchangeStore.java, resolver/HTTPSchemaResolver.java, lang/spel/SpELExchangeEvaluationContext.java
Updated Constants imports from core to annot; some files removed wildcard imports.
Proxies & SSL
core/src/main/java/com/predic8/membrane/core/proxies/SSLableProxy.java, transport/ssl/acme/AcmeClient.java
Updated imports; SSLableProxy added explicit NotNull annotation on private method; AcmeClient removed Kubernetes client imports and updated Constants source.
Transport & Connection
core/src/main/java/com/predic8/membrane/core/transport/http/Connection.java, HttpServerHandler.java, client/protocol/Http1ProtocolHandler.java
Updated Constants imports; HttpServerHandler consolidated wildcard imports and added explicit imports for RequestProcessingResult factory methods.
Utilities
core/src/main/java/com/predic8/membrane/core/util/ContentTypeDetector.java, HttpUtil.java, SOAPUtil.java, TimerManager.java, WSDLUtil.java, text/TerminalColors.java
Updated Constants imports from core to annot; TimerManager and SOAPUtil also removed unused wildcard imports; WSDLUtil consolidated imports for SOAP-related constants.
SOAP & WSDL Utilities
core/src/main/java/com/predic8/membrane/core/util/soap/WSDLUtil.java, ws/relocator/Relocator.java
Updated Constants imports and removed wildcard imports; SOAP utility files updated namespace constant references.
Test Files — Core
core/src/test/java/com/predic8/membrane/core/exchange/ExchangesUtilTest.java, http/ChunkedBodyTest.java, ChunksBuilder.java, ChunksBuilderTest.java, RequestTest.java
Updated Constants imports in test files from core to annot package.
Test Files — Interceptors & Utilities
core/src/test/java/com/predic8/membrane/core/interceptor/MessageAnalyserTest.java, WSDLInterceptorTest.java, schemavalidation/SOAPUtilTest.java, util/ByteUtilTest.java, HttpUtilTest.java
Updated Constants imports; MessageAnalyserTest also removed wildcard imports for core and http packages.
Test Files — Integration
core/src/test/java/com/predic8/membrane/integration/withoutinternet/interceptor/oauth2/OAuth2AuthorizationServerInterceptorBase.java, OAuth2AuthorizationServerInterceptorNormalTest.java
Updated Constants imports in OAuth2 integration tests.
Distribution & Examples
distribution/src/test/java/com/predic8/membrane/examples/withinternet/env/HelpLinkExistenceTest.java, withoutinternet/env/ConsistentVersionNumbers.java, tutorials/soap/AbstractCityServiceTest.java, WSDLRewriterTutorialTest.java
Updated Constants imports and file path references in test files; ConsistentVersionNumbers updated Constants file path from core to annot.
Servlet/WAR
war/src/main/java/com/predic8/membrane/servlet/MembraneServletContextListener.java
Added static import for PRODUCT_NAME from annot.Constants; removed qualified Constants usage in log statements; removed import of core.Constants.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #2368: Modifies Constants usage by adding new constants and ANSI/color-related features to the Constants class that is being relocated in this PR.
  • #2332: Also moves core types into the com.predic8.membrane.annot package (YAML/BeanRegistry components), following the same architectural pattern.
  • #2013: Modifies AuthorizationService.java which is updated in this PR, creating a potential merge conflict or related change.

Suggested labels

7.x

Suggested reviewers

  • predic8
  • rrayst

Poem

🐰 Constants hop to their new home,
In the annot domain they shall roam!
Seventy imports, all sorted with care,
Package refactoring beyond compare! 📦✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Move Constants.java to annot' accurately and concisely describes the main change: relocating the Constants.java file from the core package to the annot package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch move-constants-to-yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@christiangoerdes
Copy link
Copy Markdown
Collaborator Author

/ok-to-test

@predic8 predic8 merged commit 88a1e21 into master Feb 13, 2026
4 of 5 checks passed
@predic8 predic8 deleted the move-constants-to-yaml branch February 13, 2026 09:23
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
annot/src/main/java/com/predic8/membrane/annot/Constants.java (1)

87-89: ⚠️ Potential issue | 🟡 Minor

Broken Javadoc {@link} references after package move.

The Javadoc on HTTP_NS still references {@link Request}, {@link Response}, and {@link REST2SOAPInterceptor}, but the corresponding imports from com.predic8.membrane.core were removed. Since the annot module presumably does not depend on core, these will produce Javadoc warnings/errors.

Proposed fix: replace with plain text or FQCNs
 	/**
-	 * Used for {`@link` Request}-to-XML and XML-to-{`@link` Response} conversions.
-	 * See {`@link` REST2SOAPInterceptor}.
+	 * Used for Request-to-XML and XML-to-Response conversions.
+	 * See REST2SOAPInterceptor.
 	 */
 	public static final String HTTP_NS = "http://membrane-soa.org/schemas/http/v1/";
🤖 Fix all issues with AI agents
In `@core/src/main/java/com/predic8/membrane/core/util/TimerManager.java`:
- Around line 16-17: The new SLF4J logging additions in TimerManager should be
removed so this PR only moves Constants; delete the added imports
org.slf4j.Logger and org.slf4j.LoggerFactory and remove any added Logger field
(e.g., a Logger log or logger variable) and any new log statements within the
TimerManager class, restoring the original behavior of methods like TimerManager
(constructor/method names as present) so only the Constants-related import
changes remain; submit the logging changes in a separate PR.

In
`@distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/env/ConsistentVersionNumbers.java`:
- Line 149: The call to handleConstants that constructs a File for
"annot/src/main/java/com/predic8/membrane/annot/Constants.java" is inconsistent
with adjacent calls because the path string lacks the leading "/"; update the
string argument passed to new File in the handleConstants invocation to include
the leading "/" (keep using baseDirectory and handleConstants as-is) so the path
format matches the other calls.

Comment on lines +16 to +17
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Unrelated changes: Logging additions don't belong in this PR.

The PR objective is to move Constants.java to the annot package and update imports. However, this file:

  • Contains no Constants imports (old or new)
  • Introduces new logging functionality that wasn't present before

These logging additions are a functional change unrelated to the stated refactoring goal. Mixing feature additions with simple refactoring PRs makes them harder to review, understand, and potentially revert.

Recommendation: Remove the logging changes from this PR and submit them separately, keeping this PR focused solely on the Constants relocation.

🤖 Prompt for AI Agents
In `@core/src/main/java/com/predic8/membrane/core/util/TimerManager.java` around
lines 16 - 17, The new SLF4J logging additions in TimerManager should be removed
so this PR only moves Constants; delete the added imports org.slf4j.Logger and
org.slf4j.LoggerFactory and remove any added Logger field (e.g., a Logger log or
logger variable) and any new log statements within the TimerManager class,
restoring the original behavior of methods like TimerManager (constructor/method
names as present) so only the Constants-related import changes remain; submit
the logging changes in a separate PR.

handleHelpReference(new File(baseDirectory.getAbsolutePath(), "/annot/src/main/java/com/predic8/membrane/annot/generator/HelpReference.java"), versionTransformer);
handleRpmSpec(new File(baseDirectory.getAbsolutePath(), "/membrane.spec"), versionTransformer);
handleConstants(new File(baseDirectory.getAbsolutePath(), "core/src/main/java/com/predic8/membrane/core/Constants.java"), versionTransformer);
handleConstants(new File(baseDirectory.getAbsolutePath(), "annot/src/main/java/com/predic8/membrane/annot/Constants.java"), versionTransformer);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor: Missing leading / separator, inconsistent with adjacent paths.

All other path arguments in this method (lines 141–148) use a leading / (e.g., "/distribution/examples/..."), but this line omits it. While new File(parent, child) handles this correctly at runtime, it's inconsistent with the surrounding code.

Suggested fix
-		handleConstants(new File(baseDirectory.getAbsolutePath(), "annot/src/main/java/com/predic8/membrane/annot/Constants.java"), versionTransformer);
+		handleConstants(new File(baseDirectory.getAbsolutePath(), "/annot/src/main/java/com/predic8/membrane/annot/Constants.java"), versionTransformer);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
handleConstants(new File(baseDirectory.getAbsolutePath(), "annot/src/main/java/com/predic8/membrane/annot/Constants.java"), versionTransformer);
handleConstants(new File(baseDirectory.getAbsolutePath(), "/annot/src/main/java/com/predic8/membrane/annot/Constants.java"), versionTransformer);
🤖 Prompt for AI Agents
In
`@distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/env/ConsistentVersionNumbers.java`
at line 149, The call to handleConstants that constructs a File for
"annot/src/main/java/com/predic8/membrane/annot/Constants.java" is inconsistent
with adjacent calls because the path string lacks the leading "/"; update the
string argument passed to new File in the handleConstants invocation to include
the leading "/" (keep using baseDirectory and handleConstants as-is) so the path
format matches the other calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants