-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having an uber pom for better build #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,13 +18,18 @@ | |||||||||||||||||||
|
||||||||||||||||||||
package com.flipkart.pibify.core; | ||||||||||||||||||||
|
||||||||||||||||||||
import java.util.logging.Logger; | ||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* This class is used for configuring pibify | ||||||||||||||||||||
* Author bageshwar.pn | ||||||||||||||||||||
* Date 24/09/24 | ||||||||||||||||||||
*/ | ||||||||||||||||||||
public class PibifyConfiguration { | ||||||||||||||||||||
|
||||||||||||||||||||
private static final Logger logger = Logger.getLogger(PibifyConfiguration.class.getName()); | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
private static PibifyConfiguration INSTANCE; | ||||||||||||||||||||
private boolean ignoreUnknownFields = true; | ||||||||||||||||||||
private boolean ignoreUnknownEnums = true; | ||||||||||||||||||||
|
@@ -61,7 +66,7 @@ public Builder() { | |||||||||||||||||||
synchronized public void build() { | ||||||||||||||||||||
// A way to keep the static instance pseudo-final | ||||||||||||||||||||
if (PibifyConfiguration.INSTANCE != null) { | ||||||||||||||||||||
throw new IllegalStateException("Re-creating pibify configuration"); | ||||||||||||||||||||
logger.warning("Re-creating pibify configuration"); | ||||||||||||||||||||
} | ||||||||||||||||||||
PibifyConfiguration.INSTANCE = config; | ||||||||||||||||||||
Comment on lines
68
to
71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reconsider replacing exception with warning log Replacing the exception with a warning log when recreating configuration could lead to silent failures and unexpected behavior. Consider:
if (PibifyConfiguration.INSTANCE != null) {
- logger.warning("Re-creating pibify configuration");
+ throw new IllegalStateException("Configuration already initialized. Use reset() method for reconfiguration.");
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
} | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- | ||
~ /* | ||
~ *Copyright [2025] [Original Author] | ||
~ * | ||
~ * 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 | ||
~ * | ||
~ * 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. | ||
~ */ | ||
--> | ||
|
||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.flipkart.pibify</groupId> | ||
<artifactId>pibify</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.6</version> | ||
<name>pibify</name> | ||
<properties> | ||
<protobuf-java.version>4.28.2</protobuf-java.version> | ||
</properties> | ||
<modules> | ||
<module>pibify-core</module> | ||
<module>pibify-maven-plugin</module> | ||
<module>test-environments/pibify-test-vanilla</module> | ||
<module>test-environments/dropwizard/test-dropwizard</module> | ||
<module>test-environments/lombok</module> | ||
<module>test-environments/vertx</module> | ||
</modules> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
package com.flipkart.pibify; | ||
|
||
import com.flipkart.pibify.codegen.stub.AbstractPibifyHandlerCache; | ||
import com.flipkart.pibify.dropwizard.JakartaPibifyMessageBodyWriter; | ||
import com.flipkart.pibify.paritychecker.IParityChecker; | ||
import com.flipkart.pibify.paritychecker.IParityCheckerListener; | ||
|
@@ -29,7 +30,6 @@ | |
import io.dropwizard.core.Application; | ||
import io.dropwizard.core.setup.Bootstrap; | ||
import io.dropwizard.core.setup.Environment; | ||
import pibify.generated.pibify.PibifyHandlerCache; | ||
|
||
import java.util.Optional; | ||
|
||
|
@@ -55,10 +55,12 @@ public void initialize(final Bootstrap<PibifyDemoConfiguration> bootstrap) { | |
public void run(final PibifyDemoConfiguration configuration, | ||
final Environment environment) { | ||
|
||
environment.jersey().register(new JakartaPibifyMessageBodyWriter(PibifyHandlerCache.getInstance(), new PibifySampler())); | ||
AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid hardcoding class names as strings Using hardcoded class name strings can lead to runtime errors if the class name changes. Consider using Class.getName() instead. -AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache");
+Class<?> handlerCacheClass = Class.forName("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache");
+AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance(handlerCacheClass.getName());
|
||
|
||
environment.jersey().register(new JakartaPibifyMessageBodyWriter(handlerCache, new PibifySampler())); | ||
environment.jersey().register(new SampleResource()); | ||
environment.jersey().register(new JakartaParityCheckerResource(PibifyHandlerCache.getInstance())); | ||
IParityChecker parityChecker = new PibifyParityChecker(PibifyHandlerCache.getInstance(), new ParityCheckerListener(), | ||
environment.jersey().register(new JakartaParityCheckerResource(handlerCache)); | ||
IParityChecker parityChecker = new PibifyParityChecker(handlerCache, new ParityCheckerListener(), | ||
Optional.of(() -> null), new PibifySampler()); | ||
environment.jersey().register(new JakartaJsonResponseFilter(parityChecker)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
JDK 17 upgrade requires source/target updates in all modules
The codebase is currently standardized on Java 8 across all modules. Upgrading the GitHub Actions environment to JDK 17 while the project is configured to use Java 8 may lead to build issues. You need to:
<source>8</source>
and<target>8</target>
to17
in all module POMs:🔗 Analysis chain
Verify JDK 17 compatibility across all modules.
The upgrade from JDK 8 to 17 is a significant change. While moving to a modern Java version is good, we should ensure all modules and dependencies are compatible with JDK 17.
Let's verify the Java version requirements in the new uber pom:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 293
Script:
Length of output: 13081