GithubHelp home page GithubHelp logo

easymock / objenesis Goto Github PK

View Code? Open in Web Editor NEW
592.0 592.0 96.0 3.98 MB

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.

Home Page: objenesis.org

License: Apache License 2.0

Shell 1.06% Java 82.50% HTML 14.46% CSS 1.92% Batchfile 0.06%

objenesis's Introduction

EasyMock

Join the chat at https://gitter.im/easymock/easymock

Download latest version

EasyMock is a Java library that provides an easy way to use Mock Objects in unit testing.

You can find the website and user documentation at http://easymock.org.

Developer information

Build status

Build Status Maven Central

Environment setup

I'm using:

  • IntelliJ 2024.1.3 Ultimate (thanks to JetBrains for the license)
  • Maven 3.9.6

You can also use Eclipse. I tried

  • Eclipse 2020.12 (but there was a weird compilation issue with ASM)

To configure your local workspace:

  • Import the Maven parent project to Eclipse or IntelliJ
  • Import the Eclipse formatting file EasyMock-formatter.xml (usable in Eclipse or IntelliJ)

To build EasyMock with Maven

There are three different levels of build.

Build without any active profile

It is a basic compilation of the application.

mvn install

Full build

This build will check code coverage using Jacoco, run spotbugs and validate that the license headers are correctly set.

mvn install -PfullBuild

Deploy build

This is the build to launch to deploy to the surefire repository. It assembles the application and add the gpg checksum. You will usually launch it on top of the full build.

The command line will ask you to give the passphrase for the gpg private key.

mvn install -PdeployBuild

To compile EasyMock in Eclipse

  • Install m2e
  • Import the EasyMock Maven parent project to your Eclipse workspace

To compile EasyMock in IntelliJ

  • Import the EasyMock Maven parent project as a New IntelliJ project

To update the versions

  • mvn versions:set -DnewVersion=X.Y -Pall
  • mvn versions:commit -Pall if everything is ok, mvn versions:revert -Pall otherwise

Configure to deploy to Maven Central repository

  • You will first need to add something like this to your settings.xml
<servers>
    <server>
        <id>ossrh</id>
        <username>sonatypeuser</username>
        <password>sonatypepassword</password>
    </server>
</servers>
  • Then follow the instructions from the site below to create your key to sign the deployed items

To build the maven site (with spotbugs, checkstyle, jdepends and JavaNCSS reports)

  • You will to give enough memory to maven with export MAVEN_OPTS=-Xmx512m (or setting it as environment variable)
  • Then type mvn site

To check dependencies and plugins versions

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

To download the sources associated to our dependencies

mvn dependency:resolve -Dclassifier=sources

To update the license

mvn validate license:format -Pall

To upgrade the Maven wrapper

mvn wrapper:wrapper

To run Sonar

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test sonar:sonar

Android

  • Install the Android SDK
  • Configure a device (real or simulated)
  • Add an ANDROID_HOME to target the Android SDK
  • Possibly put these in your path: $ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/emulator
  • To launch an emulator from command line
    • To list the configured device: emulator -list-avds
    • To launch: emulator -avd Nexus_5X_API_28
  • Activate the debug mode if it's a real device
  • mvn install -Pandroid

To bundle EasyMock and deploy

  • Make sure the poms are on the snapshot of the version you want to deploy
  • Make sure jq is installed. If not, install it with your favorite package manager (brew install jq, choco install jq, apt-get install jq, yum install jq, etc.).
  • Add a little speech on the features in "ReleaseNotes.md" (remove the Change Log part, which will be regenerated automatically)
  • Set the gpg_passphrase as environment variables
  • Launch ./deploy-easymock.sh (major|minor|patch) where the parameter tells which version number should be incremented at the end
  • During the deployment, you will be asked to do different things. Do them
  • Announce to gitter, tweet and blog ;-)

In case of a failure during the build before the deployment, do mvn versions:commit -Pall and start over.

If something was staged in Maven Central, you can drop the staging repository with mvn nexus-staging:drop.

Deploy the website

  • In local:
    • Go to the EasyMock root directory
    • Make sure the website directory is clean
    • ./deploy-website.sh

Start next version

In local:

mvn versions:set -DnewVersion=X.Z-SNAPSHOT -Pall
mvn versions:commit -Pall

objenesis's People

Contributors

based2 avatar brampouwelse avatar ckelleyrh avatar dependabot[bot] avatar don-vip avatar gabibguti avatar henri-tremblay avatar joycebrum avatar kontomierz avatar kriegaex avatar marschall avatar mrbubble avatar nach-o-man avatar pascalschumacher avatar stepancheg avatar sullis avatar szpak avatar taivokasper avatar tazminia avatar wilx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objenesis's Issues

Objenesis needs to import sun.reflect package in OSGi Manifest

