easymock / objenesis

Okay, it's pretty easy to instantiate objects in Java through standard reflection. However there are many cases where you need to go beyond what reflection provides. For example, if there's no public constructor, you want to bypass the constructor code, or set final fields. There are numerous clever (but fiddly) approaches to getting around this and this library provides a simple way to get at them. You will find the official site here.
objenesis.org
Apache License 2.0
597 stars 96 forks source link

Objenesis

Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is.

You can find the website and user documentation at objenesis.org.

Developer information

Project status

Build Status Maven Central

Environment setup

I'm using:

To configure your local workspace:

To build with Maven

There are two different levels of build.

Build without any active profile

It is a basic compilation of the application.

mvn install

Full build

This build will create the source and javadoc jars and run spotbugs.

mvn install -Pfull

To run special builds

Run the Android TCK

Install required tools:

MacOs / *nix
Windows

Run

Run the benchmarks

mvn package -Pbenchmark
cd benchmark
./launch.sh

Generate the website

mvn package -Pwebsite

To update the versions

Configure to deploy to the Sonatype maven repository

To check dependencies and plugins versions

mvn versions:display-dependency-updates versions:display-plugin-updates -Pall

To upgrade the Maven wrapper

mvn wrapper:wrapper

To update the license

mvn validate license:format -Pall

To run modernizer

mvn modernizer:modernizer -Pall

Reproducible build

We make sure a build will always create the same result with done from the same sources. It follows these guidelines.

Useful commands:

# Checks that all plugins are compatible
mvn artifact:check-buildplan -Pfull,all
# Build and install the artifact
mvn clean install -Pfull,all
# Build and compare the artifact with the installed one
mvn clean verify artifact:compare -Pfull,all

To release

# Get the milestone matching the version
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d'-' -f1)
milestone=$(curl -s "https://api.github.com/repos/easymock/objenesis/milestones" | jq ".[] | select(.title==\"$version\") | .number")
echo "<h1>Version $version ($(date '+%Y-%m-%d'))</h1>"
echo
echo "<ul>"  
curl -s "https://api.github.com/repos/easymock/objenesis/issues?milestone=${milestone}&state=all&per_page=100" | jq -r '.[] | "  <li>" + .title + " (#" + (.number|tostring) + ")</li>"'
echo "</ul>"

If something fails, and you need to rollback a bit, the following commands might help:

mvn release:rollback -Pall
git tag -d $version
git push origin :refs/tags/$version
git reset --hard HEAD~2

If you find something went wrong you can drop the staging repository with mvn nexus-staging:drop.

Deploy the website