Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -0,0 +1,76 @@
import java.util.Objects;


/**
* Represents a car object, implementing Cloneable and overriding Object methods.
*
* The class uses standard implementation for equals(), hashCode(), and toString().
* The clone() method performs a shallow copy, which is sufficient since 'make' (String)
* and 'year' (int) are immutable or primitive.
*/
public class Car implements Cloneable {
private String make;
private int year;


public Car(String make, int year) {
this.make = make;
this.year = year;
}


// Getters for external access (useful for testing)
public String getMake() {
return make;
}


public int getYear() {
return year;
}


/**
* Standard implementation of equals() for value equality.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Car car = (Car) obj;
// Use Objects.equals for safe String comparison
return year == car.year && Objects.equals(make, car.make);
}


/**
* Standard implementation of hashCode() based on make and year.
*/
@Override
public int hashCode() {
return Objects.hash(make, year);
}


/**
* Standard implementation of toString() for debugging and logging.
*/
@Override
public String toString() {
return "Car{" +
"make='" + make + '\'' +
", year=" + year +
'}';
}


/**
* Overrides the protected clone() method from Object to perform a shallow copy.
* This is the standard pattern when implementing the Cloneable marker interface.
*/
@Override
public Object clone() throws CloneNotSupportedException {
// Calls Object's native clone() method
return super.clone();
}
}
74 changes: 71 additions & 3 deletions spring-boot-modules/spring-boot-caching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,64 @@
</parent>

<dependencies>
<!--
1. Exclude conflicting Spring dependencies from starters.
We must exclude core Spring modules (like core, context, and web) from the starters
to prevent classpath collisions with the explicitly declared 6.2.11 versions below.
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
</exclusions>
</dependency>

<!--
2. Explicitly define Spring Framework dependencies at version 6.2.11
(Required by user for spring-context and spring-context-support)
We also include spring-core, spring-beans, and spring-web/spring-webmvc
explicitly to guarantee compatible versions for classes like
AnnotationConfigUtils (context) and CollectionUtils (core/beans).
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
Expand All @@ -30,17 +84,28 @@
<version>6.2.11</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.2.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>6.2.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>6.2.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.2.11</version>
</dependency>

<!-- Other dependencies remain the same -->

<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
Expand All @@ -49,6 +114,9 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<!-- Note: spring-test version should be managed consistently, but we leave
it to the parent for simplicity since it's only test scoped.
If test issues arise, explicitly set the version here. -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 1 addition & 3 deletions spring-boot-modules/spring-boot-featureflag-unleash/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>

</plugin>
</plugins>
</build>
Expand Down