Original issue 15 created by henri-tremblay on 2012-09-24T21:10:37.000Z:

The SunReflectionFactorySerializationInstantiator class directly uses sun.reflect.ReflectionFactory, which is fine. However the bundle manifest headers should explicitly import this package.

It may have to do with how the maven plugin is generating the headers. The version used (2.0.0) is quite old now. I will try a newer version and see if it generates better headers.

AndroidInstantiator not working for Gingerbread

Original issue 18 created by henri-tremblay on 2013-06-11T11:59:25.000Z:

What steps will reproduce the problem?
Try to use AndroidInstantiator on Gingerbread devices

What is the expected output? What do you see instead?
Instantiator fails with "NoSuchMethodException"

What version of the product are you using? On what operating system?
Version 1.3 on Android Gingerbread device

Please provide any additional information below.
Exception is thrown because on Gingerbread ObjectStreamClass doesn't have "newInstance" method. This can be fixed by using ObjectInputStream that have also a "newInstance" method only for Gingerbread devices.

Also I noticed that recently ObjectStreamClass have changed signature for "newInstance" with a Long second parameter (for supporting newer 64bit VMs), so maybe you should change AndroidInstantiator to support also this new signature.

New MagicInstantiator using MagicAccessorImpl

New issue created from issue #23 comment #23 (comment)

Synthesize the ObjectInstantiator instance, so it does what you attempted (manually invoking the desired constructor), and having it extend sun.reflect.MagicAccessorImpl, as its subclasses are not subject to the regular bytecode verification, and allow you to do it without globally disabling the verifier.

MagicAccessorImpl is package scope, however, its 'no verifier' property means you can create subclasses outside of the package.

You can find the prototype here. The interesting part is in the MagicInstantiatorStrategy class.

I am using ASM to generate the ObjectInstantiator instance. This is a relatively performance-heavy operation, but seeing as instantiator instances are cached by default, this should provide performance similar to the other instantiators.

org.objenesis:objenesis-parent:pom:2.5 is missing in JCenter Maven repo

I have a project where I'm using Mockito 2.6.3+, which depends on Objenesis 2.5.
We're using JCenter as central Maven repository and now our build is failing with this error:

Failed to read artifact descriptor for org.objenesis:objenesis:jar:2.5:
    Could not find artifact org.objenesis:objenesis-parent:pom:2.5 in central

I can see version 2.5 distribution here: https://bintray.com/easymock/distributions/objenesis , but not in the Maven repo.

Maven central: http://central.maven.org/maven2/org/objenesis/objenesis-parent/
JCenter: http://jcenter.bintray.com/org/objenesis/objenesis-parent/

Is JCenter also covered by the release process? If not, is it JCenter support that can fix it?

objenesis for Debian

Original issue 10 created by henri-tremblay on 2010-03-14T13:13:55.000Z:

Hello,
I'm packaging objenesis for Debian.
Could you please add svn tag for version 1.2?
And/or sources jarfile alone not included in the bundle?

Thanks for your attention.
Best regards
Gabriele

Build fail on old versions because of license check

$ cat Dockerfile
FROM fedora:21
RUN yum update -y
RUN yum install -y maven java-1.8.0-openjdk unzip wget
RUN cd /root && wget -O 2.2.zip https://github.com/easymock/objenesis/archive/2.2.zip

COPY 2.2.zip /root

RUN cd /root && unzip 2.2.zip
RUN cd /root/objenesis-2.2 && mvn install
RUN chmod -R 755 /root
CMD /bin/bash
$ docker build -t objenesis-2.2 .
...
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.10/plexus-io-2.0.10.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.5/commons-compress-1.5.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar (6 KB at 99.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/tukaani/xz/1.2/xz-1.2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar (10 KB at 140.7 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.10/plexus-io-2.0.10.jar (58 KB at 745.5 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.jar (161 KB at 1976.8 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/tukaani/xz/1.2/xz-1.2.jar (93 KB at 841.8 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.5/commons-compress-1.5.jar (251 KB at 2234.2 KB/sec)
[INFO] Adding existing MANIFEST to archive. Found under: /root/objenesis-2.2/main/target/classes/META-INF/MANIFEST.MF
[INFO] Building jar: /root/objenesis-2.2/main/target/objenesis-2.2.jar
[INFO]
[INFO] --- maven-license-plugin:1.10.b1:check (check) @ objenesis ---
[INFO] Checking licenses...
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/ExternalizableTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/instantiator/basic/ClassDefinitionUtilsTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/ObjenesisTest.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/ObjenesisBase.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/ObjenesisException.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/ObjenesisSerializer.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/ObjenesisStd.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/EmptyClass.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/ClassReader.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/PlatformDescription.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/ObjenesisHelper.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/Objenesis.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/android/os/Build.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ClassDefinitionUtils.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java
[INFO] Missing header in: /root/objenesis-2.2/main/assembly.xml
[INFO] Missing header in: /root/objenesis-2.2/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Objenesis parent project ........................... SUCCESS [ 4.989 s]
[INFO] Objenesis .......................................... FAILURE [ 13.259 s]
[INFO] Objenesis TCK ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.530 s
[INFO] Finished at: 2016-05-03T14:37:31-04:00
[INFO] Final Memory: 24M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.mycila.maven-license-plugin:maven-license-plugin:1.10.b1:check (check) on project objenesis: Some files do not have the expected license header -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :objenesis
The command '/bin/sh -c cd /root/objenesis-2.2 && mvn install' returned a non-zero code: 1

Improve Java 9 support

  • ClassLoader.defineClass gives an access warning
  • Externalizable isn't supported correctly
  • ObjectStreamClass gives an access warning
  • Class.newInstance deprecation and possibly others

Show the actual instantiator implementation used by the TCK

Original issue 26 created by henri-tremblay on 2013-10-09T13:57:33.000Z:

What steps will reproduce the problem?

The TCK currently shows if a platform is supported or not. However, it doesn't tell you which flavor of instantiator was determined by the strategy.

What is the expected output? What do you see instead?

See which actual instantiators were used

Support Apache Harmony

Original issue 11 created by henri-tremblay on 2010-07-29T21:51:15.000Z:

What steps will reproduce the problem?

  1. Use Objenesis in Apache Harmony, e.g. using Easymock.

What is the expected output? What do you see instead?
Expect to be able to create mocks. Instead, the following stacktrace is provided:
java.lang.NoClassDefFoundError: sun/reflect/ReflectionFactory
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.<init>(SunReflectionFactoryInstantiator.java:40)
at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:85)
at org.objenesis.ObjenesisBase.getInstantiatorOf(ObjenesisBase.java:90)
at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
at org.objenesis.ObjenesisHelper.newInstance(ObjenesisHelper.java:43)
at org.easymock.internal.ObjenesisClassInstantiator.newInstance(ObjenesisClassInstantiator.java:27)
at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:233)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:60)

What version of the product are you using? On what operating system?
Objenesis 1.2
Harmony rev 713673
Easymock 3.0

Please provide any additional information below.
Looking at StdInstantiatorStrategy, using Harmony it would fall back on SunReflectionFactoryInstantiator which will not be supported as Harmony does not contain any com.sun classes.

Davlik support broken for Android 4.2

Original issue 23 created by henri-tremblay on 2013-09-04T23:24:04.000Z:

The signature of ObjectStreamClass methods have changed in Android 4.2. newInstance now takes a long instead of an int as the 2nd argument, and returns a long instead of an int from getConstructorId. The VENDOR_VERSION used to identify the newer VM is 1.6.0.

Hopefully this doesn't change yet again in the future.

Objenesis license incompatible with EPL

Hi,

I am working on several Eclipse projects where we would like to use Mockito 1.9 which depends on Objenesis 1.0. The Eclipse Foundation has very strict rules regarding IP and license validation. In particular, a scan of the source code of third party dependencies is conducted before an Eclipse project can use it. In case of Objenesis 1.0 this has brought up a problem with the JRockit support classes which are licensed for use only under a license approved by the FSF (which the Eclipse Public License unfortunately is not). This makes it very hard for Eclipse Projects to even use Mockito and Objenesis for testing (not to mention re-distribute it). Some people have started to strip out the offending classes and keep a copy of the modified source code in their projects.

Is there a way to either get approval from the original authors to license the code under less restrictive terms or, if not, to isolate the offending classes in a separate (optional) module?
This way using Objenesis would be much more convenient for the many Eclipse projetcs to use ..

Regards,
Kai

Increment version number in SVN after a release

Original issue 17 created by henri-tremblay on 2012-09-25T23:27:02.000Z:

If I check out and build from source, the installed version of objenesis matches the current release version, leading to unexpected behaviour. Please increment the version number in SVN (for example, 1.3-SNAPSHOT) so that builds will not overwrite released versions of the library.

java.lang.NoClassDefFoundError: J

I am getting a bizzare error while running below code

Objenesis objenesis = new ObjenesisStd();
long val = objenesis.newInstance(long.class);
System.out.println(val);

The error is as below:

java.lang.NoClassDefFoundError: J

    at sun.reflect.GeneratedSerializationConstructorAccessor2.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:45)
    at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
    at org.dizitart.no2.objects.Experiment.test(Experiment.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Is it because I am using primitive? If I use Long.class I don't get this error. If that is the case, a proper error message would be helpful.

I am currently on Ubuntu 16.04 64 bit and using Oracle JDK 1.8.0_77. Using objenesis 2.4 from maven.

JVM_NAME is used instead of VENDOR

Original issue 29 created by henri-tremblay on 2014-08-21T11:30:06.000Z:

In some places in code i see a line like :
PlatformDescription.isThisJVM(SUN)
The method isThisJVM is implemented as :
public static boolean isThisJVM(String name) {
return JVM_NAME.startsWith(name);
}
But SUN is the prefix of the vendor not of the name ....

Move to Apache 2.0 license

Original issue 8 created by henri-tremblay on 2009-08-23T23:34:16.000Z:

Move to Apache 2.0 license to allow a greater range of users to use Objenesis

Android18Instantiator Fails On Android O

It seems that Android18Instantiator does not work on Android O beta (SDK level 25).
Looks like Android dropped support for ObjectStreamClass.getConstructorId

Caused by java.lang.UnsupportedOperationException: ObjectStreamClass.getConstructorId(Class<?>) is not supported on SDK 25
       at java.io.ObjectStreamClass.getConstructorId(ObjectStreamClass.java:2294)
       at java.lang.reflect.Method.invoke(Method.java)
       at org.objenesis.instantiator.android.Android18Instantiator.findConstructorIdForJavaLangObjectConstructor(Android18Instantiator.java:72)
       at org.objenesis.instantiator.android.Android18Instantiator.(Android18Instantiator.java:39)
       at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:96)
...

Objenesis can't work on the Google Apps Engine

Original issue 12 created by henri-tremblay on 2010-10-09T10:34:41.000Z:

Trying to use objenesis on GAE the following exception is thrown

java.lang.NoClassDefFoundError: sun.reflect.ReflectionFactory is a restricted class.
Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.<init>(SunReflectionFactoryInstantiator.java:40)
at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:85)
at org.objenesis.ObjenesisBase.getInstantiatorOf(ObjenesisBase.java:90)
at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)

Upload objenesis 1.0 jars to central maven repo

Original issue 4 created by henri-tremblay on 2007-04-30T13:52:25.000Z:

Hi,

could you request an upload of objenesis 1.0 jars to maven repo?

As detailed in
http://maven.apache.org/guides/mini/guide-ibiblio-upload.html

it's very simple for maven-based projects to create an upload bundle:

  1. mvn source:jar javadoc:jar repository:bundle-create
  2. Place created bundle jar at some public url
  3. Open jira issue at
    http://jira.codehaus.org/secure/CreateIssue.jspa?pid=10367&amp;issuetype=3

Alternatively, you may want to create a maven-compatible repository which
is synch-ed to the central repo.

Thanks
Mauro

Test failure: org.objenesis.instantiator.basic.ClassDefinitionUtilsTest

Hello,

I am trying to build objenesis 2.5 on Debian Unstable but I get the following test failure now while 2.4 was working fine. I am using OpenJDK 8 but this issue is also reproducible with OpenJDK 7 and Oracle Java 8. However the test works fine on Windows 7 with Java 8. Someone else confirmed to me that he sometimes experiences a different error in the same class. Relevant output below:


T E S T S

Running org.objenesis.ObjenesisTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.119
sec - in org.objenesis.ObjenesisTest
Running org.objenesis.instantiator.sun.MagicInstantiatorTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012
sec - in org.objenesis.instantiator.sun.MagicInstantiatorTest
Running org.objenesis.instantiator.basic.ClassDefinitionUtilsTest
Tests run: 5, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.047
sec <<< FAILURE! - in
org.objenesis.instantiator.basic.ClassDefinitionUtilsTest
testDefineClass(org.objenesis.instantiator.basic.ClassDefinitionUtilsTest)
Time elapsed: 0.034 sec <<< ERROR!
java.lang.reflect.InvocationTargetException: null
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.objenesis.instantiator.basic.ClassDefinitionUtils.defineClass(ClassDefinitionUtils.java:135)
at
org.objenesis.instantiator.basic.ClassDefinitionUtilsTest.testDefineClass(ClassDefinitionUtilsTest.java:32)

Running org.objenesis.instantiator.basic.ProxyingInstantiatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec -
in org.objenesis.instantiator.basic.ProxyingInstantiatorTest
Running org.objenesis.ExternalizableTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005
sec - in org.objenesis.ExternalizableTest
Running org.objenesis.strategy.PlatformDescriptionTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003
sec - in org.objenesis.strategy.PlatformDescriptionTest
Running org.objenesis.SerializingInstantiatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009
sec - in org.objenesis.SerializingInstantiatorTest
Running org.objenesis.ObjenesisExceptionTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007
sec - in org.objenesis.ObjenesisExceptionTest

Results :

Tests in error:
ClassDefinitionUtilsTest.testDefineClass:32 ?? InvocationTarget

Second test failure:

testDefineClass(org.objenesis.instantiator.basic.ClassDefinitionUtilsTest)
Time elapsed: 0.005 sec <<< ERROR!
java.lang.reflect.InvocationTargetException
at
org.objenesis.instantiator.basic.ClassDefinitionUtilsTest.testDefineClass(ClassDefinitionUtilsTest.java:32)
Caused by: java.lang.LinkageError: loader (instance of
sun/misc/Launcher$AppClassLoader): attempted duplicate class definition
for name: "org/objenesis/EmptyClass"
at
org.objenesis.instantiator.basic.ClassDefinitionUtilsTest.testDefineClass(ClassDefinitionUtilsTest.java:32)

Testing objenesis with JamVM

Original issue 5 created by henri-tremblay on 2007-06-13T14:20:36.000Z:

What steps will reproduce the problem?

  1. We try to invoke a constructor with one parameter
    2.
    3.

What is the expected output? What do you see instead?

  • It seems to be because of the parameter of the constructor
  • If we use a constructor with no parameters it works perfect

What version of the product are you using? On what operating system?

  • We use the last version of objenesis
  • We use Linux with JamVM and GNU Classpath

Please provide any additional information below.

MethodHandle interface to ObjectInstantiator

MethodHandle is a JDK interface to generate fast code on the fly.

Suppose, you want to have to impement operation like this:

  • instantiate an object
  • populate some fields of that object

With help of objenesis it could be implemented like this:

Object my = objectInstantiator.newInstance();
populateMethodHandle.invokeExact(my);

It is not very efficient, because populateMethodHandle.invokeExact performs signature check on each call (unless it is stored in static final field, which is not always possible), and because objectInstaniator.newInstance also performs reflective calls.

However, if ObjectInstantiator could expose itself as MethodHandle, these two operations could be combned into one.

MethodHandle newInstanceAndPopulate = MethodHandles.filterReturnValue(
    objectInstantiator.newInstanceMethodHandle(),
    populateMethodHandle);

...

Object my = newInstanceAndPopulate.invokeExact();

As far as I understand, it is possible to expose MethodHandle from some instantiators, for example, from MagicInstantiator and probably from SunReflectionFactoryInstantiator (with MethodHandles.Lookup.unreflectConstructor(..)).

MethodHandle newInstanceMethodHandle() method could be added to ObjectInstantiator interface (probably as returning Object for compatibility with older JDK), or method could be added to additional interface like MethodHandleAwareObjectInstantiator extends ObjectInstantiator.

Objenesis source does not build correctly

Original issue 16 created by henri-tremblay on 2012-09-24T21:55:34.000Z:

What steps will reproduce the problem?

  1. Check out source using "svn checkout http://objenesis.googlecode.com/svn/trunk/ objenesis-read-only"
  2. Using Terminal, issue this command at the top of objenesis-read-only> mvn clean install

What is the expected output? What do you see instead?
I expect the project to build successfully and install the artifacts in my local maven repo.

Instead, I get a bunch of errors. See below for output.

What version of the product are you using? On what operating system?
Maven 3.0.3, JDK 1.6.0_35, Mac OS X 10.8.2

Please provide any additional information below.

EP-ML-0235:objenesis-read-only mbishop$ mvn clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.objenesis:objenesis:jar:1.2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 138, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 105, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-site-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 150, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 124, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 112, column 15
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.objenesis:objenesis-tck:jar:1.2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 141, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 105, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-site-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 150, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 117, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ org.objenesis:objenesis-parent:1.2, /Users/mbishop/Projects/objenesis-read-only/pom.xml, line 112, column 15
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.objenesis:objenesis-parent:pom:1.2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 138, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 105, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-site-plugin is missing. @ line 150, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 124, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 112, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Objenesis parent project
[INFO] Objenesis
[INFO] Objenesis TCK
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Objenesis parent project 1.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ objenesis-parent ---
[INFO]
[INFO] >>> maven-source-plugin:2.2:jar (attach-sources) @ objenesis-parent >>>
[INFO]
[INFO] <<< maven-source-plugin:2.2:jar (attach-sources) @ objenesis-parent <<<
[INFO]
[INFO] --- maven-source-plugin:2.2:jar (attach-sources) @ objenesis-parent ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.9:jar (attach-javadocs) @ objenesis-parent ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ objenesis-parent ---
[INFO] Installing /Users/mbishop/Projects/objenesis-read-only/pom.xml to /Users/mbishop/.m2/repository/org/objenesis/objenesis-parent/1.2/objenesis-parent-1.2.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Objenesis 1.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ objenesis ---
[INFO] Deleting /Users/mbishop/Projects/objenesis-read-only/main/target
[INFO]
[INFO] --- maven-timestamp-plugin:1.0:create (year) @ objenesis ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.0:process (default) @ objenesis ---
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ objenesis ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ objenesis ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 30 source files to /Users/mbishop/Projects/objenesis-read-only/main/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ objenesis ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ objenesis ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /Users/mbishop/Projects/objenesis-read-only/main/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ objenesis ---
[INFO] Surefire report directory: /Users/mbishop/Projects/objenesis-read-only/main/target/surefire-reports


T E S T S

Running org.objenesis.ObjenesisExceptionTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 sec
Running org.objenesis.ObjenesisTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec
Running org.objenesis.SerializingInstantiatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec

Results :

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) @ objenesis ---
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ objenesis ---
[INFO] Adding existing MANIFEST to archive. Found under: /Users/mbishop/Projects/objenesis-read-only/main/target/classes/META-INF/MANIFEST.MF
[INFO] Building jar: /Users/mbishop/Projects/objenesis-read-only/main/target/objenesis-1.2.jar
[INFO]
[INFO] >>> maven-source-plugin:2.2:jar (attach-sources) @ objenesis >>>
[INFO]
[INFO] --- maven-timestamp-plugin:1.0:create (year) @ objenesis ---
[INFO]
[INFO] <<< maven-source-plugin:2.2:jar (attach-sources) @ objenesis <<<
[INFO]
[INFO] --- maven-source-plugin:2.2:jar (attach-sources) @ objenesis ---
[INFO] Building jar: /Users/mbishop/Projects/objenesis-read-only/main/target/objenesis-1.2-sources.jar
[INFO]
[INFO] --- maven-javadoc-plugin:2.9:jar (attach-javadocs) @ objenesis ---
[WARNING] Source files encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO]
Loading source files for package org.objenesis.instantiator.basic...
Loading source files for package org.objenesis.instantiator.gcj...
Loading source files for package org.objenesis.instantiator.jrockit...
Loading source files for package org.objenesis.instantiator...
Loading source files for package org.objenesis.instantiator.perc...
Loading source files for package org.objenesis.instantiator.sun...
Loading source files for package org.objenesis...
Loading source files for package org.objenesis.strategy...
Constructing Javadoc information...
Standard Doclet version 1.6.0_35
Building tree for all the packages and classes...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//AccessibleInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//ConstructorInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//NewInstanceInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//ObjectInputStreamInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//ObjectStreamClassInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//GCJInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//GCJInstantiatorBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//GCJSerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//JRockit131Instantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//JRockitLegacyInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//NullInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//ObjectInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//SerializationInstantiatorHelper.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//PercInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//PercSerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//Sun13Instantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//Sun13InstantiatorBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//Sun13SerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//SunReflectionFactoryInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//SunReflectionFactorySerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//Objenesis.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//ObjenesisBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//ObjenesisException.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//ObjenesisHelper.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//ObjenesisSerializer.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//ObjenesisStd.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//BaseInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//InstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//SerializingInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//StdInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/overview-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//package-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//package-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//package-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/constant-values.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/serialized-form.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//class-use/ObjectStreamClassInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//class-use/ObjectInputStreamInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//class-use/NewInstanceInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//class-use/ConstructorInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//class-use/AccessibleInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//class-use/GCJSerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//class-use/GCJInstantiatorBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//class-use/GCJInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//class-use/JRockitLegacyInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//class-use/JRockit131Instantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//class-use/SerializationInstantiatorHelper.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//class-use/ObjectInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//class-use/NullInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//class-use/PercSerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//class-use/PercInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//class-use/SunReflectionFactorySerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//class-use/SunReflectionFactoryInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//class-use/Sun13SerializationInstantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//class-use/Sun13InstantiatorBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//class-use/Sun13Instantiator.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/ObjenesisStd.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/ObjenesisSerializer.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/ObjenesisHelper.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/ObjenesisException.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/ObjenesisBase.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//class-use/Objenesis.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//class-use/StdInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//class-use/SerializingInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//class-use/InstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//class-use/BaseInstantiatorStrategy.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/basic//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/gcj//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/jrockit//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/perc//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/instantiator/sun//package-use.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/org/objenesis/strategy//package-use.html...
Building index for all the packages and classes...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/overview-tree.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/index-all.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/allclasses-frame.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/allclasses-noframe.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/index.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/overview-summary.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/help-doc.html...
Generating /Users/mbishop/Projects/objenesis-read-only/main/target/apidocs/stylesheet.css...
[INFO] Building jar: /Users/mbishop/Projects/objenesis-read-only/main/target/objenesis-1.2-javadoc.jar
[INFO]
[INFO] --- maven-license-plugin:1.4.0:check (check) @ objenesis ---
[INFO] Checking licenses...
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/assembly.xml
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/basic/AccessibleInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/basic/ConstructorInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/basic/NewInstanceInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/gcj/GCJInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/NullInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/ObjectInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/perc/PercInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/perc/PercSerializationInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/SerializationInstantiatorHelper.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/sun/Sun13Instantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/sun/Sun13InstantiatorBase.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/sun/Sun13SerializationInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/Objenesis.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/ObjenesisBase.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/ObjenesisException.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/ObjenesisHelper.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/ObjenesisSerializer.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/ObjenesisStd.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/strategy/BaseInstantiatorStrategy.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/strategy/InstantiatorStrategy.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/strategy/SerializingInstantiatorStrategy.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/src/org/objenesis/strategy/StdInstantiatorStrategy.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/test/org/objenesis/ObjenesisExceptionTest.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/test/org/objenesis/ObjenesisTest.java
[INFO] Missing header in: /Users/mbishop/Projects/objenesis-read-only/main/test/org/objenesis/SerializingInstantiatorTest.java
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Objenesis parent project .......................... SUCCESS [1.695s]
[INFO] Objenesis ......................................... FAILURE [7.398s]
[INFO] Objenesis TCK ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.015s
[INFO] Finished at: Mon Sep 24 14:55:13 PDT 2012
[INFO] Final Memory: 19M/81M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "ep-defaults" could not be activated because it does not exist.
[WARNING] The requested profile "tomcat-developer" could not be activated because it does not exist.
[WARNING] The requested profile "ep-developer" could not be activated because it does not exist.
[ERROR] Failed to execute goal com.google.code.maven-license-plugin:maven-license-plugin:1.4.0:check (check) on project objenesis: Some files do not have the expected license header -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :objenesis

another possible and portable way to instantiate a class

Original issue 20 created by henri-tremblay on 2013-08-16T08:01:07.000Z:

If the original class is not final you can create a class that extends it, creating direct JVM byte-code, and loading the created class. Then creating an instance of the extended class will invoke the constructor of the extending class, but since the JVM code is generated calling the superconstructor can be skipped (simply not generating the code into the constructor that invokes super).

You may perhaps even create the extending class if the original class is final accessing the original class object already loaded and altering the "final" modifier using reflection.

Please remove the hidden .mvn directory from the source tarball

Hi,

please consider to remove the hidden .mvn/wrapper directory and the included jar file from the source releases. It is actually not needed to build objenesis and comes without source and thus has to be removed when it is distributed by Debian or other distributions.

App Engine Java 8 Runtime and Objenesis

I'm part of Google Cloud engineering team, and I'm looking into making sure that libraries relying on SpringBoot and Objenesis could run seamlessly on Google App Engine Java 8 runtime - our new runtime which is in Alpha at the moment.

We noticed that the reason that GAE is only partially supported by Objenesis is due to security restrictions.
In Java8 runtime the security restrictions are lifted off. Thus, it should be possible for Objenesis do what needs to be done when running within this new runtime.

As an example, we recently noticed that Springboot relies on ability to create Proxy objects for classes with no default constructor via Objenesis. However, Objenesis will detect GAE environment, and will use an instantiator that expects a default constructor. In GAE Java8 the use of this instantiator should no longer be necessary.

Explicit support for OpenJDK

Original issue 27 created by henri-tremblay on 2013-10-10T15:37:21.000Z:

What steps will reproduce the problem?

When Objenesis run on the OpenJDK, it works but use the default instantiator.

What is the expected output? What do you see instead?

It should behave like Hotspot.

Android N : standard android instantiators don't work.

The private ObjectStreamClass APIs that objensis depends on don't exist any longer. Please use sun.misc.unsafe.allocateInstance on Android N and above.

That method has the same semantics as the JNI AllocObject method (object constructors aren't run).

SunReflectionFactoryInstantiator not working if parent class constructor isn't public

Original issue 30 created by henri-tremblay on 2014-12-13T13:20:34.000Z:

just found while adapting fast serialization (github) to android.

What steps will reproduce the problem?

  1. Create Externalizable ArrayList Subclass
  2. use objenesis new instance
  3. add an element to the arraylist subclass (=> exception)

What is the expected output? What do you see instead?
no excpetion

What version of the product are you using? On what operating system?
2.1

Please provide any additional information below.

the issue is, SunReflectionFactoryInstantiator always uses the "newConstructorForSerialization". However if there is public noarg constructor for an externalizable, this should be used instead (else initial state might be wrong).

Unnecessary cast in UnsafeFactoryInstantiator

newInstance code is

return type.cast(unsafe.allocateInstance(type));

while it could be just:

return (T) unsafe.allocateInstance(type);

I'm not sure, but the cast may affect performance.

Please OSGi-ify the objenesis jar.

Original issue 7 created by henri-tremblay on 2009-03-29T14:31:04.000Z:

What steps will reproduce the problem?

  1. looking at the jar manifest

What is the expected output? What do you see instead?
I expect to see OSGi manifest entries.

Please provide any additional information below.

Please OSGi-ify the objenesis jar. This would eliminate the need for
3rd-party objenesis bundles.

An example of the objenesis jar with OSGi manifest entries can be seen here:
http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.objenesis&amp;version=1.0.0

Also, I see that objenesis relies on JUnit for testing. Please consider
voting/commenting:
http://sourceforge.net/tracker/?func=detail&amp;aid=2720888&amp;group_id=15278&amp;atid=365278

Refinements

Original issue 3 created by henri-tremblay on 2006-12-14T19:13:42.000Z:

This is a new concept in Hamcrest, orthogonal to Matchers.

A Refinement allows you to refine which part of the object is being tested.

e.g.
assertThat(
page,
inTable("sometable").cell("name", 0), // refinement
containsString("joe"));

This allows you to easiy navigate an object even if the methods aren't on
the object being tested (which is frequently the test).

LiFT does this well.

ClassDefinitionUtils doesn't compile with Java 11

ClassDefinitionUtils.defineClass() uses the Unsafe.defineClass() method which was removed in Java 11:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project objenesis: Compilation failure
[ERROR] ~/objenesis/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java:[100,54] cannot find symbol
[ERROR]   symbol:   method defineClass(java.lang.String,byte[],int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
[ERROR]   location: class sun.misc.Unsafe

Portable Unsafe

Original issue 6 created by henri-tremblay on 2008-12-12T22:24:05.000Z:

Please,

add portable sun.misc.Unsafe operations to your library.

This library already contains work around JVM limitation, so it could have
more workarounds.

Test errors with Java 10

Hi,

There are two test errors with Java 10:

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.053 sec <<< FAILURE! - in org.objenesis.instantiator.sun.MagicInstantiatorTest
testInternalInstantiator(org.objenesis.instantiator.sun.MagicInstantiatorTest)  Time elapsed: 0.014 sec  <<< ERROR!
java.lang.IllegalAccessError: class org.objenesis.instantiator.sun.MagicInstantiator$$$EmptyClass loaded by jdk/internal/loader/ClassLoaders$AppClassLoader cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
        at org.objenesis.instantiator.sun.MagicInstantiatorTest.testInternalInstantiator(MagicInstantiatorTest.java:51)

testNewInstance(org.objenesis.instantiator.sun.MagicInstantiatorTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.IllegalAccessError: class org.objenesis.instantiator.sun.MagicInstantiator$$$EmptyClass loaded by jdk/internal/loader/ClassLoaders$AppClassLoader cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
        at org.objenesis.instantiator.sun.MagicInstantiatorTest.testNewInstance(MagicInstantiatorTest.java:42)

Upgrade to Java 5

Original issue 21 created by henri-tremblay on 2013-08-18T22:41:08.000Z:

No one uses Java versions under Java 5.

Objenesis should be migrated to use generics but also use some concurrency features.

Maven Central maven-metadata.xml does not list all available versions

Original issue 9 created by henri-tremblay on 2009-10-05T19:14:10.000Z:

Hi -

Our builds use version maven version ranges (eg. <version>[1.0]</version>)
to specifically define artifact versions in our builds.

It seems as of 10/3 evening, an updated version 1.2 of objenesis was posted
to the maven central repo:

http://repo1.maven.org/maven2/org/objenesis/objenesis/1.2/

The top-level

http://repo1.maven.org/maven2/org/objenesis/objenesis/maven-metadata.xml

does not list all the available versions (1.0, 1.1, 1.2). It only lists
the latest version (1.2).

Can you please update the central repo maven-metadata.xml so that those
that depend on earlier versions will still be able to build?

Thanks.
-ken

Clarify serialization strategy behavior

So far, Objenesis was behaving differently depending on the instantiator picked. We should

  • Describe an accepted default behaviour
  • Improve the TCK to test this default

The accepted default is

  • Fail if the class isn't serializable
  • Call the first non-serializable constructor in the hierarchy otherwise
  • No special behaviour for Externalizable classes
  • No serializable specific method called (e.g. readResolve, readExternal, readObject, readObjectNoData)

Unnecessary lock contention issues in ObjectInstantiator caching

Original issue 14 created by henri-tremblay on 2010-11-04T14:18:34.000Z:

What steps will reproduce the problem?

  1. Profile an application that calls ObjenesisBase#getInstantiatorOf(Class clazz) several times across threads and observe high degree of lock contention on that call.

What is the expected output? What do you see instead?
Expected behavior is, once cached, the act of getting the instantiator should be lock-less.

What version of the product are you using? On what operating system?
1.2 (the patch is for master)

Please provide any additional information below.
The patch attached fixes this problem on trunk(it also cleanly applies on the 1.2 tag). Its a git format-patch generated patch file, if working directly with svn, 'patch -p1 -i <file-patch>' can be used to apply it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.