objenesis-2.6/0000755000175000017500000000000013123474265011471 5ustar apoapoobjenesis-2.6/CONTRIBUTING.md0000644000175000017500000000077013122236310013710 0ustar apoapo# Project License: Apache License Version 2.0 By contributing code you automatically agree with the following points regarding licensing: * You will only Submit Contributions where You have authored 100% of the content. * You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the Contributions. * Whatever content You Contribute will be provided under the Project License. objenesis-2.6/LICENSE.txt0000644000175000017500000002613613122236310013306 0ustar apoapo Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. objenesis-2.6/website/0000755000175000017500000000000013122236310013115 5ustar apoapoobjenesis-2.6/website/.settings/0000755000175000017500000000000013122236310015033 5ustar apoapoobjenesis-2.6/website/.settings/org.eclipse.core.resources.prefs0000644000175000017500000000074313122236310023252 0ustar apoapoeclipse.preferences.version=1 encoding//site/content/acknowledgements.html=UTF-8 encoding//site/content/details.html=UTF-8 encoding//site/content/download.html=UTF-8 encoding//site/content/embedding.html=UTF-8 encoding//site/content/index.html=UTF-8 encoding//site/content/license.html=UTF-8 encoding//site/content/notes.html=UTF-8 encoding//site/content/source.html=UTF-8 encoding//site/content/support.html=UTF-8 encoding//site/content/tutorial.html=UTF-8 encoding/=UTF-8 objenesis-2.6/website/.project0000644000175000017500000000167713122236310014577 0ustar apoapo objenesis-website org.eclipse.wst.jsdt.core.javascriptValidator org.eclipse.wst.common.project.facet.core.builder org.eclipse.wst.validation.validationbuilder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.wst.jsdt.core.jsNature objenesis-2.6/website/pom.xml0000644000175000017500000000651313122236310014437 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 objenesis-website Objenesis website pom 2.6 apidocs org.objenesis objenesis 2.6 com.keyboardsamurais.maven maven-timestamp-plugin maven-resources-plugin copy-resources prepare-package copy-resources ${project.build.directory}/site \ UTF-8 ${basedir}/site true copy-javadoc package copy-resources ${project.build.directory}/xsite/apidocs UTF-8 ${basedir}/../main/target/apidocs false org.codehaus.xsite xsite-maven-plugin 1.3 ${project.build.directory}/site content/sitemap.xml templates/skin.html resources ${project.build.directory}/xsite package run maven-deploy-plugin true objenesis-2.6/website/site/0000755000175000017500000000000013122236310014061 5ustar apoapoobjenesis-2.6/website/site/templates/0000755000175000017500000000000013122236310016057 5ustar apoapoobjenesis-2.6/website/site/templates/skin.html0000644000175000017500000000503013122236310017707 0ustar apoapo Objenesis : \${title} \${head}

\${title}

\${body}

<#list sitemap.sections as section>
objenesis-2.6/website/site/content/0000755000175000017500000000000013122236310015533 5ustar apoapoobjenesis-2.6/website/site/content/index.html0000644000175000017500000000732613122236310017540 0ustar apoapo About

Objenesis is a small Java library that serves one purpose:

When would you want this?

Java already supports this dynamic instantiation of classes using Class.newInstance(). However, this only works if the class has an appropriate constructor. There are many times when a class cannot be instantiated this way, such as when the class contains:

As a result, it is common to see restrictions in libraries stating that classes must require a default constructor. Objenesis aims to overcome these restrictions by bypassing the constructor on object instantiation.

Typical uses

Needing to instantiate an object without calling the constructor is a fairly specialized task, however there are certain cases when this is useful:

Getting Started

  1. Download Objenesis.
  2. Read the twenty second tutorial.

How it Works

Objenesis uses a variety of approaches to attempt to instantiate the object, depending on the type of object, JVM version, JVM vendor and SecurityManager present. These are described in full in the detailed documentation.

Avoiding the Dependency

For something as straight forward as instantiating an object, it can be a pain introducing yet another library dependency into your project. Objenesis is easy to embed in your existing library so your end users don't even know it's there.

Supported JVMs

The list of tested JVMs is available here. Other JVMs might be supported be haven't been tested yet. You can test your environment using the TCK and we would be glad to have feedback on any supported / unsupported JVM.

Benchmarking

We do more and more benchmarking to make sure Objenesis has great performance but also to settled the best way to use it for multiple use-cases. Results are added here. Please, share your own results. Especially, if they differ from ours.

objenesis-2.6/website/site/content/license.html0000644000175000017500000000425013122236310020044 0ustar apoapo License

Objenesis is open source, under the Apache 2.0 license.

If, for any reason, this license is not appropriate for you, please contact the development team so we can discuss alternatives.

Previous license

Versions of Objenesis before version 1.2 are under the MIT license defined below.

Copyright (c) 2003-2013, Objenesis Team and all contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
objenesis-2.6/website/site/content/tutorial.html0000644000175000017500000001022513122236310020264 0ustar apoapo Twenty Second Tutorial

There are two main interfaces in Objenesis:

Note: All Objenesis classes are in the org.objenesis package.

Step By Step

There are many different strategies that Objenesis uses for instantiating objects based on the JVM vendor, JVM version, SecurityManager and type of class being instantiated.

We have defined that two different kinds of instantiation are required:

The simplest way to use Objenesis is by using ObjenesisStd (Standard) and ObjenesisSerializer (Serializable compliant). By default, automatically determines the best strategy - so you don't have to.

Objenesis objenesis = new ObjenesisStd(); // or ObjenesisSerializer

Once you have the Objenesis implementation, you can then create an ObjectInstantiator, for a specific type.

ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(MyThingy.class);

Finally, you can use this to instantiate new instances of this type.

MyThingy thingy1 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy2 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy3 = (MyThingy)thingyInstantiator.newInstance();

Performance and Threading

To improve performance, it is best to reuse the ObjectInstantiator objects as much as possible. For example, if you are instantiating multiple instances of a specific class, do it from the same ObjectInstantiator.

Both InstantiatorStrategy and ObjectInstantiator can be shared between multiple threads and used concurrently. They are thread safe.

That Code Again

(For the impatient)

Objenesis objenesis = new ObjenesisStd(); // or ObjenesisSerializer
MyThingy thingy1 = (MyThingy) objenesis.newInstance(MyThingy.class);

// or (a little bit more efficient if you need to create many objects)

Objenesis objenesis = new ObjenesisStd(); // or ObjenesisSerializer
ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(MyThingy.class);

MyThingy thingy2 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy3 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy4 = (MyThingy)thingyInstantiator.newInstance();
objenesis-2.6/website/site/content/source.html0000644000175000017500000000157113122236310017725 0ustar apoapo Source Repository

The source repository for Objenesis is hosted by GitHub.

objenesis-2.6/website/site/content/details.html0000644000175000017500000001747613122236310020065 0ustar apoapo The Details

The Tutorial allows you to perfectly use Objenesis. However, if you want implementation details, tools and more power, you're at the right place.

Test your environment

Depending on your JVM and security manager, Objenesis might not be able to instantiate some of your classes. If that's the case, first, we are highly interested in knowing this limitation.

Then, to prevent this, we provide a TCK to run in your environment. You can find it on our download page. It will print a report to the standard output. Exceptions, if they occur, will be printed out to the standard error. Tests are run against ObjenesisStd and ObjenesisSerializer and are made of every kind of class types you might want to instantiate. So you can check if all of them or at least the kind you want are correctly instantiated.

To launch from the command line, just type

java -jar objenesis-${project.version}-tck.jar

Note that the Objenesis jar is bundled in the TCK so no special classpath is needed.

To launch from within an application server, the easiest is to bundle it in your application and to call org.objenesis.tck.Main.main() from your code.

Android

Objenesis also works on Dalvik, the Android VM. So a TCK is also provided for it in the form of an apk. You can also find it on download page. Just use the following command to install and run it.

adb install -r objenesis-tck-android-${project.version}.apk
adb shell am instrument -w org.objenesis.tck.android/.TckInstrumentation

Exception Handling

If something wrong occurs using Objenesis, you will normally get an ObjenesisException wrapping the real exception. It is a RuntimeException so you don't have to catch it. Some reasons why it fails:

ObjectInstantiator caching

ObjenesisBase provides a built-in cache that is activated by default. This cache keeps ObjectInstantiator instances per Class. This improves performance quite a lot when the same Class is frequently instantiated. For this reason, it is recommended to reuse Objenesis instances whenever posssibly or to keep is as a singleton in your favorite dependency injection framework.

However, you can always disable the cache if needed.

    Objenesis o = new ObjenesisStd(false); // cache disabled

The cache should behave correctly in an application server and not cause any memory leaks.

Use you own strategy

As you've seen in the Tutorial, Objenesis implementations are determining the best instantiator using a strategy. It might occurs that you need to implement your own strategy. Two possible reasons I can think of are that

From there, you can use this new strategy.

// Directly
Objenesis o = new ObjenesisBase(new Sun14Strategy());

// Or inside your Objenesis own implementation
public class ObjenesisSun14 extends ObjenesisBase {
    public ObjenesisSun14() {
       super(new Sun14Strategy());
    }
}

Also, if Objenesis can't find the right instantiator to use by itself, this doesn't mean it doesn't bundle an instantiator that works on your plaform. To try to find one, we provide a nice tool that will run through all the instantiators and tell you which ones work

java -cp objenesis-${project.version}-tck.jarorg.objenesis.tck.search.SearchWorkingInstantiator

Some culprits:

The Evil ObjenesisHelper

Static methods are considered a really bad practice. They can't be mocked or replace easily. Worst, if the class keep a static state, you will fell in class loading issues, memory leaks, module dependencies and so on. We strongly recommend you not to use them.

However, if for some reason that we prefer ignore, you still want to use Objenesis in a static way, you can do so. It's called ObjenesisHelper.

We prefer to provide it knowing that some of you will code it anyway. It a wrapper over an ObjenesisStd and ObjenesisSerializer instance which are kept statically.

It can't be more straightforward to use:

   Object o1 = ObjenesisHelper.newInstance(MyClass.class);
   Object o2 = ObjenesisHelper.newSerializableInstance(MyClass.class);
   ObjectInstantiator o3 = ObjenesisHelper.getInstantiatorOf(MyClass.class);
   ObjectInstantiator o4 = ObjenesisHelper.getSerializableObjectInstantiatorOf(MyClass.class);

Serializing instantiator details

The instantiator returned by SerializingInstantiatorStrategy will do the following.

objenesis-2.6/website/site/content/notes.html0000644000175000017500000000732313122236310017556 0ustar apoapo Release notes

Version 2.6 (2017-06-20)

Version 2.5.1 (2017-01-17)

Version 2.5 (2017-01-12)

Version 2.4 (2016-05-23)

Version 2.3 (2016-05-10)

Version 2.2 (2015-07-24)

Version 2.1 (2013-10-10)

Version 2.0 (2013-08-21)

Version 1.4 (2013-08-16)

Version 1.3 (2013-01-23)

Version 1.2 (2010-03-15)

Version 1.1 (2007-12-09)

Version 1.0 (2007-02-14)

objenesis-2.6/website/site/content/embedding.html0000644000175000017500000000572713122236310020352 0ustar apoapo Embedding Objenesis is jarjar and maven-shade-plugin compliant.

Ant

A jarjar ant task is available. You just need to replace your usual jar task with jarjar. Depending on the complexity of your project, you will then have different parameters. Here's an example:

	<jarjar jarfile="${temp directory}/easymockclassextension.jar">
	  <fileset dir="tmp" includes="org/easymock/classextension/*.class
	    org/easymock/classextension/internal/*.class"/>
	  <zipfileset src="lib/objenesis-${project.version}.jar"/>
	  <rule pattern="org.objenesis.**"
	    result="org.easymock.classextension.internal.objenesis.@1"/>
	</jarjar>

Maven

For jarjar, multiple unofficial plugins exist (here, here and here). However, you can use the antrun plugin to call the jarjar ant task.

Or you can use the maven-shade-plugin. Here's an example:

      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
          <artifactSet>
            <includes>
              <include>org.objenesis:objenesis</include>
            </includes>
          </artifactSet>
          <relocations>
            <relocation>
              <pattern>org.objenesis</pattern>
              <shadedPattern>org.easymock.classextension.internal.objenesis</shadedPattern>
            </relocation>
          </relocations>
        </configuration>
      </plugin>
objenesis-2.6/website/site/content/acknowledgements.html0000644000175000017500000000533513122236310021761 0ustar apoapo Acknowledgements

Objenesis was not written from scratch. It was the result of spotting duplication amongst other open source projects that were doing similar things and creating a best-of-breed solution.

Code from Objenesis was adapted from code from these projects:

Development Team

To contact the developers, please use the discussion group.

Contributors

Supporting Services

objenesis-2.6/website/site/content/sitemap.xml0000644000175000017500000000230113122236310017713 0ustar apoapo
Objenesis index.html license.html download.html
Documentation tutorial.html details.html embedding.html
Project Details support.html acknowledgements.html source.html notes.html who.html
objenesis-2.6/website/site/content/who.html0000644000175000017500000000213013122236310017212 0ustar apoapo Who is using Objenesis

Objenesis is currently used my many nice frameworks you should probably try if you haven't yet. We list some of them below.

objenesis-2.6/website/site/content/download.html0000644000175000017500000000323213122236310020230 0ustar apoapo Download

Current version is ${project.version}

Older versions can be found here

objenesis-2.6/website/site/content/support.html0000644000175000017500000000176513122236310020146 0ustar apoapo Getting Support objenesis-2.6/website/site/resources/0000755000175000017500000000000013122236310016073 5ustar apoapoobjenesis-2.6/website/site/resources/style.css0000644000175000017500000001407313122236310017752 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ /*--------------------------------------------------------------------------- * Two- and three-column layout */ #banner { top: 0px; left: 0px; right: 0px; height: 90px; } #left { position: absolute; z-index: 2; left: 8px; width: 184px; top: 100px; bottom: 8px; margin: 0px; padding: 0px; } #right { position: absolute; z-index: 1; right: 8px; width: 184px; top: 100px; bottom: 8px; margin: 0px; padding: 0px; } .Content3Column { position: absolute; top: 100px; bottom: 8px; left: 208px; right: 216px; } .Content2Column { position: absolute; top: 100px; bottom: 8px; left: 208px; right: 16px; } #center { z-index: 3; margin: 0px; border: none; padding-bottom: 8px; } /*--------------------------------------------------------------------------- * Default element styles */ body { padding: 0px; margin: 0px; border: 0px; font-family: helvetica, arial, sans-serif; font-size: 12px; background-color: white; color: black; } h1, h2, h3, h4, h5, h6 { margin: 0px; border: 0px; padding: 0px; font-weight: normal; } a:link { color: #6e61ad; } a:active { color: red; } a:hover { color: red; } a:visited { color: black; } iframe { width:100%; height: 800px; border: 0px; } img { border: 0px; padding: 0px; margin: 0px; } p { border: 0px; padding: 0px; margin: 0px; margin-bottom: 10px; } blockquote { margin-bottom: 10px; } td { font-size: 12px; padding: 2px; } th { font-size: 12px; font-weight: bold; white-space: nowrap; padding: 2px; } th.Row { text-align: left; vertical-align: top; } ul, ol { border: 0px; padding: 0px; margin-top: 0px; margin-bottom: 12px; margin-left: 20px; } /*--------------------------------------------------------------------------- * Page banner */ #banner { margin: 0px; border: 0px; border-bottom: 1px solid #c8f; padding: 0px; background-color: #e0d0f0; color: #606; vertical-align: bottom; } #banner a { text-decoration: none; } #banner a:visited { color: #6e61ad; } #banner a:hover { color: red; } #banner a:active { color: red; } #logo { position: absolute; top: 5px; left: 8px; } #versions { position: absolute; width: auto; right: 0px; top: 0px; margin: 8px; font-weight: normal; } /*--------------------------------------------------------------------------- * Page content */ #content { margin: 0px; background-color: white; color: black; height: 100%; } #content h1 { width: 100%; font-size: 18px; background-color: #6e61ad; color: white; padding: 2px; padding-left: 6px; margin-top: 24px; margin-bottom: 12px; } #content .FirstChild { /* IE doesn't understand first-child pseudoelement */ margin-top: 0px; } #content a { text-decoration: underline; } #content a:link { color: #6e61ad; } #content a:visited { color: #6e61ad; } #content a:active { color: red; } #content a:hover { color: red; } #content h2 { margin-top: 24px; border-top: 1px solid #060; margin-bottom: 16px; font-size: 15px; font-weight: bold; background-color: #6e61ad; padding: 2px; } #content li { margin-bottom: 6px; } #content th { background-color: #afa; } #content td { background-color: #dfd; } pre { padding: 4px; font-family: courier new, monospace; font-size: 11px; border: 1px solid #6e61ad; background-color: #e0d0f0; color: black; } .highlight { background-color: #6e61ad; border: 1px dotted #060; padding: 5px; } /*--------------------------------------------------------------------------- * Side panels */ .SidePanel { background-color: white; padding: 0px; font-size: 11px; } .SidePanel h1 { margin: 0px; border: 0px; padding: 4px; color: #6e61ad; font-size: 12px; font-weight: bold; } .SidePanel a { text-decoration: none; } .SidePanel a:link { color: #6e61ad; } .SidePanel a:visited { color: #6e61ad; } .SidePanel a:active { color: red; } .SidePanel a:hover { color: red; } /*--------------------------------------------------------------------------- * Menus */ .MenuGroup { border-left: 1px solid #6e61ad; border-top: 1px solid #6e61ad; border-bottom: 1px solid white; /* IE work-around */ margin-bottom: 8px; background-color: white; color: #060; } .MenuGroup ul { margin: 0px; padding-left: 4px; list-style-type: none; } .MenuGroup li { padding: 2px; } .MenuGroup .currentLink { /* background-color: #060;*/ background-color: #e0d0f0; color: #000; } /*--------------------------------------------------------------------------- * News panel */ .NewsGroup { border-left: 1px solid #afa; border-top: 1px solid #afa; border-bottom: 1px solid white; /* IE workaround */ margin-bottom: 8px; color: #060; } .NewsItem { margin: 4px; } .NewsDate { font-weight: bold; margin: 0px; padding: 0px; } .NewsText { padding: 0px; margin: 0px; margin-bottom: 8px; } .NewsText a { text-decoration: underline; } .NewsText a:link { color: #060; } .NewsText a:visited { color: #060; } .NewsText a:active { color: red; } .NewsText a:hover { color: red; } .NewsMore { font-size: smaller; margin: 4px; margin-top: 8px; text-align: left; } .NewsGroup td { font-size: 12px; } objenesis-2.6/website/site/resources/googlefda9c590a38fa17b.html0000644000175000017500000000125113122236310022536 0ustar apoapo google-site-verification: googlefda9c590a38fa17b.htmlobjenesis-2.6/website/site/resources/robots.txt0000644000175000017500000000001613122236310020141 0ustar apoapoUser-agent: * objenesis-2.6/website/site/resources/objenesis.png0000644000175000017500000003464613122236310020577 0ustar apoapo‰PNG  IHDR1P½rµgAMA± üabKGDùC» oFFsÿÿÿþÿÿÿþ(F·™ pHYs  šœtIMEÖ 2»ý‰¨ IDATxÚí]w`ÕÖÿÍn:„¡ƒˆ¨,¡‹ i"bå!¢vEx€`AŠ¢€"(MA)BáQbB˜@B Bz6eËìÜûý1wvïÎÎ&»!¨ç¼·†Ý™ÛÏýÝsÎ=÷\À š‘À™>a#Õ¾@A‘_˜¹þëõSú³+gò÷à‰IXí7h1@Ô_^¹ˆ(:vކÅby (¥ ”bØ/Å0ÿ%êÒ'&uÂò'Aˆ BuÁE\ 2Á’ožê ]EúþÛ!ˆì‚L\\Î)!SCBÌy6[y³k;·Áñc)ÊsÙ ‰º »$Ȳ½zÇbÿBv9átÙ!IœÏJê É«çæ.ÞŽ¯œÅby‹P B (•A(Åó3ú€R^wó$%QÞ{ýÝØ÷öf€Âé´5£ “ÒP,üröþfÁòofã«oßÅ¡ƒ ! xíµéøyÇZè¬7¬™žeL·þ?”È ”B¦„ʰX,yvð•£” °X,  Þô󻉄P€R¨ÿ³X,K muùÀb±,ûÈKlºýtžøäÓ,rûHø·îlíÔá–›î<õ ¥„õ…L]ølù£§&<ºü:B\ DÆÒoŸ]þøCŸ<)„Êp¹™”Ò¶D–ðó®E_”Û cîaãÐúºsiNµí¨¬2ž™‹Esÿp#þ«Æ…èºò»)ÝF/QY$"Ã%»°yû{-† yù'›£´»,» Ë®í€cGN@–p¹$H²„µë?Æðûž„Sr‚ÁF$»‰¡~,€µ¶S¦L‘A®©¼Fxh¤üF`¥³æ Çï?ÂPážÁÓr®Êî°`É|¶t’Ž¥„bŪwp$iÛ³ ÄGÛ~^…»Ö@~()€¥*ªO·þjÂÐ-I „‚ReUP©µÒë‹å€Åb™G [(U–.eH±X,wìúB¥œºì±Ñ3ÑÃ2ôs€bÚ´i?uî³n8ZúHJ¯(K%„È Åby\]†\N;}âá厜GY¥K%yïë·Œ¸ûµi”Ò3[v|8”‚âTúþlJÜòäµ·Ý8vêï2›F˜:>¥ôªÉJ@±}ûöÜdzŸ:äÖwpé¡¿‰Cup½éâVªƒÖà]æ¾ ~О_ ¨æ7—âµþ<‰¢˜àê@2!„¼ûÆ?e ö×iÂô I P7¸P|üåC#l¾Ò;/¤&‰ºôj€Î± Q':ÔýÛÀ~÷eüû™5ßçåŸ]¹fÓ+3ü#8MERJV~zO¼+?;íõòÜÅÃW˜3}ÂÆTJ‰¢~Pêæ¶Óñ¿Çíþx7€ Ž0ð÷7ØzÑKh½„<«|W;=Í/Œÿ¾\LULH®£((ˆ[Œ?­Íý”R,ZùXò„G—wVå‚/VŸ `€b6@ôý7v€R‚o6¼ðØ< È2Ölzõ0€B¶¢¿ûµ±Š–© Ζ¾zÏíSß‘)%.PJ@ÁÎ}KŽÈeð`ïÛgÌB\ „àà‘õÇnî9ª#ËJ‰ÝYV—PEßÿîû…1l<‘V7_<µëTçNz‚P!9mïZo8ãozÊ- jú„åÚΚ»ø}ž›:n}’[ ¦`Gà–ƒ‰ µÃîy Îd=‰UH yç¨êЏJ ¥xèþ7oT;I’œI”ôÔ¿î: ¢Hï(å·d@A1¨ïÓÝ ! ÔB=†w—äJ¢ÈRª Fyjc§7'„ÂVQÜ´}«nMˬùhNà¨Ó¨"2Ve)ÅÔg¾»‚&âòtU ”‰¨ªÝ¡}ÇúÈ8]ˆ7$ƒÒ°ëEQ\¾i]Òr•SX{ `5/Ub½¾KkÆÅ§’.ì‘\ŽØ©/ŽÚ³aÆÐ‹Üê6#…ËU{Å },Pa#ñHúïå¶’Ø\@ßÛnÀo{¹E2¥Ë•?qâÄ¿¸ÿ@×n]Ñ¢e lÙ²PÚ9 À/²«9Ôp3€ö:B¥^Gç8 €®l@('d¦°Å¡'€Hö»šg6ÑsyRåNhÆLY&}Ô`p”‰éí4‚©à$Ó[ÚpÏN'XY­œfuëÍêF¹ºeø €ÕP 2È +ZuE1‚k $[,–&Ñj‡Ñ SÊ@•Ïæ}1ò‰ZÙëJ#Ó¥%W…HÀ$N40: F=Ó–¸7e9k7ãÊG™Œd2¦$G‘uLä–1¦¶WE{ýþâäe™W·ïÝvÁ²Ñ½˜ yENÍÎêÎxws4lŽVÃÜÅÿEqÜŠ…© Èö(å”àƒOµ]2/îpžiWv‡)œ•âhÔ4ý‡6ÇÞŸsñk\.ÿÊŒSwÄøÏóŽcÁ²Ñó lÝ9/“éæRÌ5Ö§Ê÷¼:lËÚ³˜»øGDQܨ7%>ü¯€{ìó—JŸôäªilŸ}%²òœ\ÌKnÓöw¿PªæõøCó©ªx¿<{(æ¼¶Õ½âÊÌB‰ŒÙï?Œ×f| Õº±yûû±¢(&͘ü%>\ð ¦M\J•]ÕôC© ‹–¾„ñO¼ã¶VÈÌ¢AˆŒoÖ¾Ñ#§uë6]ç¶Kþ»ÿ¿ŠË‡¬øȲ däæžjà¢Ú^öÊ[÷4›>acž?üZ¿"»­)Tí$œÉ@@¯VÍ8Ï¿t#¼w”TÚKg0Ez/SÈïMÏ®Ùüj2SÊäÙï?|?8OŠ{‡LOò]©²ò¢üø£N(S~|é^µ¦É–$ië©›{>Ü“˜ˆ J-»ÒVþòÁ‡Ý¹eœ?r¬s§AAˆ‰@&¹85ÀwlÖø`˜uîâáƒEQÜ©×isÿAÅ–ÍOVÀVHÖ}2á~ã#ËRÑ^Ós%ñäA Šbg0–âââ=¼ùBy…Âåbö-xöÒžÿ÷£M{Ý0»©Þ@OžúdÓn|ßë™ÛÔ#;óƒÆc¸Åby–Y[ˆ?Ðw0.ÐPìð€ÛúÊYdážž”P,xïšµ¨ƒGë ‹eÜ*|Á„ÇAÖ Àì™?¸§#¥tÀ›<-7Μ¶Ü“3 ~µôG¬üBÝ|•±÷ð73né3êCøüÓo±h!?%?à«â®Á=CÿyZÉhÞ¬ãç¹yiwò­gLtéš©A1uÜú—~"z™ªA‰gZ±ÊƒRL~ù&Ìw?>™³÷žÞuëιğè«v6Åw›ÿsŠÃSòæ¼Jñ쿇ʟ~²ÍìáJoN.-Ës$$nÞ 9rdÓºu#¦ÆnÙ²Å)Šâ„±£_ñˆÙõ¾©ýL§Ó’’Ò,11ÑѦ•å9®C{1F‘üu˜WGy:Œa–›«¨û;¡^vZPPü¸á¤;]¥½$ö×׉P J‘z2ÇíšÆk ¯Ï\CAÇ‚åå•…ê“¡w\}ïàus%¡ „¸'sll×ðA·÷¿O©3ÁãOßMžyìM%á=r–.Ù(é”ï&âeÌQ<;BñÜøWðãÖ-nžƒÆQW*·X,uœÎÊbÕæîµ¢ÓYéçþ¨pA’g)kPúéB÷TÞ½éÅ;~z'íT>ÒNæâô©\wCs.¦Z-Ëëj9É'Î#ùø9ˆÇÏ"#=·¾âQI wëÎnsã•»M– ¥8—‘øƒÇ(‡$Âb±ÌU×ò´´3Ø·7Þ=õbcc÷¢ sÒ©Y!}„2AÜÖ8@V, ´±¨àÙY¨Beêà&(n$Õ™©%&Ýg¸Ecn˜™7ÀUÚr¥šˆÐ…3qƒY@ΰ³ßNèàz–ö[Q{p&fµÜ<XtÌÏ9ìYV÷ÖÞv:&íxfò&ÕÙöŽ«ë0pæ³ÆnÏ?7UñLÐt$¿ò‹›‰{pejÓ©iyV]Ý®x³•AdAô7³Uû#Q©ì"ؼîJ‹jÇ­z¿@ h×1òðäé÷ü Šÿ´)¸†0ô?NAïö|ýyZ­1˜Ûì J(ΤVÞ8åéµÙždêP4®ð©ã?,Ôváz~²‚ †B±<ç3D#ÆPý3–KAE¨ưQm‘–bÅéäRê´SAw¡ô1YzœG)(®¾>l×äF< ˆ-¡ÆòùOX.«£†MBqTü©âŽþ·&?1nàÆ9Ÿüká“:¡^ÃÀ õZ&7µ+Ò’·O|âë@Ù^ª{9Õ ¿ÉDQ‚DæÛÎnY{¾ sH˜€!÷·BL‹($&àÈÁ"Ÿ´s_Å,YÅ_<¨Ï`î½uJaq9\’9Üá´å-ù橯 ØÛBñ¨.‚qˆûÊÉDQ7/}ç–﯀²©—É”ªe²gÿ¢ð'ý7¦OEqÞœYÛXþ*Ó¶Í!0ñ¤“\ÎsæíòÚŒ5!^õQÿ}æBâIÉ;vˆ¢¸óÅÉKÝ»½-‡iyåMõi«ÒD9ÉE(-㟜ãnƒ»\ö®rB]ÉËóœ`ÕÚ1ú¡i,q¿_'²þ/+V½}LjaX:Yi7aïÉÄÌ}—A›{êߎAÙ¨,†Îñ*µË™oÝÓ@繋Ñçþ!/|ÇíwÊå7ÝÜ#Êîoº(ŠÓ–/ðø(ÜD4ŒÞ©¢€.ƒ}¾ò‰ó¢(¶YøÞ! ƒRTTõ‚²‹[åÌ¡C³´º'jû°ò€z!.(°nókç"§s©VÖ6cßæ¼§¹6*ÿi×2öÅVͯ­EsmTŸŸRk^eBâ¦t(®EYÜda§þ_žåöwâÌ<*Æ¥C9dU ÊN}'ðჺˆì¨è­Ö„ùO¸û'"¬nerêy: Z˲ë^¬ ƒ@q8 cËŽv¾ûñcw†dP¢j¤@q¦'à»ýÍÜŒD@ù~×A° .çŒÐ‹góމ?áìù£(®ùl™ö»«íƒLŠKW˜¯yE™é{« ¥´ @R Ò0íV™ÓËîÇÚ¨–ÙÚzæ´^̤µª]?ºiÔ ¾OÇ‚ÐX-Š.V ŠêÓcx,@c Q‘‘¸ÑW-ްJ¨è¿ÂìÎò¨mzÆȱ2ñF1róÒ†°‰PâOV®ÎNFØ,²¡Úp>¼Œˆ¢ØÊQJ÷2è—¹¸A#ü çŒ À⯟,E±þ‚w€B³&íbîè7_˜ylÓÏs~f³®Â¿¹ƒ÷ߢ¾O4ËäºÍÿ)…rªú"ËWuý *fð;—Ðzé™Nk‡¶¤á—VÇPú(Æ\â\ ‰›óBy•²$‹eU>‡ö±:B‰uGTŠ¢Øý±Ñ3ÝLH½ó®‚B«î¬U=3½ÊsË™À¨1÷ ï|ð\TdddãÐÐÐH®´OŸ>SDQüÕjõ>eç°Û Lfä………„x ‹x1´»|/sƒÂVkÅ^(fw˜MÈ  QS•I‰;ÓöPáÂýÉøAE Ù°aC ¥].úc2ª(ïå‘G. sqƒÊ\eeeÙ ´¥'åÝMß^ˆÎÃëwV†Kr4\³fM‚TÒe0¯Hx˜ê3˜ÂȤ¤¤ä"Ñ*+ÿ B#)hs^†$ Ý†yMyyùIPz=ËÍf·ÛϬ\3kìâO7|óã¦^婃N)ŬY³ŽBLO™òÒÛ¶0oÛDÐnTeË_ß>c~]½zõÔßvžùX&2§Ð&¤‰ú]‹b¯¾újŠIÀµDƒbèÛo¿½ãèïç†(~®n¿ mâø•—e7é,[µ©ÌÒÙUE.ˆº:Y:ÂÒ„ÑFÕ';œ¥5ÕB¿U°´F¼;ƒ 2È ƒ 2È ƒ 2È ƒ 2È ƒþñìÑ·7ÌD-ßßE)=“ûøã;À‡©6èžB‚`®·¼vüB9XZ+Ãïv©¹ª^Æå; ¸:9uO)ëºÊlýS0E^9þG!þ8P[ÌåM¥ENÜ9`b:”½ÈVP¶YŒ3•ÿ 39XX«…û¹{äNx6ŠCŒ!úç0ØeA.ê%@Vcè_[iЕÊ`µK¼o¼—¯Y3M¡xS˜!ú‡ùÁPhÃxiÀ€´uëÖn?x­¯¿¿«¹N$¸®¼¢¼ÅM7Ýô÷Œ¨rW¾™"˜K}¶#Îf”!U,Eî»?ýÑ×Û”‹’Ú I8f¿÷@w(~òVC«4Ì/µjIÛu¨+4jFÃaÑ_™-Ë™ž±÷¢g×{Ö‰hЀ‚bÁ²Ñƒ¡xŸ^„DÅX"ÏçœNœüµHLÝÅÍ·HÅé_}–ê>?ས<³öªO¾|dÇWß¾{‡ËE±âÓ€âÎÊÌi0ØÈ`¢(®ó÷ìK4n¸¥)ÂÂÍ8}²;ãÚ bêî³P|Ý ØÇNñ+Ü«e €å A€ ŠÏ{(þå…¸ÂïXúG1˜(Š/˜ ߯Ng&tê[4GQ¡ÿÝuß~™áN%†v”Ãg5’—®p¯åºYJâ6œ3 ‚`ÚºkÞ\xÞ0LW ƒ‰¢ø#€{ÿ8œwâx|I}n¿¯Zµ®ƒí?^€@ÅE°å,‡g0>0 4RÔcfqߟ3I²äZ´òÑ%,Y)“¿Ê቟®§þÙ²*ý–w9êyIyV…`÷nZ{ædq¾ÔÅá,ÿu =®úâ4$G@y·€rJ=vïc÷>ú¤»Ê?í^`]¼ô‰3ĉÁôB Qaô¢ðÞÓ¯_¿½'NœØ+B¯ ˬ—””´Ç_4Õ«WÇÌ™3§‚ÕGEQfé" ´S^u‘üQaaáÐ~ýúíE±Ü_¿…HÍÕD>ªr‰,Η®—HѲ…ËŸ:<áq`€Ì…I“&54hÐÝ;vœl2™B|ì^^‡hþxjÆAWLLL½ÍëR‘s¡<à(<ãþ/VëÊä¾bÆØ>þpöN7³3£È¶{nŸö¬ ½Ö~Œôü€£ð£Æð‰Âcé4 LLÝÓ€r±¼;-÷W& Pn1ˆLŸ{w6.!qónÖçê ƒ9Î 7jÔì©#$> w7¾eNVeËøýyHI²R™PÁgit³ÕZ]ís¡ÂŒ©öñHàv&÷%C‰÷à÷Ìž—Î:€sé…ðüõ¾¿êtJüEàéÙeè¾óYIc¡tåà ÜV“õJr:ï*Åå©ÖÉ+¬€BƒkRÙ%=Èl”Ç ÄÑð «å—ÁzôèñõÓ£?o4“⡯>;Í/€BL‹p\̶ùĆ ÆajJâõ;Eú™øü{?ÏE±ûÂ÷qË®»U}¡¸ú\`²›KW|ÐDȱ;Ê:úkKvîéü½‡Wf±Ž¬„÷IoÇìQU_PJ…Ûúüß„}ñ«iÝä/Í®}_&C9 ^Æúƒ¿O§˜ÒE/úÎá#’”ÝÜ{”T &*˜@i¥ÝÚ¬Šjöõ÷ ãlB2€2K§A%è”:Í œ¿Àäd{À €,ýöÙURºu¾³ÿ Ó_yîx|q@ ¶îÇY%ç³’R Üî”'Šâ+Ëœô PïXð÷/Æ„2‘Ýû“:è-¡xaD£qʲ\__Š¥ Ô¥–™Ýx^¡ ‚ÿðNõëÅô…2”GÏ>fâîh6`g¡³¬Š¦DÈ;˜°æ&Õe}AÙñA±•gÔÕ 'îxbÑòÄÔÝzy–B9áí7bU æbKILÞN{Ý8/`;Ÿ•Dà9b^Ü…ªB<¹ú0ÐøçFE-XüïXïñ ¢FëYÙ?Ìjçj—Çç&ZÜó•X(.DZy€YôÉ¿†Î˜¤ù)¬ ¾ ³ý ô’‰‹‹÷ôíÛ÷ÒyѱcÇ6Ž3æ7ú íz yfA‰ÙæÔc²ªLf‚ÛYÆýÁ™(’ ßð‚%ÊË]ðŽæ½@(~ýé vÿtÆÍ˜2±•J;T±?þ[5˜^.›þ-þ„¡ÕhÜ›6üŽâ9¡Û#„¸ç?»ýÚ÷4±Ã$ÉQ\\ÁG@ åßçc‡Mÿ±ž€Bè€!ý'Îr ðŸü¿Yz>(ÈðÛn[¤)pßб\˜M—*àC&dxŸnÃKâ7~*ö‰«s×q19 ;0¾¢¼UĬïéžÇÄWîâ.…Õ7`hVLNY¸áÖŽÑsçOo.ŠbK(ñ[@Ù·,ƒŸh|$KŽW¨)½%ŒÂË´â¹v´jšóú·Z[aÐä’M-ËóÁ¦sJ¶ÖîöëÄ ³X,sµ!6ù^“u~•”<;AñÝ ­éVñزªa.OäÃöžf séÈ]”èXö}Í©\»÷/ÍE±Åüwÿ‹?žGÂÁó¥xzÌâÑKWOÃd%ª|È#·†çAØó9']â¿õ‰ðÍÎ/Ù£€Õ+wCO÷F*DñˆÊ3ï®ýK«Œ¶ íþø5/C¹ý´+ÿ93§(Š=ÚÀt’d»ººLM;0JH©>P¶èÜyêE>tºœW3¹.‡-••Áùµàýp‹zèÒ~ÔQ bhâ·z#¹ÌЩ…wþî¿­ÙÀ¨Á‚A[]ôò@¼»ÌlöÑ ù^Ëãì·¦¥\ÓæÞk)ZSŸÂ«1 Ù P¢òG-EFFVÚíöìÊÊJH’TwëÖ­êàvÖm-‘TÕǯӸqã‡ÃQP^^ž$IÒYŸ<5Aéd"5€â ï^5b0^¦:a5¹ï3—•P#—¹¿pFÕ#‡„¼ôŸ›i…|5YÏž=o^°`ÁSuêÔ) QC`úßèÐ «É+#¾;ä?o=zµ&ÌåT/òY$''Ì›7¿ñ¢yÛ›x›d¨6v« :ò@W/<<¼CxxxPžË_}õÕß¼CkRLš4-µ~ý(§VpG=¤L‘Ñ‰Ý %êásVk…·Áüù)©õÔuV³Z•¨0ƒB>¼BiŒ¥¦½ÂiVË\”RJ)¨À©í ²Î9Íe%e Žâ¤ŽMÂd2µŠŠŠî·é¤O}h5Â=U^´ÆÕŒÔ"sQ¡£@xÉ_ yÿì÷•£&Nx/:ôŽe¯ÌXôRÒÑtÝåÑ{ñô{w¥D‚*a<)§5”Y+[4¥ ^˜ô¡Ö‚ßéÖÛzW%\Vk¶ylÌ¿¡‰£ßièÝC}cpÞ3Xllì¬Å >—j»Ág1ñ‡ZU0—WI:Š)UÍÙ¢¢¢"´ÊÃïO@/¼9mV·‡ÍfË€F“cS‚ýû»ã»j€XAPÏKÀW˜…”––^£e¸¸mž-"Ÿ;ÙA¸j¢Ezµaò wß_TœµP¶;G=®»$jnúà‘Ký]8m·[É×k¦eÈ[±bÅÉäÔ}S~ôÎ+<†ž;Ü  ¼ÿ€[纈œÍˆ—Ìå^„¸èÞÃ_g¯Y³&+5ãÐ[„UÈŸ;å¶[öŠ´O>ù¤mjFü»”ãg²_ɸqã¾³ÙË>Ò[eYv°ÞvÛmk!4Ë{ë‰÷.ñ ×þß×%÷îÝ{iXhÔ…@N@MJÞžÓ¿ÿ¸¨ðú¹ü3sX¤@Ù-·ÜòiÝ:ÏšgDhz*mŸ*ë:à'@p0þU&fŽJÛLÓ«a~Ú5B ”›%ÀlæoeÛÑ, ž@¹¡ð ìÏývÌ8ÚÞqWÕ˜ªjŒS>˜p”X¥½Y;ƒ Ð+3­ŽB hœÌòêŶ…Úr; NVGu¯ €îP.„¸)ÀcØj¤*¾“‹X2Yº.L@w1[çï¬NÙØªu©*ÏBfÚ à¿k‘ê… *—ghÀÙ?j#°©æªöde|R³ýCuÊt²]ýL6«¬ÌèZúm®Ür¦fç°ö”±ÁÐ+“ÿ·ÄÊÈeÿ>Ã8‹u¾ÀÞ-ЄÓ]ŒQÔ4²Ù~^}͘hË$Ìp‘•[‡µ·žŸtÚ6æ2F«Ë˜*š=+äú­”™zê˜çyVwû¥"˜ú~›™QŒ›MµÄ`ê Uo‘Ø`×AðQ£eV·@¢F_j¤j>ú³Z–6’t<ÑÝ64VWµ5‰pmfu ´jº.EÍ¢móýVáo«¨¦L!°Îj!/ªƒ”êH9z³\}O"-/C[&__A“—^ü¥ ¶®µ•®6úÍ8·jAdAdAdAdAdAdAdÐI‚Q'7Îd€˜B¢(FØàæÿÅN!„X½zõ°÷Þ{O=I ¸5òÞPèdÐ b®r¹~Ùz¹çíÓæW}ðÓá²ûé—ùã3Î'¨÷ª¾ÖNxÁ6È ƒþ"º\—d]›×žýª=¹Ñý®Á“‚¿«7”3Í¡œî ‡¾¾Aô'Òe½ ÔZìú7=0*,$¢€APަA93|žËÄiHcteØÿ€d\ü (!ÛB¡¡UÏ”—3ÕÒP+ 2èJ•Äj›æ.®Ú¢$ÎnݺÉ‹ÅÔ¾}{Ó˜1cš¾WïÖ-^¼¸}BBÙ°aCvIII](çòÕ(!&ø =cA æE¢(†A'½ÃîBAž ÖÒ@®› 6Š#~¼QƒNm‡õ\0oTÏ6í¢A…Š=Ï??ñÅääd2U"“ @3È ?—.‡ê'ˆ¢H.‡T$¾QE%s(EX8¥!a&„˜ææPåö]™ê’dÁ锩Ã.Ã^)£¢Â…°ÐH“OÄP†v¶Ò]·¿7«°ðl1S/+áÙ½TÍ ƒ 2@ÌC2q‘òŠÂ²òò‹eÅÙ%ÖܬsYI9?ïøvº_…Ý.£²B‚Í&ÃnsÁn“a³ÉpÚeHNN'ËE@d€È”R&Àl6!4T@X„{v*¨´—9¶íüè<ûܹs›Üvëí]ïËFZŠr‡‹ÃiÏ]òÍ“/A‰Ã˜Ïþª.’!™dÐÿ˜:™˜˜ØîRÒ7‰ CËvQhѲšÄD ,Ì ‹År±M«Xù|V’záb ”À¤¥Lrë‘úÀé«Bºÿ[…ÙªÅuM@¯¿þÚÑ«W/wŒñzLVõ B¤(‹ hU]/Tc¿d€˜AýALÅ«|`/ÙYK Ü5äCQÑftèvê¢I³H˜L**$äfU";³©'¬8_â~ú„10wñðí ¸Š˜ÄSÀ­Â k`¼ Ù«W¯²‹à×íée)¶h Zìöò¬o¾é;(ë±z”°z%‹áGfA7E1ÀÃÕßÊ­ÎâÛ.œ).põ`·5Ôo K÷èpM}„†™`-q"ã´i)Vœø£$Ø¢U),žîyì÷€Ì°ª0øâããjòh ŠòÊ¢ô_~[òýù¬$+™XŸ4lìcÿÌz^*£&ªŽ(Švái§J°ï—ݱ÷óù¢(f0ZñõÊ-øãðQÊ]çN”´uëEۢš~ºkÿ—óù±/È/ÅÊå?àð¡Ãp™»Ðžp}âþÈ„«³’¿ç‚xÈž:7jÔØ]·í§âWχ÷ uRM4˜ %1BÈc&“iíÝnÃÃOv¡-ï¿ÿ‘ͽ.\¸Px¹ÄFQ;C¹únˆ¦N()v ¸Ð¤ý Õû*(7™”…iÝJÏm¼µ `²D#Ìæ©#ï}£éú­o|åF6õS®QU¢ªŒ‚Brº":í_Cg6ÛôóœïÔxñü_•f’Ú0€Âiw™é¡ÞÝîo¥–÷Éû[ S0T`Êÿ]_ß;ø…-[w~ô%¼7|¼ÚïrÉpIå·È„p—Zæ;o| Jôë€ùïw‡ÃavûC×_ÓÏÝÆW_þŒ-µoe(++‹,ƒuFßÇ4WË›2ñ-Ȳìi`V«5ÒJJfÜÜûáÖ¹ÇþÙq¯€p7ôÖª8V”™_”?£w·a1 ‰›×sãVRÄbcc7ˆüÏŒumeas`Ýò Ê}m›µ¸ ¿ÈC£&áµÞø•Ÿ¦úñ£ÕJ_þÕG?æ}K´ÝËî €9•6‡d³ ”Ò.Ý®ngÒŠ}L§=e•%]p‡r5ä9f ,M£º™´”]i+î«æúä¹\’Í%Kîë&)W7A½ÞØg Pb³—†[ž–L&áþÝýâM›â>ø”õÓy¿bL¸Ë x)0Ù@e; P@€ 0±KYרÉG*cIšAìŽ2OI5dÏS¨-Ô$ØyätJ•ýIaî£pÚ+:«ÙÉ‘ÃQá5ö„Ö1‘õl!æ0;¿Â•–å6®*ÌêìpØ:³±¸ÀÆ-ÊUªA„¼ªñîä[>ü€m}z ïÖùš×¯×ô¦Ðˆy9äå8. ‚S ÈÄEíöòJ‡TQh·—çX+ Ïæågd.ûzö “IÀò'ýïý¨“¿žD&3‘×ÃkH`ç.$ºvî[R R|Sl ß;¤Û0ª‘d$ÉÖ€ÊΧ‹­PêÆ3µ²*) ÜçNÉ¡–é3©ª’Âr Ò\û¯RëVÆÕÓ¡³¢ò×Á²kVŸï xngT Së@§Üì_w¾8ë÷Ä­ßdå&'A»•ãÝöë«ÛÒJaeå]ñG7^BgöæÔÒj6[©ë¨¸M-£žÛÕe&-…°M¥xvÁÕ+v+€w‚š[’,ùŽ}5@K@@ \‰§~®Q=sóRË4biŠà¹&Ù Ï­§—ÄÔv¥ñG7ŠñG7Î…¢¦)€hQß¼L6±b¦*0ÄV],d“éMc¾îaîjÕGP¸¼h0ÃGÞQgêË÷‡šÍfÉ϶ƒ.€R€’0(wR«w:‡iAv¨ À(((%áP\E‚¢‘ßUçåY£BCBBœf³Ùi6›f³Y2™L.DF¼xñbò<°‘ñÒ„Úà—,‡tï2ô‰f¯ÚYÍ«ÑÁæýð¨ûê¼þöÓZG=z·»<Ç—ç4™L’ îë !&¥T€C‡%¾òÊ+É DîáASO•d"û—¬{Îæ¥µ‡qôèãÔ‰íöBMê)ªÂæq§eT¡& F¹Bd®"¹¬ê_ÆÝTõBöbxÜ,ò¼l Ú¾ô¤/ïßx#­¾`ã ¾6°œs’©¼Ä âÐÞãRIay …©©?“œj-/p•”åÚÓÏýQO FgØþ®m €U£‚š‚‘Â(ÒS‹LE…Î D€êt’—k‹ò§¼ÜÞìÁ{ßhO‰ü»WÇÖ@ ÓÖ³eóNƒîKÅÍ·uÒi?Õð}`¶°ÇÏšò.Z#”EÇ6æ³®Q”Y+› éÿl{Aù]»WAÿاM¹YÅ€¶ýº¼H‘SڷϘö„¸~ªh"Ôd7òС?L™ç²Y¿èõ…o½³³òBc;i—¸e?“j­ð=é‚Ëb<©jV%àx¬×¦É•56@€ÓLŸ.Ò›:Ù¾tÕG€ÝJ_šá™± ߆‚|›šW(`jÚîªúèÞ§ZµŽFH¨•••Rff¦íôéÓöÄÄÄò=‡w”–q@ ›µ±"ظÞ~ RóssJ“S¢o“ôog.9ô²Ø6®ÿ éiYþÍ£™gsy6[cÐ×ß•Ty€ Ú0<¬NÐmLO;‹ôÓgÚ•äÐÄÔ©Ó@¬ýÕß•<~4Ç&´+ Õ˜Ö1OhÀO¦vÃ,˜†ÔÂȘÙP+¾%þ¤)ÈL*©d`V  ±Ú¯ÀÌ+jv!Ï)Á¹Œb^ ¥@htݘz7öx¸ÙµW<¿õǸ”SéN–—çå2µù"”s™åÁÛÃP­éé_âÀj“Õìì)?I.[S¾ï´RØÓÏ÷w®û:>Ìj­ H óHâ‰GÓ|¥0åK¤××hG²Zs·Cr9›Z,–”õí3jVmºUxiʰ;*®áÇ¢zUÒ3¾‹å×uì;Ý[•¬}rH•׸-ÒçØ‡Ç”ËkØ÷ƒ<—°wì¸Ü¿²#NWèï?â^©Ž:€ãÅTÕñ…¾ÔŒÒîýKËTˆ¢Ø¼{@×VV怘˜ ´én¹sT«æ×oÛ¼ýÝïáâ‡Ö¼oý xt|]*²rNJûã¿UºVö©€þɪ‘æïãÉ«ý•{ï}w¥-[¶¬uÊ [½SÉ™µÅ«‘Á&(-Ë—7׸l® ûã×LgߨÒ„·ëÂsî–_ˆ(ŠCà±Ñ3ª«ì’Z^ª`r*mÿóLÍ g¶î欮õ8ã»n=‡y¤Ê]Iìe"µb› ‘LÃPUÊrqdï/Ž'V=pñÏ–ÍOö£2BWòògCDu$zнÝÍ{G€ 3FÈ;†EQÍ õ’©¢5oëL6È&øÞº¤W?Aó7hRÛÖj}Â<íÌc«jks)¼£ßj'¸ÚžÇõ7<O=õÔéY³fEßqWïN¿Äý¦k #î”!züS•ÆêYÓ6ºDQ\ÈŒ8räÈæ±cÇîÖä3ÄG²ò#…)M#½¥ðÀ¤0('FÔN=}UI ¶ÉR‡Û¼2»quY@ŒRzV„öÁVÕÏ©ÎäòÙmÔ©àTGÂåS²¤+}ñyŽntÄ‚%SÚBñ¡óm££ ${ó›o¾¹ûÒ¥K'_úRá `UìSÔÀ€ç&XÒs¦¦USEEÅÏ}úô™®Ý&Ñ‘ˆí¤7ß|3c̘1Ç{汑+¾Ü!\¢š´Ýä)OFôê3§¦mtÏàgžx»:UrØ=F {vÒÜpãµ™x1|Ø3ÕyéëЦç°×f½ˆo‰½”q0á%\KLLìÞµk×õš{—ò—…ø­à€+8©Ë÷w­ åWúØìVUþ•‹‹‹ 6lؤ*é‹ÿu×O騗V¥ô¥``¬¬´ Bhä¢ö1IŸZ˜/˜_5Ò ´   ¤I“& ü˜w›7­Ç¦õ‡¶ƒ1ibèð»_j†y§ÝnOŽˆˆèì‡$fk-]½zufJJÊ¡÷ßûdö‚7GË2©‰ÈËË+oÖ¬YÝ@ma+—mÁÊ/ƒ³…QС}ûŒY§Óé<v} ¶°E ¿g ãó¹xñ¢-&&&2 )Œ“{ì‹›4iÒ0ÐcFo¾ù~0}®ž$ u4º,W¶3¦"66vভ_t’$‡¨ø=yLfžÿ”Rŧ›z˜‚jAMñ›Ò¦TÞ§üoÞÖ9ïßYî2¨—ôE(õq(µ^”¿Ûøz.³}”÷íÛ÷+‹Å2Ñåtœ…N}Ô!Jj` @~Q¦¹á†6öîÝ}6‘i±žCnmXQqv%©ÿþ?[,–w q]Ðç¯ÀŽé˜7Y+ò½zõZj±X&ÂÕ^b6¤ % goÜ÷Á„ÄmBI°&Ë.çÀã-Ë AɽÜRM¥ÝêìѣNj噈кg.wye•…¶Aƒ‰‹esdxtA il%üØ¿U¯NÓs—»ž6«ê¸-]Ší÷rź21ý¶.3¶p5€ŽÚA‰FQéÁf0ý³cpQ =ÕÎÊì ™Î@qé°2)6†m4tЊh#9 WÍÇÉ}dÖ¾PÖGaìßf.CSîY(;”6–¿jhmÊl œ-AÛ&öL-/¢Š2ËX9™ì“Ϭ>³éµвšv:ØÇ ýü¼‘DõûScÄ•²t¬ŒÆÌ°\ÉìPg ø³<°zu`ãÐ’¥©ßxnª÷¼¥ÏayårýÚœñj (. µÝÆB(֮Ƭ¬f¬#Ô n—ÎÅMpÊÚÊÒ룓ñNë³U%£H>"Œ}¤†Çk«žvV¦úq È»)þ °4ˆlÖ‘ð71½UWϵÁ¤ó ¶=U•M¸ÕÙÑ1]BÒˤ:ešj©LÐNA§nüН¾c O ‘¢dMnb_î6 šr.ïhûJ¯¼Ë=öòxÀ®%XüëDÿÂöÐH™—³ŸÿN¼Iÿ‡ÇñJ®§AdAdAdA©ôÿW;Õú&2„IEND®B`‚objenesis-2.6/website/site/resources/.nojekyll0000644000175000017500000000000013122236310017711 0ustar apoapoobjenesis-2.6/website/site/resources/CNAME0000644000175000017500000000001613122236310016636 0ustar apoapoobjenesis.org objenesis-2.6/website/site/resources/objenesis-logo.png0000644000175000017500000001375113122236310021527 0ustar apoapo‰PNG  IHDRHHUí³G pHYs  šœ OiCCPPhotoshop ICC profilexÚSgTSé=÷ÞôBKˆ€”KoR RB‹€‘&*! Jˆ!¡ÙQÁEEÈ ˆŽŽ€ŒQ, Š Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×>ç¬ó³ÏÀ –H3Q5€ ©BàƒÇÄÆáä.@ $p³d!sý#ø~<<+"À¾xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€@zŽB¦@F€˜&S `ËcbãP-`'æÓ€ø™{[”! ‘ eˆDh;¬ÏVŠEX0fKÄ9Ø-0IWfH°·ÀÎ ² 0Qˆ…){`È##x„™FòW<ñ+®ç*x™²<¹$9E[-qWW.(ÎI+6aaš@.Ây™24àóÌ ‘àƒóýxήÎÎ6޶_-ê¿ÿ"bbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^  u÷‹f²@µ éÚWópø~<ß5°j>{‘-¨]cöK'XtÀâ÷ò»oÁÔ(€hƒáÏwÿï?ýG %€fI’q^D$.Tʳ?ÇD *°AôÁ,ÀÁÜÁ ü`6„B$ÄÂBB d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼ AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ɈQ"K‘5H1RŠT UHò=r9‡\Fº‘;È2‚ü†¼G1”²Q=Ô µC¹¨7„F¢ Ðdt1š ›Ðr´=Œ6¡çЫhÚ>CÇ0Àè3Äl0.ÆÃB±8, “c˱"¬ «Æ°V¬»‰õcϱwEÀ 6wB aAHXLXNØH¨ $4Ú 7 „QÂ'"“¨K´&ºùÄb21‡XH,#Ö/{ˆCÄ7$‰C2'¹I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ääÃä3ää!ò[ b@q¤øSâ(RÊjJåå4åe˜2AU£šRݨ¡T5ZB­¡¶R¯Q‡¨4uš9̓IK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw †ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê •J•&•*/T©ª¦ªÞª UóUËT©^S}®FU3Sã© Ô–«UªPëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k «†u5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§¦½E»YûAÇJ'\'GgÎçSÙSݧ §M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õG X³ $Û Î<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕFFŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­­%Ö»­»§§¹N“N«žÖgðñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ã“}º}ý= ‡Ù«Z~s´r:V:ޚΜî?}Åô–é/gXÏÏØ3ã¶Ë)ÄiS›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝȽäJtõq]ázÒõ›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ? Ÿ•0k߬~OCOgµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿѧ€%g‰A[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA‚­‚åÁ­!hÈì­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~ '…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕXXIlK9.*®6nl¾ßüíó‡ââ ã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž yÂÂg"/Ñ6шØC\*NòH*Mz’쑼5y$Å3¥,幄'©¼L LÝ›:žšv m2=:½1ƒ’‘qBª!M“¶gêgæfvˬe…²þÅn‹·/•Ék³¬Y- ¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+Íí̳ÊÛ7œïŸÿíÂá’¶¥†KW-X潬j9²‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—n ÙÚ´ ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒݵa×ønÑî{¼ö4ìÕÛ[¼÷ý>ɾÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TRÖ+ëGǾþïw- 6 UœÆâ#pDyäé÷ ß÷ :ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ499â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×Îјѡ—ò—“¿m|¥ýêÀë¯ÛÆÂƾÉx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSЧû“““ÿ˜óüc3-Û cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅF IDATxÚìœ{pTÕÇ¿çîÝÍnÈ‹°áLdÇXZ`Úci-3–±:B;(Έ"v¦J;ê”¶êÔÒvDëà´Ñš‚Ôò²ŠVÞ>±R @Ø(DÈûµï×ÝÇ=§ì¹ÉÉÍ>ÃÆD›3sg³wwï¹çs¿¿ßùý~çÞÆÆZâ&!4h Р1@_Ú&!d¸û!#4>–@é6›Ífð8€»Ì`åPcÍŒ±]gΜٺnÝºŽ ‚$Œ±´d³Ù,Žøú—ÑT(¥'wíÚuÇÖ­[ƒ òW=°!)èq Ž¥°wâêgxœŒ®`œÅFÉq  ÈøRëòƒUsþswÃåw"Âå°©)5˜R9ØŠÎe”je0 ñ}(ªœû÷‘gïoj9í sP””É,6Î;G1œÔÍ$›oY¶dí£ÊLP €‰ûT2T3À•OÝ£@2õh{óóŠW8 ‹ƒÎ'íër¦'àuEG;ž”Íh0PÀÌw…„ø«*šYÆ€¾ ÕB$ œ+Eàã[CÊØÄ¾zmâÐÍÕ$s¿L43û ¥,-ÿ{Ï €oùÜIçèýßçbfþªÁ1êÁ|P¶Û¶«µø# <þ|µººZš1c†´fÍ+¼üÜå¬÷»cǎɧOŸìÝ»·Ñår9 &–n Hl6Ž“5Ž?©¨¨ eeeÄjµÊf³yªS÷™Ü¼â™Øú‡«A$¯×ë>{öì>øàNרy@GÐ=›æÄÝR¢ðz"ð¸#xïάúÀh$(™lÁäi¹(+Ï#þwzhã/ºøŒ¦ˆŽ8 Ÿ>P ·+ §#{OönŽÞ +Œ —ƒîÛËúßYs0¡„{ø‘;àá*RF!C­ FSc²I‚ld™À Œ•R¨$VYHQ¡TøýQ˜ŒIHcæº8´u‹Ý~Í À7âN:Ë8‰—äñrHA¡–\–\¹¹2Ì ²”*F#ú8®ººúó‰f±i¥UdÊÄ9†)“gŒË-*Áʵ¬øÎòû[v¿þØNÎ*RŸßîõùì]^¿³Ýåél»ÞVßñÎáWíIEEÀÓ‚Ò…T ª+*"aá0E4JAU€ªŒ1 0$&³?Zõ›ü€â ½uô-”mÛ¶Y—/]RôÉí¸z)–gäOú.€rFÐx«êë"½Ž–pg×U_ãå“vJ/ŸAœÜIöµ};›àsGAéûž©SæZµ Ζ-[JV®\Y-I–ßVÖH–å &0¤èüùóå7Ä:É„Òò\L)ë$3L&žxz•£lê<µ¥­Þ+L«ž,ªüo€ÇM¯0–AN[[[[¹hÑ¢Y}c<Óæ‰EÖ ápÐÍË TNQ$»ÀcîÌ(DÍ•P6s¦•Ô©¹È1Ë`ŒÁã ãÚUº:l¼§v‚%'_Þ¶cõ'\1.aÓf‘!—:X ''Âi¸Ðá;sÒ‘§MVݽM6]“€™ à¦ÏÁyÜ¡VÓâý&7߀YsòQ>+Ö‰HßAk³íÍ´^÷C ôÛˆ%'_ëÛÀÍ“Æ^¾¹ø3*«¦èf.5JqâP£·éR0_ƒ£(¾¶Cï½x–{ ‰Ùl6àçžj%°÷¯½{¸½ÛãP (˜fÍÉCåÜBLœl!öÞ êÏÚq½Ñ{w8 ïÔËXvÞLj>™¨Z›Ýôп#jDÎ×€…ÂÁî£ýe·¢¸O9TY€“`7€Õ}gî ;¾Õú¹³7º±e@a±Õ·aÖìBM<®0Ο¶ãê%¼ÎèP,#*Ôeœ\EÞŒª†ªçí}×%@ÎékÀÑxäý÷µ´ÕGy^ È‚röXë›á쩞‹N9gd¡vâ,™€²éy ”áúç>|vÑ…®ÖªQ[xÙS@ùõ3Y¢KP¥£‘tDD¯5×Õ½}üO§x²ÊxÈÀ­)hƒGU);¸§Ùæè ߬¹JU÷·¾WZ8«²‘ÅÅsØÎ¹ô«Ù˜õó9 å Â©M+ °$ê‰ý„¢£ëªæÆ–_þz}å3Û×Ï!„t¸à"ŸIk€6jÊysÏõÏœ=‘›û’ưïÄñ“Û±þgÛ_€¾Ò„H(«u×¼8« qñR9æ8E±„íÏ{.7}ì<~üøT«ÕÚ`?€×4q@¡¨/¹áì‰Ü¤uãt·ÿ¹f÷Æ#&hÎ2­peÒê1UUUÆÍ›7ß4wîÜ©”×1'çp¹éc-))éðG§CÙ÷ÞáfßãOþ@übè*€ê†s®¾O"ÔñRÍîÇпv4,mÓ¦ME¦òòò饥¥wäææ–J’$g–½ë}Q ÇÝÏ4(IÒ.]¶Ð»tÙÂA_•c>†>%IÒ?\Ž~³_{ßâ{ï^ÿÉmm­­­öá´aÆÒxû)¥ð¸#pÚCš–î–W”Ï”6‡Åm2Ì›7oO]]]Qa±éGOX€·÷7“ù‹‹§OŸ9czeeå°åe”2ø}±Â˜Ç†ÛBo—ÂìÝaPÊHæ¦5Ð1ǣɿEl-ÌÏ'ÀÃëw’í5k™¾&M,Xðʯ6¿–˜¶±ÂvèÆÄ)9˜XjA±5'ë€j_¸ÏRH|3ÊÜ´ôõ‚ÂúUŒí5kÙC÷þ<ÿÒO˜~Uƒ<õû׺<[£›îŽ.žqáýC]_P=(6,ƒ‘`R©9a@8ÓöéoIlbB쯯>°çÖ«/WÍþöºÂ‚’%FÙB­@¦Í*ž¹XÂõ­Ôa’i^²““u RùIz“ $ˬ³Ð´éVËä»ùæNï¤ö;ƒi À¨ªªJÛIS¡Ô©ý=Œ€úâ…÷açõ v+Iª*ÀIRøH`Zi7}H/ÞñI…«0Ú©kñˆŸ«ÆÎ¶#.œxN9ÓÒA%)–âÞ¼ *I_zȜإ‚ÿ pSóÆUí 8éúÑ´˜^j¦€ÄiŸ¥s!¨F”»ØGTˆMÂÙ‡“P ҃ʶjô 3|3y¸œxNYÿšÁäŒF˜=ÕdxÈÁp!‹ótAâŠQlå"€²ªñ³šgØ'†“"Ïê;†í?〤t"é,ƒaý¶9H5ñ?»!8i:eš@} $ R“Ë1ÕªBbE¥ '®«MÓ)'€CÈÉÅ´ÄkI[1¨†ÅÍ­Ä«#pR:e#€‚d ÊÐn vÓd&™I ‰'èu³GLîÄÌ,YñA.\ø¥ôt~‘aàÃU À$K,“™Ô€Ü*ÑTžNÂR÷V ù´Œº\®PV­Y³Æ¿ÿþïYåÿöAI&3Õ¤ïŒïgº:Qr§ÌÀÐÞuEтҚššžd>(í{¹ƒ6/œ·jʲ[×0ʦê„QF2'œÌ§0©Dpâ]‚Dp<žnõõ·¶vù{€<ÁsdccèÙúƒ^ŸßqßÒÅw=’ŸW¼Â çp`…rIâ›øÐÒ‡ÃC(ä¥m]W”Oîtù»‡'Æ^¡zqC ÒÌÑ„ØR±±Ò*[•-0±gÌè¿c]¯Â/²±8• U¨˜v8 à9ÆX [‘4åId±ûy´§dÀ÷ v·†œÀ¿‘‚¡|£ULµ{‘²’‹éK£ £61ðúM>ú+ŠWk)@⢄Vœƒ d ؉ýK'^Þ™x—Æh5±°P%uÈ!„ÈŒ±h6LŒ h†¸dµ¡ŒÐ­VŽ@b!0ÌMM{ÂÐÄ'€2Ifê¤õeJm™Æ(lú'öF ±”,>3²{‚ØlˆI+蟳"#è “9êx•RýÒ³6Š ‡J )ÀŒ&@ñ@é¿+Ž…ÉY: –&HŒ"Hi•™ÉØÁKµ$í+rÖÙPIEND®B`‚objenesis-2.6/mvnw.cmd0000755000175000017500000001202113122236310013126 0ustar apoapo@REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @REM regarding copyright ownership. The ASF licenses this file @REM to you under the Apache License, Version 2.0 (the @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM @REM http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM KIND, either express or implied. See the License for the @REM specific language governing permissions and limitations @REM under the License. @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- @REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files @REM ---------------------------------------------------------------------------- @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @echo off @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal set ERROR_CODE=0 @REM To isolate internal variables from possible post scripts, we use another setlocal @setlocal @REM ==== START VALIDATION ==== if not "%JAVA_HOME%" == "" goto OkJHome echo. echo Error: JAVA_HOME not found in your environment. >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error :OkJHome if exist "%JAVA_HOME%\bin\java.exe" goto init echo. echo Error: JAVA_HOME is set to an invalid directory. >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error @REM ==== END VALIDATION ==== :init @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". @REM Fallback to current working directory if not found. set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir set EXEC_DIR=%CD% set WDIR=%EXEC_DIR% :findBaseDir IF EXIST "%WDIR%"\.mvn goto baseDirFound cd .. IF "%WDIR%"=="%CD%" goto baseDirNotFound set WDIR=%CD% goto findBaseDir :baseDirFound set MAVEN_PROJECTBASEDIR=%WDIR% cd "%EXEC_DIR%" goto endDetectBaseDir :baseDirNotFound set MAVEN_PROJECTBASEDIR=%EXEC_DIR% cd "%EXEC_DIR%" :endDetectBaseDir IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig @setlocal EnableExtensions EnableDelayedExpansion for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% :endReadAdditionalConfig SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end :error set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' if "%MAVEN_BATCH_PAUSE%" == "on" pause if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% exit /B %ERROR_CODE% objenesis-2.6/benchmark/0000755000175000017500000000000013122236310013405 5ustar apoapoobjenesis-2.6/benchmark/.settings/0000755000175000017500000000000013122236310015323 5ustar apoapoobjenesis-2.6/benchmark/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005752013122236310022316 0ustar apoapoeclipse.preferences.version=1 org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.codeComplete.argumentSuffixes= org.eclipse.jdt.core.codeComplete.fieldPrefixes= org.eclipse.jdt.core.codeComplete.fieldSuffixes= org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=100 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=1 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=3 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=3 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true objenesis-2.6/benchmark/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000573013122236310021777 0ustar apoapoeclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Objenesis formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=false sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true objenesis-2.6/benchmark/src/0000755000175000017500000000000013122236310014174 5ustar apoapoobjenesis-2.6/benchmark/src/main/0000755000175000017500000000000013122236310015120 5ustar apoapoobjenesis-2.6/benchmark/src/main/java/0000755000175000017500000000000013122236310016041 5ustar apoapoobjenesis-2.6/benchmark/src/main/java/org/0000755000175000017500000000000013122236310016630 5ustar apoapoobjenesis-2.6/benchmark/src/main/java/org/objenesis/0000755000175000017500000000000013122236310020611 5ustar apoapoobjenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/0000755000175000017500000000000013122236310022543 5ustar apoapoobjenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java0000644000175000017500000000660613122236310030600 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.benchmark; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.NoOp; import org.objenesis.Objenesis; import org.objenesis.ObjenesisStd; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator; import org.objenesis.strategy.BaseInstantiatorStrategy; import org.objenesis.strategy.InstantiatorStrategy; import org.objenesis.strategy.SingleInstantiatorStrategy; import org.objenesis.strategy.StdInstantiatorStrategy; import org.openjdk.jmh.annotations.*; import java.util.concurrent.TimeUnit; /** * Benchmark comparing different instantiator strategies * * @author Henri Tremblay */ @BenchmarkMode(Mode.AverageTime) @Threads(32) @Fork(2) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 10, time = 1) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Benchmark) public class ConcurrentGetInstantiator { private static final int COUNT = 1000; public static class SunInstantiatorStrategy extends BaseInstantiatorStrategy { @Override public ObjectInstantiator newInstantiatorOf(Class type) { return new SunReflectionFactoryInstantiator(type); } } InstantiatorStrategy std = new StdInstantiatorStrategy(); InstantiatorStrategy single = new SingleInstantiatorStrategy(SunReflectionFactoryInstantiator.class); InstantiatorStrategy custom = new SunInstantiatorStrategy(); Objenesis cachedStd = new ObjenesisStd(); Objenesis uncachedStd = new ObjenesisStd(false); Class[] toInstantiate = new Class[COUNT]; @State(Scope.Thread) public static class ThreadState { int index = 0; } @Setup public void setUp() { for(int i = 0; i < COUNT; i++) { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); // deactivate the cache to get a new instance each time enhancer.setCallbackType(NoOp.class); Class c = enhancer.createClass(); toInstantiate[i] = c; } } @Benchmark public ObjectInstantiator std(ThreadState state) { return std.newInstantiatorOf(toInstantiate[state.index++ % COUNT]); } @Benchmark public ObjectInstantiator single(ThreadState state) { return single.newInstantiatorOf(toInstantiate[state.index++ % COUNT]); } @Benchmark public ObjectInstantiator custom(ThreadState state) { return custom.newInstantiatorOf(toInstantiate[state.index++ % COUNT]); } @Benchmark public ObjectInstantiator cachedStd(ThreadState state) { return cachedStd.getInstantiatorOf(toInstantiate[state.index++ % COUNT]); } @Benchmark public ObjectInstantiator uncachedStd(ThreadState state) { return uncachedStd.getInstantiatorOf(toInstantiate[state.index++ % COUNT]); } } objenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java0000644000175000017500000000736313122236310025751 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.benchmark; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator; import org.objenesis.instantiator.sun.UnsafeFactoryInstantiator; import org.openjdk.jmh.annotations.*; import sun.misc.Unsafe; import sun.reflect.ReflectionFactory; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.util.concurrent.TimeUnit; /** * Benchmark comparing different instantiators * * @author Henri Tremblay */ @BenchmarkMode(Mode.AverageTime) @Fork(2) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 10, time = 1) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Benchmark) public class CreateObject { ObjectInstantiator sunInstantiator; ObjectInstantiator unsafeInstantiator; Unsafe unsafe; Constructor constructor; Class type = Object.class; @SuppressWarnings("unchecked") private Constructor getConstructor() { try { ReflectionFactory factory = ReflectionFactory.getReflectionFactory(); Constructor objectConstructor =type.getConstructor((Class[]) null); Constructor c = (Constructor) factory.newConstructorForSerialization(type, objectConstructor); return c; } catch (Exception e) { throw new RuntimeException(e); } } private Unsafe getUnsafe() { Field f; try { f = Unsafe.class.getDeclaredField("theUnsafe"); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } f.setAccessible(true); try { return (Unsafe) f.get(null); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } @Setup public void prepare() { sunInstantiator = new SunReflectionFactoryInstantiator(type); unsafeInstantiator = new UnsafeFactoryInstantiator(type); unsafe = getUnsafe(); constructor = getConstructor(); } @Benchmark public Object createObjectWithConstructor() { return new Object(); } @Benchmark public Object createObjectWithMungedConstructor() { return sunInstantiator.newInstance(); } @Benchmark public Object createObjectWithMungedConstructorRaw() throws Exception { return constructor.newInstance(); } @Benchmark public Object createObjectWithMungedConstructorRawAndCast() throws Exception { return type.cast(constructor.newInstance()); } @Benchmark public Object createObjectWithUnsafe() { return unsafeInstantiator.newInstance(); } @Benchmark public Object createObjectWithUnsafeRaw() throws Exception { return unsafe.allocateInstance(type); } @Benchmark public Object createObjectWithUnsafeRawAndCast() throws Exception{ return type.cast(unsafe.allocateInstance(type)); } @Benchmark public Object createObjectWithUnsafeRawException() { try { return unsafe.allocateInstance(type); } catch(InstantiationException e) { throw new ObjenesisException(e); } } } objenesis-2.6/benchmark/pom.xml0000644000175000017500000000706313122236310014730 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 objenesis-benchmark Objenesis Benchmark Objenesis' Benchmark http://objenesis.org 1.8 1.19 benchmarks org.objenesis objenesis ${project.version} org.openjdk.jmh jmh-core ${jmh.version} org.openjdk.jmh jmh-generator-annprocess ${jmh.version} provided cglib cglib-nodep 3.2.5 maven-compiler-plugin ${javac.target} ${javac.target} ${javac.target} com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin maven-remote-resources-plugin maven-deploy-plugin true maven-shade-plugin 2.4.3 package shade ${uberjar.name} org.openjdk.jmh.Main *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA objenesis-2.6/benchmark/launch.bat0000644000175000017500000000027713122236310015355 0ustar apoapomvn clean package echo "Possible filters" echo "org.objenesis.benchmark.CreateObject.*" echo "org.objenesis.benchmark.ConcurrentGetInstantiator.*" java -jar target/benchmarks.jar %* objenesis-2.6/benchmark/launch.sh0000755000175000017500000000145713122236310015225 0ustar apoapo#!/usr/bin/env bash # # Copyright 2006-2017 the original author or authors. # # 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. # mvn clean package echo "Possible filters:" echo " org.objenesis.benchmark.CreateObject.*" echo " org.objenesis.benchmark.ConcurrentGetInstantiator.*" java -jar target/benchmarks.jar $* objenesis-2.6/deploy-website.sh0000755000175000017500000000203413122236310014745 0ustar apoapo#!/bin/bash function pause { echo read -p "Press [enter] to continue" } # to exit in case of error set -e # make sure the script is launched from the project root directory if [ "$(dirname $0)" != "." ]; then echo "The script should be launched from Objenesis root directory" exit 1 fi # clone the website branch echo "************** CLONE ************************" git clone --depth=1 --branch gh-pages git@github.com:easymock/objenesis.git site pushd site # delete all none hidden directories (keep .git for instance) ls -1 | xargs rm -rf # compile de new website pushd ../website mvn clean package popd # copy the new site to the branch cp -R ../website/target/xsite/* . # to help debugging in case of issue echo "************** STATUS************************" git status # push the site echo "************** COMMIT ***********************" git add --ignore-removal . git commit -m "from master $(git log | head -n 1)" pause echo "************** PUSH ************************" git push origin gh-pages popd rm -rf site objenesis-2.6/mvnw0000755000175000017500000001450413122236310012374 0ustar apoapo#!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven2 Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then export JAVA_HOME="`/usr/libexec/java_home`" else export JAVA_HOME="/Library/Java/Home" fi fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Migwn, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" return 1 fi basedir="$1" wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then wdir=`cd "$wdir/.."; pwd` fi # end of workaround done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } BASE_DIR=`find_maven_basedir "$(pwd)"` if [ -z "$BASE_DIR" ]; then exit 1; fi export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} echo $MAVEN_PROJECTBASEDIR MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` [ -n "$MAVEN_PROJECTBASEDIR" ] && MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" objenesis-2.6/gae/0000755000175000017500000000000013122236310012207 5ustar apoapoobjenesis-2.6/gae/src/0000755000175000017500000000000013122236310012776 5ustar apoapoobjenesis-2.6/gae/src/main/0000755000175000017500000000000013122236310013722 5ustar apoapoobjenesis-2.6/gae/src/main/java/0000755000175000017500000000000013122236310014643 5ustar apoapoobjenesis-2.6/gae/src/main/java/org/0000755000175000017500000000000013122236310015432 5ustar apoapoobjenesis-2.6/gae/src/main/java/org/objenesis/0000755000175000017500000000000013122236310017413 5ustar apoapoobjenesis-2.6/gae/src/main/java/org/objenesis/gae/0000755000175000017500000000000013122236310020147 5ustar apoapoobjenesis-2.6/gae/src/main/java/org/objenesis/gae/JspReporter.java0000644000175000017500000001536113122236310023277 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.gae; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.objenesis.Objenesis; import org.objenesis.tck.Candidate; import org.objenesis.tck.Reporter; import org.objenesis.tck.TCK; import javax.servlet.jsp.JspWriter; /** * Reports results from TCK in an HTML table. * * @author Henri Tremblay * @see TCK * @see Reporter */ public class JspReporter implements Reporter { private static class Result { Candidate candidate; Candidate.CandidateType type; boolean result; Exception exception; /** * @param candidate Candidate tested * @param type Type of test performed * @param result If the test is successful or not * @param exception Exception that might have occurred during the test */ public Result(Candidate candidate, Candidate.CandidateType type, boolean result, Exception exception) { this.candidate = candidate; this.type = type; this.result = result; this.exception = exception; } } private final PrintWriter summary; private final PrintWriter log; private long startTime; private int errorCount; private Objenesis objenesisStandard; private Objenesis objenesisSerializer; private Candidate currentCandidate; private final Map> results = new TreeMap<>(); private String platformDescription; /** * @param summary Output of main report. * @param log Any additional information, useful for diagnostics. */ public JspReporter(JspWriter summary, JspWriter log) { this.summary = new PrintWriter(summary); this.log = new PrintWriter(log); } @Override public void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer) { this.platformDescription = platformDescription; this.objenesisStandard = objenesisStandard; this.objenesisSerializer = objenesisSerializer; this.currentCandidate = null; this.errorCount = 0; this.results.clear(); this.startTime = System.currentTimeMillis(); } @Override public void startTest(Candidate candidate) { currentCandidate = candidate; } @Override public void result(Candidate.CandidateType type, boolean success) { addResult(type, success, null); } @Override public void exception(Candidate.CandidateType type, Exception exception) { addResult(type, false, exception); } private void addResult(Candidate.CandidateType type, boolean success, Exception exception) { if(!success) { errorCount++; } Map result = results.get(currentCandidate); if(result == null) { results.put(currentCandidate, result = new HashMap<>()); } result.put(type, new Result(currentCandidate, type, success, exception)); } @Override public void endTests() { long totalTime = System.currentTimeMillis() - startTime; printResult(totalTime); } /** * Print the final summary report * * @param totalTime Time spent running the TCK */ private void printResult(long totalTime) { // Platform summary.println("

Running TCK on platform: " + platformDescription + "

"); // Instantiator implementations summary.println("

Instantiators used:
"); summary.println(" Objenesis standard: " + objenesisStandard.getInstantiatorOf(String.class).getClass().getName() + "
"); summary.println(" Objenesis serializer: " + objenesisSerializer.getInstantiatorOf(String.class).getClass().getName() + "
"); summary.println("

"); Collection candidateNames = new ArrayList(); for(Map.Entry> entry : results.entrySet()) { candidateNames.add(entry.getKey().getDescription()); } // Strategy used summary.println(""); summary.print(""); summary.print(""); summary.println(""); List exceptions = new ArrayList(); // Candidates for(Map.Entry> entry : results.entrySet()) { summary.print(""); Result standardResult = entry.getValue().get(Candidate.CandidateType.STANDARD); Result serializationResult = entry.getValue().get(Candidate.CandidateType.SERIALIZATION); if(standardResult == null && serializationResult == null) { continue; } if(standardResult == null) { summary.print(""); } else { summary.print(""); if(standardResult.exception != null) { exceptions.add(standardResult); } } if(serializationResult == null) { summary.print(""); } else { summary.print(""); if(serializationResult.exception != null) { exceptions.add(serializationResult); } } summary.println(); } summary.println("
Objenesis standardObjenesis serializer
" + entry.getKey().getDescription() + "N/A" + (standardResult.result ? "Y" : "n") + "N/A" + (serializationResult.result ? "Y" : "n") + "
"); // Final if(errorCount != 0) { for(Result element : exceptions) { log.println("
--- Candidate '" + element.candidate.getDescription() + "', Type '" + element.type + "' ---");
            element.exception.printStackTrace(log);
            log.println("
"); } log.println(); summary.println("

--- FAILED: " + errorCount + " error(s) occured ---

"); } else { summary.println("

--- SUCCESSFUL: TCK tests passed without errors in " + totalTime + " ms

"); } } } objenesis-2.6/gae/src/main/java/org/objenesis/gae/JspWriterListener.java0000644000175000017500000000411213122236310024447 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.gae; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; import org.objenesis.tck.search.SearchWorkingInstantiatorListener; import javax.servlet.jsp.JspWriter; /** * @author Henri Tremblay */ public class JspWriterListener implements SearchWorkingInstantiatorListener { private static final String PATTERN = "%s%s"; private JspWriter writer; public JspWriterListener(JspWriter out) { this.writer = out; } public void instantiatorSupported(Class c) { try { writer.println(String.format(PATTERN, c.getSimpleName() + " (" + getTypology(c) + ")", "Working!")); } catch (IOException e) { throw new RuntimeException(e); } } public void instantiatorUnsupported(Class c, Throwable t) { ByteArrayOutputStream b = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(b)); try { writer.println(String.format(PATTERN, c.getSimpleName() + " (" + getTypology(c) + ")", "KO - " + b.toString())); } catch (IOException e) { throw new RuntimeException(e); } } private Typology getTypology(Class c) { Instantiator instantiatorAnn = c.getAnnotation(Instantiator.class); return instantiatorAnn == null ? Typology.UNKNOWN : instantiatorAnn.value(); } } objenesis-2.6/gae/src/main/webapp/0000755000175000017500000000000013122236310015200 5ustar apoapoobjenesis-2.6/gae/src/main/webapp/WEB-INF/0000755000175000017500000000000013122236310016227 5ustar apoapoobjenesis-2.6/gae/src/main/webapp/WEB-INF/appengine-web.xml0000644000175000017500000000201313122236310021466 0ustar apoapo ${app.id} ${app.version} true java8 objenesis-2.6/gae/src/main/webapp/WEB-INF/web.xml0000644000175000017500000000161013122236310017524 0ustar apoapo objenesis-2.6/gae/src/main/webapp/WEB-INF/logging.properties0000644000175000017500000000204613122236310021775 0ustar apoapo# # Copyright 2006-2017 the original author or authors. # # 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. # # A default java.util.logging configuration. # (All App Engine logging is through java.util.logging by default). # # To use this configuration, copy it into your application's WEB-INF # folder and add the following to your appengine-web.xml: # # # # # # Set the default logging level for all loggers to WARNING .level = WARNING objenesis-2.6/gae/src/main/webapp/index.jsp0000644000175000017500000000446513122236310017036 0ustar apoapo<%-- Copyright 2006-2017 the original author or authors. 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. --%> <%@ page contentType="text/html;charset=UTF-8" %> <%@ page import="java.io.PrintWriter" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.TreeMap" %> <%@ page import="org.objenesis.gae.JspReporter" %> <%@ page import="org.objenesis.gae.JspWriterListener" %> <%@ page import="org.objenesis.strategy.PlatformDescription" %> <%@ page import="org.objenesis.tck.Main" %> <%@ page import="org.objenesis.tck.candidates.SerializableNoConstructor" %> <%@ page import="org.objenesis.tck.search.SearchWorkingInstantiator" %> Search Objenesis Working Instantiator

Platform description

<%= PlatformDescription.describePlatform()%>

Properties

<% for(Map.Entry property : new TreeMap(System.getProperties()).entrySet()) { %> <%= "" %> <% } %>
Key Value
" + property.getKey() + "" + property.getValue() + "

Supported instantiator

<% SearchWorkingInstantiator i = new SearchWorkingInstantiator(new JspWriterListener(out)); i.searchForInstantiator(SerializableNoConstructor.class); out.flush(); %>
Instantiator Result

TCK

<% JspReporter reporter = new JspReporter(out, out); try { Main.run(reporter); } catch(Exception e) { out.println("
");
    e.printStackTrace(new PrintWriter(out));
    out.println("
"); } %> objenesis-2.6/gae/eclipse-launch-profiles/0000755000175000017500000000000013122236310016724 5ustar apoapoobjenesis-2.6/gae/eclipse-launch-profiles/UpdateApplication.launch0000644000175000017500000000147113122236310023531 0ustar apoapo objenesis-2.6/gae/eclipse-launch-profiles/DevAppServer.launch0000644000175000017500000000147413122236310022474 0ustar apoapo objenesis-2.6/gae/README.md0000644000175000017500000000040713122236310013467 0ustar apoapoWar application to deploy on GAE and test Objenesis =================================================== Dev server ---------- `mvn appengine:devserver` Deployment ---------- `mvn appengine:update` Open [objenesis.appspot.com](https://objenesis.appspot.com). objenesis-2.6/gae/pom.xml0000644000175000017500000001115613122236310013530 0ustar apoapo 4.0.0 objenesis-parent org.objenesis 2.6 gae war Objenesis GAE War to deploy and test on GAE objenesis 2 1.9.54 2.0.9.133.v201611104 com.google.appengine appengine-api-1.0-sdk ${appengine.version} javax.servlet servlet-api 2.5 provided javax.servlet.jsp jsp-api 2.2 provided jstl jstl 1.2 org.objenesis objenesis ${project.version} provided org.objenesis objenesis-tck ${project.version} com.google.appengine appengine-testing ${appengine.version} test com.google.appengine appengine-api-stubs ${appengine.version} test ${project.build.directory}/${project.build.finalName}/WEB-INF/classes maven-compiler-plugin 1.7 1.7 maven-deploy-plugin true maven-war-plugin 3.0.0 true ${basedir}/src/main/webapp/WEB-INF true WEB-INF com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin com.google.appengine appengine-maven-plugin ${appengine.version} false ${app.version} com.google.appengine gcloud-maven-plugin ${gcloud.plugin.version} objenesis-2.6/README.md0000644000175000017500000000663113122236310012740 0ustar apoapo# 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](http://objenesis.org). # Developer information ## Project status [![Build Status](https://travis-ci.org/easymock/objenesis.svg?branch=master)](https://travis-ci.org/easymock/objenesis) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis) ## Environment setup I'm using: - Maven 3.5.0 - IntelliJ Ultimate 2017.1.3 (thanks to JetBrains for the license) (it should also work with Eclipse) To configure your local workspace: - Import the Maven parent project to Eclipse or IntelliJ - Import the Eclipse formatting file `objenesis-formatting.xml` (usable in Eclipse or IntelliJ) ## 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 findbugs. `mvn install -Pfull` ## To run special builds ### Run the Android TCK - Install the Android SDK - Configure a device (real or simulated) - Add an `ANDROID_HOME` to target the Android SDK - Add `$ANDROID_HOME/platform-tools` to your path - Activate the debug mode if it's a real device - `mvn package -Pandroid` ### Run the benchmarks ```bash mvn package -Pbenchmark cd benchmark ./launch.sh ``` ### Generate the website `mvn package -Pwebsite` ## 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 the Sonatype maven repository - You will first need to add something like this to your settings.xml ```xml sonatype-nexus-snapshots sonatypeuser sonatypepassword sonatype-nexus-staging sonatypeuser sonatypepassword ``` - Then follow the instructions from the site below to create your key to sign the deployed items http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/ ## To check dependencies and plugins versions `mvn versions:display-dependency-updates versions:display-plugin-updates -Pall` ## To update the license `mvn validate license:format -Pall` ## To release * Add the release notes in `website/site/content/notes.html` * Add these servers to your `settings.xml` ```xml bintray your-user-name your-api-key gpg.passphrase your-passphrase ``` * Set `gpg_passphrase`, `bintray_api_key` and `bintray_user` environment variables * Launch an Android device (virtual or physical) * Launch `./deploy.sh version` * Answer the questions (normally, just acknowledge the proposed default) * Follow the instructions If something fails and you need to rollback a bit, the following commands might help: ```bash mvn release:rollback -Pall git tag -d $version git push origin :refs/tags/$version git reset --hard HEAD~2 ``` ## Deploy the website * Make sure the pom is at the version you want to release * Launch `./deploy_website.sh` objenesis-2.6/pom.xml0000644000175000017500000004020713122236310012773 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 pom Objenesis parent project A library for instantiating Java objects http://objenesis.org 2006 3.2.1 main tck Apache 2 http://www.apache.org/licenses/LICENSE-2.0.txt repo Joe Walnes, Henri Tremblay, Leonardo Mesquita https://github.com/easymock/objenesis scm:git:git@github.com:easymock/objenesis.git scm:git:https://github.com/easymock/objenesis.git 2.6 joe Joe Walnes -5 henri Henri Tremblay -5 leonardo Leonardo Mesquita -5 UTF-8 junit junit 4.12 junit junit test maven-compiler-plugin 1.6 1.6 maven-jar-plugin true false true true maven-release-plugin true @{project.version} false false release,full,all true maven-site-plugin false ${project.basedir}/website com.mycila.maven-license-plugin maven-license-plugin false true org.apache.maven.wagon wagon-ssh-external 2.10 maven-assembly-plugin 3.0.0 maven-compiler-plugin 3.6.1 maven-jar-plugin 3.0.2 maven-surefire-plugin 2.19.1 maven-clean-plugin 3.0.0 maven-deploy-plugin 2.8.2 maven-gpg-plugin 1.6 sign-artifacts verify sign maven-install-plugin 2.5.2 maven-release-plugin 2.5.3 maven-resources-plugin 3.0.1 maven-shade-plugin 2.4.3 maven-site-plugin 3.5.1 maven-source-plugin 3.0.1 maven-javadoc-plugin 2.10.4 org.apache.felix maven-bundle-plugin 3.2.0 com.keyboardsamurais.maven maven-timestamp-plugin 1.0 year create year yyyy com.mycila.maven-license-plugin maven-license-plugin 1.10.b1
${project.basedir}/../header.txt
true .gitignore target/** dependency-reduced-pom.xml eclipse_config/** website/** **/*.bat project.properties lint.xml gen/** bin/** **/*.txt **/*.launch **/*.md ${project.inceptionYear} ${year}
maven-remote-resources-plugin 1.5 process org.apache:apache-jar-resource-bundle:1.3 org.codehaus.mojo exec-maven-plugin 1.5.0 org.codehaus.mojo versions-maven-plugin 2.4 org.codehaus.mojo findbugs-maven-plugin 3.0.4 true Naming org.eclipse.m2e lifecycle-mapping 1.0.0 com.keyboardsamurais.maven maven-timestamp-plugin [1.0,) create maven-remote-resources-plugin [1.0,) process org.codehaus.mojo findbugs-maven-plugin [2.5.5,) findbugs
maven-project-info-reports-plugin 2.9 org.codehaus.mojo findbugs-maven-plugin 3.0.4 maven-pmd-plugin 3.7 1.5 bintray JFrog Bintray https://api.bintray.com/maven/easymock/maven/objenesis/;publish=1 full maven-source-plugin attach-sources jar maven-javadoc-plugin attach-javadocs jar org.codehaus.mojo findbugs-maven-plugin findbugs findbugs com.mycila.maven-license-plugin maven-license-plugin check check license com.mycila.maven-license-plugin maven-license-plugin format generate-sources format website website android tck-android benchmark benchmark release maven-gpg-plugin all benchmark tck-android gae website
objenesis-2.6/deploy.sh0000755000175000017500000000535613122236310013317 0ustar apoapo#!/bin/bash # This script expects: # - the version to be deployed as the first parameter # - bintray_user to be an environment variable # - bintray_api_key to be an environment variable # to exit in case of error set -e set -v function pause { echo read -p "Press [enter] to continue" } # make sure the version is passed in parameter if [ "$1" == "" ]; then echo "Version to deploy should be provided" exit 1 fi version=$1 if [ "$(git branch | grep $version)" == "$version" ]; then echo "A branch named $version clashes with the version tag" exit 1 fi message="should be an environment variable" [ -z "$gpg_passphrase" ] && echo "gpg_passphrase $message" && exit 1 [ -z "$bintray_api_key" ] && echo "bintray_api_key $message" && exit 1 [ -z "$bintray_user" ] && echo "bintray_user $message" && exit 1 mvn release:prepare -Pall,full,release # Need to push now because release:perform will checkout the remote tag git push git push --tags mvn release:perform -Pall,full,release echo "Please add the release notes in github" open "https://github.com/easymock/objenesis/tags" pause # Create the distribution in bintray content="{ \"name\": \"$version\", \"desc\": \"$version\", \"released\": \"${date}T00:00:00.000Z\", \"github_use_tag_release_notes\": true, \"vcs_tag\": \"$version\" }" curl -XPOST -H "Content-Type: application/json" -u$bintray_user:$bintray_api_key \ -d "$content" https://api.bintray.com/packages/easymock/distributions/objenesis/versions curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u$bintray_user:$bintray_api_key -T "main/target/objenesis-${version}-bin.zip" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-${version}-bin.zip?publish=1 curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u$bintray_user:$bintray_api_key -T "tck/target/objenesis-tck-${version}.jar" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-tck-${version}.jar?publish=1 curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u$bintray_user:$bintray_api_key -T "tck-android/target/objenesis-tck-android-${version}.apk" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-tck-android-${version}.apk?publish=1 echo "Flag the bin, tck and tck-android as 'Show in download list' in bintray" open "https://bintray.com/easymock/distributions/objenesis/${version}#files" pause echo "Add the bin, tck and tck-android jars to the release in GitHub" open "https://bintray.com/easymock/distributions/objenesis#" pause echo "Close the milestone in GitHub and create the new one" open "https://github.com/easymock/objenesis/milestones" pause echo "Sync to Maven central" open "https://bintray.com/easymock/maven/objenesis/${version}#central" pause echo echo "Job done!" echo objenesis-2.6/.gitignore0000644000175000017500000000036613122236310013450 0ustar apoapotarget/ eclipse_config/ .classpath .project org.eclipse.m2e.core.prefs org.eclipse.core.resources.prefs org.eclipse.pde.core.prefs *.iml .idea/ sys$command # maven-release-plugin release.properties pom.xml.next pom.xml.releaseBackup pom.xml.tag objenesis-2.6/.travis.yml0000644000175000017500000000007213122236310013563 0ustar apoapolanguage: java sudo: false branches: only: - master objenesis-2.6/main/0000755000175000017500000000000013122236310012377 5ustar apoapoobjenesis-2.6/main/.settings/0000755000175000017500000000000013122236310014315 5ustar apoapoobjenesis-2.6/main/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005752013122236310021310 0ustar apoapoeclipse.preferences.version=1 org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.codeComplete.argumentSuffixes= org.eclipse.jdt.core.codeComplete.fieldPrefixes= org.eclipse.jdt.core.codeComplete.fieldSuffixes= org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=100 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=1 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=3 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=3 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true objenesis-2.6/main/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000577113122236310020776 0ustar apoapoeclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Objenesis formatter_settings_version=12 internal.default.compliance=user org.eclipse.jdt.ui.exception.name=e org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=false sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true objenesis-2.6/main/src/0000755000175000017500000000000013122236310013166 5ustar apoapoobjenesis-2.6/main/src/test/0000755000175000017500000000000013122236310014145 5ustar apoapoobjenesis-2.6/main/src/test/java/0000755000175000017500000000000013122236310015066 5ustar apoapoobjenesis-2.6/main/src/test/java/android/0000755000175000017500000000000013122236310016506 5ustar apoapoobjenesis-2.6/main/src/test/java/android/os/0000755000175000017500000000000013122236310017127 5ustar apoapoobjenesis-2.6/main/src/test/java/android/os/Build.java0000644000175000017500000000156213122236310021035 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package android.os; /** * Mimics the real Android class. Used for testing * * @author Henri Tremblay */ public class Build { public static class VERSION { public static final int SDK_INT = 42; public static final String SDK = "42"; } } objenesis-2.6/main/src/test/java/org/0000755000175000017500000000000013122236310015655 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/0000755000175000017500000000000013122236310017636 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/instantiator/0000755000175000017500000000000013122236310022355 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/0000755000175000017500000000000013122236310023332 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java0000644000175000017500000000375513122236310031146 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.util; import org.junit.Test; import org.objenesis.instantiator.util.ClassDefinitionUtils; import static org.junit.Assert.*; /** * @author Henri Tremblay */ public class ClassDefinitionUtilsTest { String className = "org.objenesis.EmptyClassBis"; @Test public void testDefineClass() throws Exception { byte[] b = ClassDefinitionUtils.readClass(className); Class c = ClassDefinitionUtils.defineClass(className, b, getClass().getClassLoader()); assertEquals(c.getName(), className); } @Test public void testClassNameToInternalClassName() { String actual = ClassDefinitionUtils.classNameToInternalClassName(className); assertEquals("org/objenesis/EmptyClassBis", actual); } @Test public void testClassNameToResource() { String actual = ClassDefinitionUtils.classNameToResource(className); assertEquals("org/objenesis/EmptyClassBis.class", actual); } @Test public void testGetExistingClass_existing() { Class actual = ClassDefinitionUtils.getExistingClass(getClass().getClassLoader(), getClass().getName()); assertSame(actual, getClass()); } @Test public void testGetExistingClass_notExisting() { Class actual = ClassDefinitionUtils.getExistingClass(getClass().getClassLoader(), getClass().getName() + "$$$1"); assertNull(actual); } } objenesis-2.6/main/src/test/java/org/objenesis/instantiator/basic/0000755000175000017500000000000013122236310023436 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java0000644000175000017500000000234513122236310031364 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import org.junit.Ignore; import org.junit.Test; import org.objenesis.EmptyClass; import org.objenesis.instantiator.ObjectInstantiator; import static org.junit.Assert.*; /** * @author Henri Tremblay */ @Ignore("Because it doesn't work without -Xverify:none") public class ProxyingInstantiatorTest { @Test public void testNewInstance() throws Exception { ObjectInstantiator inst = new ProxyingInstantiator(EmptyClass.class); EmptyClass c = inst.newInstance(); assertEquals("EmptyClass$$$Objenesis", c.getClass().getSimpleName()); } } objenesis-2.6/main/src/test/java/org/objenesis/instantiator/sun/0000755000175000017500000000000013122236310023162 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java0000644000175000017500000000365313122236310030314 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import org.junit.Before; import org.junit.Test; import org.objenesis.EmptyClass; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.PlatformDescription; import static org.junit.Assert.*; import static org.junit.Assume.*; /** * @author Henri Tremblay */ public class MagicInstantiatorTest { @Before public void before() { // I know it works on Hotspot and OpenJDK. Before JDK 9. Not sure on others assumeTrue((PlatformDescription.isThisJVM(PlatformDescription.HOTSPOT) || PlatformDescription.isThisJVM(PlatformDescription.OPENJDK)) && !PlatformDescription.SPECIFICATION_VERSION.equals("9") ); } @Test public void testNewInstance() throws Exception { ObjectInstantiator o1 = new MagicInstantiator(EmptyClass.class); assertEquals(EmptyClass.class, o1.newInstance().getClass()); ObjectInstantiator o2 = new MagicInstantiator(EmptyClass.class); assertEquals(EmptyClass.class, o2.newInstance().getClass()); } @Test public void testInternalInstantiator() { ObjectInstantiator o1 = new MagicInstantiator(EmptyClass.class).getInstantiator(); assertEquals(EmptyClass.class, o1.newInstance().getClass()); } } objenesis-2.6/main/src/test/java/org/objenesis/EmptyClassBis.java0000644000175000017500000000157313122236310023231 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import java.util.Date; /** * Just used for testing. To see the bytecode of a really simple class * * @author Henri Tremblay */ public class EmptyClassBis extends Date { public EmptyClassBis() { throw new RuntimeException(); } } objenesis-2.6/main/src/test/java/org/objenesis/strategy/0000755000175000017500000000000013122236310021500 5ustar apoapoobjenesis-2.6/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java0000644000175000017500000000273313122236310027200 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import org.junit.Test; import java.lang.reflect.Method; import static org.junit.Assert.*; /** * Currently the test just check nothing is crashing. A more complex test should play with class * loading an properties * * @author Henri Tremblay */ public class PlatformDescriptionTest { @Test public void isJvmName() { PlatformDescription.isThisJVM(PlatformDescription.HOTSPOT); } @Test public void test() { if(!PlatformDescription.isThisJVM(PlatformDescription.DALVIK)) { assertEquals(0, PlatformDescription.ANDROID_VERSION); } } @Test public void testAndroidVersion() throws Exception { Method m = PlatformDescription.class.getDeclaredMethod("getAndroidVersion0"); m.setAccessible(true); int actual = (Integer) m.invoke(null); assertEquals(42, actual); } } objenesis-2.6/main/src/test/java/org/objenesis/ExternalizableTest.java0000644000175000017500000000327613122236310024322 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; import org.junit.Test; import static org.junit.Assert.*; /** * This test makes sure issue #33 is not occurring. * * @author Henri Tremblay */ public class ExternalizableTest { public static class C { public int val = 33; protected C() {} } public static class B extends C implements Serializable { public B() { fail("B constructor shouldn't be called"); } } public static class A extends B implements Externalizable { public A() { fail("A constructor shouldn't be called"); } public void writeExternal(ObjectOutput out) throws IOException { } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { } } @Test public void test() { A a = ObjenesisHelper.newSerializableInstance(A.class); // The constructor from C should have been called assertEquals(33, a.val); } } objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java0000644000175000017500000000337413122236310025150 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import static org.junit.Assert.*; import org.junit.Test; /** * @author Henri Tremblay */ public class ObjenesisExceptionTest { @Test public final void testObjenesisExceptionString() { Exception e = new ObjenesisException("test"); assertEquals("test", e.getMessage()); } @Test public final void testObjenesisExceptionThrowable() { Exception cause = new RuntimeException("test"); Exception e = new ObjenesisException(cause); assertSame(cause, e.getCause()); assertEquals(cause.toString(), e.getMessage()); // Check null case e = new ObjenesisException((Throwable) null); assertNull(e.getCause()); assertEquals(null, e.getMessage()); } @Test public final void testObjenesisExceptionStringThrowable() { Exception cause = new RuntimeException("test"); Exception e = new ObjenesisException("msg", cause); assertSame(cause, e.getCause()); assertEquals("msg", e.getMessage()); // Check null case e = new ObjenesisException("test", null); assertNull(e.getCause()); assertEquals("test", e.getMessage()); } } objenesis-2.6/main/src/test/java/org/objenesis/EmptyClass.java0000644000175000017500000000156513122236310022574 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import java.util.Date; /** * Just used for testing. To see the bytecode of a really simple class * * @author Henri Tremblay */ public class EmptyClass extends Date { public EmptyClass() { throw new RuntimeException(); } } objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisTest.java0000644000175000017500000000533013122236310023263 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.InstantiatorStrategy; import static org.junit.Assert.*; /** * @author Henri Tremblay */ public class ObjenesisTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public final void testObjenesis() { Objenesis o = new ObjenesisStd(); assertEquals( "org.objenesis.ObjenesisStd using org.objenesis.strategy.StdInstantiatorStrategy with caching", o.toString()); } @Test public final void testObjenesis_WithoutCache() { Objenesis o = new ObjenesisStd(false); assertEquals( "org.objenesis.ObjenesisStd using org.objenesis.strategy.StdInstantiatorStrategy without caching", o.toString()); assertEquals(o.getInstantiatorOf(getClass()).newInstance().getClass(), getClass()); } @Test public final void testNewInstance() { Objenesis o = new ObjenesisStd(); assertEquals(getClass(), o.newInstance(getClass()).getClass()); } @Test public final void testGetInstantiatorOf() { Objenesis o = new ObjenesisStd(); ObjectInstantiator i1 = o.getInstantiatorOf(getClass()); // Test instance creation assertEquals(getClass(), i1.newInstance().getClass()); // Test caching ObjectInstantiator i2 = o.getInstantiatorOf(getClass()); assertSame(i1, i2); } @Test public final void testGetInstantiatorOf_primitive() { Objenesis o = new ObjenesisStd(); expectedException.expect(IllegalArgumentException.class); o.getInstantiatorOf(long.class); } @Test public final void testToString() { Objenesis o = new ObjenesisStd() {}; assertEquals( "org.objenesis.ObjenesisTest$1 using org.objenesis.strategy.StdInstantiatorStrategy with caching", o.toString()); } } class MyStrategy implements InstantiatorStrategy { public ObjectInstantiator newInstantiatorOf(Class type) { return null; } } objenesis-2.6/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java0000644000175000017500000000223113122236310026217 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import static org.junit.Assert.*; import java.io.NotSerializableException; import org.junit.Test; /** * @author Henri Tremblay * @author Leonardo Mesquita */ public class SerializingInstantiatorTest { @Test public void testNotSerializable() { ObjenesisSerializer o = new ObjenesisSerializer(); try { o.newInstance(Object.class); fail("Should have thrown an exception"); } catch (ObjenesisException e) { assertTrue(e.getCause() instanceof NotSerializableException); } } } objenesis-2.6/main/src/test/java/org/objenesis/ClassReader.java0000644000175000017500000002535413122236310022702 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import static org.junit.Assert.*; import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; /** * @author Henri Tremblay */ public class ClassReader { byte[] buffer = new byte[256]; Object[] constant_pool; public static void main(String[] args) throws IOException { if(args.length != 1) { System.out.println("Usage: ClassReader (path_to_the_class_file|class:complete_class_name)"); } ClassReader reader = new ClassReader(); reader.readClass(args[0]); } static class CONSTANT_Utf8_info { // int length; u2 is read by readUTF String bytes; CONSTANT_Utf8_info(DataInputStream in) throws IOException { bytes = in.readUTF(); } @Override public String toString() { return "CONSTANT_Utf8_info{" + "bytes='" + bytes + '\'' + '}'; } } static class CONSTANT_Methodref_info { int class_index; // u2 int name_and_type_index; // u2 CONSTANT_Methodref_info(DataInputStream in) throws IOException { class_index = in.readUnsignedShort(); name_and_type_index = in.readUnsignedShort(); } @Override public String toString() { return "CONSTANT_Methodref_info{" + "class_index=" + class_index + ", name_and_type_index=" + name_and_type_index + '}'; } } static class CONSTANT_Class_info { int name_index; // u2 public CONSTANT_Class_info(DataInputStream in) throws IOException{ name_index = in.readUnsignedShort(); } @Override public String toString() { return "CONSTANT_Class_info{" + "name_index=" + name_index + '}'; } } static class CONSTANT_NameAndType_info { int name_index; // u2 int descriptor_index; // u2 public CONSTANT_NameAndType_info(DataInputStream in) throws IOException{ name_index = in.readUnsignedShort(); descriptor_index = in.readUnsignedShort(); } @Override public String toString() { return "CONSTANT_NameAndType_info{" + "name_index=" + name_index + ", descriptor_index=" + descriptor_index + '}'; } } class method_info { int access_flags; // u2 int name_index; int descriptor_index; int attributes_count; attribute_info[] attributes; public method_info(DataInputStream in) throws IOException{ access_flags = in.readUnsignedShort(); name_index = in.readUnsignedShort(); descriptor_index = in.readUnsignedShort(); attributes_count = in.readUnsignedShort(); attributes = new attribute_info[attributes_count]; for (int i = 0; i < attributes_count; i++) { attributes[i] = new attribute_info(in); } } @Override public String toString() { return "method_info{" + "access_flags=" + access_flags + ", name_index=" + name_index + ", descriptor_index=" + descriptor_index + ", attributes_count=" + attributes_count + '}'; } } class attribute_info { int attribute_name_index; // u2 int attribute_length; // u4 Object info; public attribute_info(DataInputStream in) throws IOException{ attribute_name_index = in.readUnsignedShort(); attribute_length = in.readInt(); String attribute_name = ((CONSTANT_Utf8_info) constant_pool[attribute_name_index]).bytes; System.out.println(this + " " + attribute_name); if("Code".equals(attribute_name)) { info = new Code_attribute(in); } else if("SourceFile".equals(attribute_name)) { assertEquals(2, attribute_length); // always 2 info = new SourceFile_attribute(in); } else if("LineNumberTable".equals(attribute_name)) { // I don't care about that (only used for debugging) so I will skip System.out.println("Attribute LineNumberTable skipped"); in.read(buffer, 0, attribute_length); } else if("LocalVariableTable".equals(attribute_name)) { // I don't care about that (only used for debugging) so I will skip System.out.println("Attribute LocalVariableTable skipped"); in.read(buffer, 0, attribute_length); } else { fail("Unknown attribute: " + attribute_name); } System.out.println("\t" + info); } @Override public String toString() { return "attribute_info{" + "attribute_name_index=" + attribute_name_index + ", attribute_length=" + attribute_length + '}'; } } class Code_attribute { int max_stack; // u2 int max_locals; // u2 int code_length; // u4 byte[] code; // length of code_length int exception_table_length; // u2 if will be 0, so we will skip the exception_table int attributes_count; // u2 attribute_info[] attributes; Code_attribute(DataInputStream in) throws IOException { max_stack = in.readUnsignedShort(); max_locals = in.readUnsignedShort(); code_length = in.readInt(); code = new byte[code_length]; in.read(code); exception_table_length = in.readUnsignedShort(); attributes_count = in.readUnsignedShort(); attributes = new attribute_info[attributes_count]; for (int i = 0; i < attributes_count; i++) { attributes[i] = new attribute_info(in); } } @Override public String toString() { return "Code_attribute{" + "max_stack=" + max_stack + ", max_locals=" + max_locals + ", code_length=" + code_length + ", code=" + Arrays.toString(code) + ", exception_table_length=" + exception_table_length + ", attributes_count=" + attributes_count + '}'; } } static class SourceFile_attribute { int sourcefile_index; SourceFile_attribute(DataInputStream in) throws IOException { sourcefile_index = in.readUnsignedShort(); } @Override public String toString() { return "SourceFile_attribute{" + "sourcefile_index=" + sourcefile_index + '}'; } } public void readClass(String classPath) throws IOException { InputStream iin; if(classPath.startsWith("classpath:")) { String className = classPath.substring("classpath:".length()); String resourceName = classNameToResource(className); iin = getClass().getClassLoader().getResourceAsStream(resourceName); } else { iin = new FileInputStream(classPath); } DataInputStream in = new DataInputStream(iin); // magic number in.read(buffer, 0, MAGIC.length); assertArrayEquals(MAGIC); // version in.read(buffer, 0, VERSION.length); assertArrayEquals(VERSION); // constant_pool_count int constant_pool_count = in.readUnsignedShort(); System.out.println("Constant pool count: " + constant_pool_count); // indexed from 1 (0 will be unused) to constant_pool_count-1 constant_pool = new Object[constant_pool_count]; // constant pool for (int i = 1; i < constant_pool_count; i++) { System.out.print(i + ": "); int type = in.readUnsignedByte(); switch(type) { case CONSTANT_Utf8: constant_pool[i] = new CONSTANT_Utf8_info(in); break; case CONSTANT_Class: constant_pool[i] = new CONSTANT_Class_info(in); break; case CONSTANT_Methodref: constant_pool[i] = new CONSTANT_Methodref_info(in); break; case CONSTANT_NameAndType: constant_pool[i] = new CONSTANT_NameAndType_info(in); break; default: fail("Unknown type: " + type); } System.out.println(constant_pool[i]); } // access flags int access_flags = in.readUnsignedShort(); System.out.println("Access flags: " + access_flags); // see http://stackoverflow.com/questions/8949933/what-is-the-purpose-of-the-acc-super-access-flag-on-java-class-files // this class name int this_class = in.readUnsignedShort(); System.out.println("This class index: " + this_class); // super class name int super_class = in.readUnsignedShort(); System.out.println("This superclass index: " + super_class); // interfaces implemented count (we have none) int interfaces_count = in.readUnsignedShort(); System.out.println("Interfaces count: " + interfaces_count); for (int i = 0; i < interfaces_count; i++) { int index = in.readUnsignedShort(); System.out.println("Interface " + i + " index: " + index); } // fields count (we have none) int fields_count = in.readUnsignedShort(); System.out.println("Fields count: " + fields_count); assertEquals("Reading fields isn't yet supported", 0, fields_count); //methods count (we have one) int methods_count = in.readUnsignedShort(); System.out.println("Methods count: " + methods_count); for (int i = 0; i < methods_count; i++) { method_info methodInfo = new method_info(in); System.out.println("for " + methodInfo); } // reading final class attributes int attributes_count = in.readUnsignedShort(); System.out.println("Class attributes count: " + attributes_count); for (int i = 0; i < attributes_count ; i++) { attribute_info attributeInfo = new attribute_info(in); } in.close(); } private void assertArrayEquals(byte[] expected) { for (int i = 0; i < expected.length; i++) { if(expected[i] != buffer[i]) { fail("Expected was " + Arrays.toString(expected) + " but actual is " + Arrays.toString(buffer)); } } } } objenesis-2.6/main/src/main/0000755000175000017500000000000013122236310014112 5ustar apoapoobjenesis-2.6/main/src/main/java/0000755000175000017500000000000013122236310015033 5ustar apoapoobjenesis-2.6/main/src/main/java/org/0000755000175000017500000000000013122236310015622 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/0000755000175000017500000000000013122236310017603 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/ObjenesisStd.java0000644000175000017500000000265513122236310023052 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import org.objenesis.strategy.StdInstantiatorStrategy; /** * Objenesis implementation using the {@link org.objenesis.strategy.StdInstantiatorStrategy}. * * @author Henri Tremblay */ public class ObjenesisStd extends ObjenesisBase { /** * Default constructor using the {@link org.objenesis.strategy.StdInstantiatorStrategy} */ public ObjenesisStd() { super(new StdInstantiatorStrategy()); } /** * Instance using the {@link org.objenesis.strategy.StdInstantiatorStrategy} with or without * caching {@link org.objenesis.instantiator.ObjectInstantiator}s * * @param useCache If {@link org.objenesis.instantiator.ObjectInstantiator}s should be cached */ public ObjenesisStd(boolean useCache) { super(new StdInstantiatorStrategy(), useCache); } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/0000755000175000017500000000000013122236310022322 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/0000755000175000017500000000000013122236310024657 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Typology.java0000644000175000017500000000231713122236310027353 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.annotations; /** * Possible types of instantiator * @author Henri Tremblay */ public enum Typology { /** * Mark an instantiator used for standard instantiation (not calling a constructor). */ STANDARD, /** * Mark an instantiator used for serialization. */ SERIALIZATION, /** * Mark an instantiator that doesn't behave like a {@link #STANDARD} nor a {@link #SERIALIZATION} (e.g. calls a constructor, fails * all the time, etc.) */ NOT_COMPLIANT, /** * No type specified on the instantiator class */ UNKNOWN } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Instantiator.java0000644000175000017500000000217513122236310030206 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.annotations; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Denote that the class in an instantiator of a given type * * @author Henri Tremblay */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Instantiator { /** * @return type of instantiator */ Typology value(); } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java0000644000175000017500000000171113122236310026773 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator; /** * Instantiates a new object. * * @author Leonardo Mesquita */ public interface ObjectInstantiator { /** * Returns a new instance of an object. The returned object's class is defined by the * implementation. * * @return A new instance of an object. */ T newInstance(); } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/0000755000175000017500000000000013122236310023277 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java0000644000175000017500000001651313122236310030247 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.util; import org.objenesis.ObjenesisException; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; import sun.misc.Unsafe; /** * Helper class for ProxyObjectInstantiator. We can see the details of a class specification * here * * @author Henri Tremblay */ public final class ClassDefinitionUtils { public static final byte OPS_aload_0 = 42; public static final byte OPS_invokespecial = -73; // has two bytes parameters public static final byte OPS_return = -79; public static final byte OPS_new = -69; public static final byte OPS_dup = 89; public static final byte OPS_areturn = -80; public static final int CONSTANT_Utf8 = 1; public static final int CONSTANT_Integer = 3; public static final int CONSTANT_Float = 4; public static final int CONSTANT_Long = 5; public static final int CONSTANT_Double = 6; public static final int CONSTANT_Class = 7; public static final int CONSTANT_String = 8; public static final int CONSTANT_Fieldref = 9; public static final int CONSTANT_Methodref = 10; public static final int CONSTANT_InterfaceMethodref = 11; public static final int CONSTANT_NameAndType = 12; public static final int CONSTANT_MethodHandle = 15; public static final int CONSTANT_MethodType = 16; public static final int CONSTANT_InvokeDynamic = 18; public static final int ACC_PUBLIC = 0x0001; // Declared public; may be accessed from outside its package. public static final int ACC_FINAL = 0x0010; // Declared final; no subclasses allowed. public static final int ACC_SUPER = 0x0020; // Treat superclass methods specially when invoked by the invokespecial instruction. public static final int ACC_INTERFACE = 0x0200; // Is an interface, not a class. public static final int ACC_ABSTRACT = 0x0400; // Declared abstract; must not be instantiated. public static final int ACC_SYNTHETIC = 0x1000; // Declared synthetic; not present in the source code. public static final int ACC_ANNOTATION = 0x2000; // Declared as an annotation type. public static final int ACC_ENUM = 0x4000; // Declared as an enum type. public static final byte[] MAGIC = { (byte) 0xca, (byte) 0xfe, (byte) 0xba, (byte) 0xbe }; public static final byte[] VERSION = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x31 }; // minor_version, major_version (Java 5) private ClassDefinitionUtils() { } // private static Method DEFINE_CLASS; private static final ProtectionDomain PROTECTION_DOMAIN; static { PROTECTION_DOMAIN = AccessController.doPrivileged(new PrivilegedAction() { public ProtectionDomain run() { return ClassDefinitionUtils.class.getProtectionDomain(); } }); } /** * Define a class in the provided class loader from the array of bytes. Inspired by cglib * ReflectUtils.defineClass * * @param type of the class returned * @param className class name in the format org.objenesis.MyClass * @param b bytes representing the class * @param loader the class loader where the class will be loaded * @return the newly loaded class * @throws Exception whenever something goes wrong */ @SuppressWarnings("unchecked") public static Class defineClass(String className, byte[] b, ClassLoader loader) throws Exception { Class c = (Class) UnsafeUtils.getUnsafe().defineClass(className, b, 0, b.length, loader, PROTECTION_DOMAIN); // Force static initializers to run. Class.forName(className, true, loader); return c; } /** * Read the bytes of a class from the classpath * * @param className full class name including the package * @return the bytes representing the class * @throws IllegalArgumentException if the class is longer than 2500 bytes * @throws IOException if we fail to read the class */ public static byte[] readClass(String className) throws IOException { // convert to a resource className = classNameToResource(className); byte[] b = new byte[2500]; // I'm assuming that I'm reading class that are not too big int length; InputStream in = ClassDefinitionUtils.class.getClassLoader().getResourceAsStream(className); try { length = in.read(b); } finally { in.close(); } if(length >= 2500) { throw new IllegalArgumentException("The class is longer that 2500 bytes which is currently unsupported"); } byte[] copy = new byte[length]; System.arraycopy(b, 0, copy, 0, length); return copy; } /** * Write all class bytes to a file. * * @param fileName file where the bytes will be written * @param bytes bytes representing the class * @throws IOException if we fail to write the class */ public static void writeClass(String fileName, byte[] bytes) throws IOException { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName)); try { out.write(bytes); } finally { out.close(); } } /** * Will convert a class name to its name in the class definition format (e.g {@code org.objenesis.EmptyClass} * becomes {@code org/objenesis/EmptyClass}) * * @param className full class name including the package * @return the internal name */ public static String classNameToInternalClassName(String className) { return className.replace('.', '/'); } /** * Will convert a class name to its class loader resource name (e.g {@code org.objenesis.EmptyClass} * becomes {@code org/objenesis/EmptyClass.class}) * * @param className full class name including the package * @return the resource name */ public static String classNameToResource(String className) { return classNameToInternalClassName(className) + ".class"; } /** * Check if this class already exists in the class loader and return it if it does * * @param type of the class returned * @param classLoader Class loader where to search the class * @param className Class name with full path * @return the class if it already exists or null */ @SuppressWarnings("unchecked") public static Class getExistingClass(ClassLoader classLoader, String className) { try { return (Class) Class.forName(className, true, classLoader); } catch (ClassNotFoundException e) { return null; } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/UnsafeUtils.java0000644000175000017500000000260413122236310026406 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.util; import java.lang.reflect.Field; import org.objenesis.ObjenesisException; import sun.misc.Unsafe; /** * Helper class basically allowing to get access to {@code sun.misc.Unsafe} * * @author Henri Tremblay */ public final class UnsafeUtils { private static final Unsafe unsafe; static { Field f; try { f = Unsafe.class.getDeclaredField("theUnsafe"); } catch (NoSuchFieldException e) { throw new ObjenesisException(e); } f.setAccessible(true); try { unsafe = (Unsafe) f.get(null); } catch (IllegalAccessException e) { throw new ObjenesisException(e); } } private UnsafeUtils() {} public static Unsafe getUnsafe() { return unsafe; } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/0000755000175000017500000000000013122236310023403 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java0000644000175000017500000000267613122236310031077 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * The simplest instantiator - simply calls Class.newInstance(). This can deal with default public * constructors, but that's about it. * * @author Joe Walnes * @see ObjectInstantiator */ @Instantiator(Typology.NOT_COMPLIANT) public class NewInstanceInstantiator implements ObjectInstantiator { private final Class type; public NewInstanceInstantiator(Class type) { this.type = type; } public T newInstance() { try { return type.newInstance(); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java0000644000175000017500000001502513122236310030470 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; import org.objenesis.instantiator.util.ClassDefinitionUtils; import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; /** * This instantiator creates a class by dynamically extending it. It will skip the call to the parent constructor * in the bytecode. So that the constructor is indeed not called but you however instantiate a child class, not * the actual class. The class loader will normally throw a {@code VerifyError} is you do that. However, using * {@code -Xverify:none} should make it work * * @author Henri Tremblay */ @Instantiator(Typology.STANDARD) public class ProxyingInstantiator implements ObjectInstantiator { private static final int INDEX_CLASS_THIS = 1; private static final int INDEX_CLASS_SUPERCLASS = 2; private static final int INDEX_UTF8_CONSTRUCTOR_NAME = 3; private static final int INDEX_UTF8_CONSTRUCTOR_DESC = 4; private static final int INDEX_UTF8_CODE_ATTRIBUTE = 5; private static final int INDEX_UTF8_CLASS = 7; private static final int INDEX_UTF8_SUPERCLASS = 8; private static int CONSTANT_POOL_COUNT = 9; private static final byte[] CODE = { OPS_aload_0, OPS_return}; private static final int CODE_ATTRIBUTE_LENGTH = 12 + CODE.length; private static final String SUFFIX = "$$$Objenesis"; private static final String CONSTRUCTOR_NAME = ""; private static final String CONSTRUCTOR_DESC = "()V"; private final Class newType; public ProxyingInstantiator(Class type) { byte[] classBytes = writeExtendingClass(type, SUFFIX); try { newType = ClassDefinitionUtils.defineClass(type.getName() + SUFFIX, classBytes, type.getClassLoader()); } catch (Exception e) { throw new ObjenesisException(e); } } @SuppressWarnings("unchecked") public T newInstance() { try { return (T) newType.newInstance(); } catch (InstantiationException e) { throw new ObjenesisException(e); } catch (IllegalAccessException e) { throw new ObjenesisException(e); } } /** * Will generate the bytes for a class extending the type passed in parameter. This class will * only have an empty default constructor * * @param type type to extend * @param suffix the suffix appended to the class name to create the next extending class name * @return the byte for the class * @throws ObjenesisException is something goes wrong */ private static byte[] writeExtendingClass(Class type, String suffix) { String parentClazz = classNameToInternalClassName(type.getName()); String clazz = parentClazz + suffix; DataOutputStream in = null; ByteArrayOutputStream bIn = new ByteArrayOutputStream(1000); // 1000 should be large enough to fit the entire class try { in = new DataOutputStream(bIn); in.write(MAGIC); in.write(VERSION); in.writeShort(CONSTANT_POOL_COUNT); // set all the constant pool here // 1. class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_CLASS); // 2. super class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_SUPERCLASS); // 3. default constructor name in.writeByte(CONSTANT_Utf8); in.writeUTF(CONSTRUCTOR_NAME); // 4. default constructor description in.writeByte(CONSTANT_Utf8); in.writeUTF(CONSTRUCTOR_DESC); // 5. Code in.writeByte(CONSTANT_Utf8); in.writeUTF("Code"); // 6. Class name in.writeByte(CONSTANT_Utf8); in.writeUTF("L" + clazz + ";"); // 7. Class name (again) in.writeByte(CONSTANT_Utf8); in.writeUTF(clazz); // 8. Superclass name in.writeByte(CONSTANT_Utf8); in.writeUTF(parentClazz); // end of constant pool // access flags: We want public, ACC_SUPER is always there in.writeShort(ACC_PUBLIC | ACC_SUPER); // this class index in the constant pool in.writeShort(INDEX_CLASS_THIS); // super class index in the constant pool in.writeShort(INDEX_CLASS_SUPERCLASS); // interfaces implemented count (we have none) in.writeShort(0); // fields count (we have none) in.writeShort(0); // methods count (we have one: the default constructor) in.writeShort(1); // default constructor method_info in.writeShort(ACC_PUBLIC); in.writeShort(INDEX_UTF8_CONSTRUCTOR_NAME); // index of the method name () in.writeShort(INDEX_UTF8_CONSTRUCTOR_DESC); // index of the description in.writeShort(1); // number of attributes: only one, the code // code attribute of the default constructor in.writeShort(INDEX_UTF8_CODE_ATTRIBUTE); in.writeInt(CODE_ATTRIBUTE_LENGTH); // attribute length in.writeShort(1); // max_stack in.writeShort(1); // max_locals in.writeInt(CODE.length); // code length in.write(CODE); in.writeShort(0); // exception_table_length = 0 in.writeShort(0); // attributes count = 0, no need to have LineNumberTable and LocalVariableTable // class attributes in.writeShort(0); // none. No need to have a source file attribute } catch (IOException e) { throw new ObjenesisException(e); } finally { if(in != null) { try { in.close(); } catch (IOException e) { throw new ObjenesisException(e); } } } return bIn.toByteArray(); } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java0000644000175000017500000000450513122236310032222 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import java.io.ObjectStreamClass; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by using reflection to make a call to private method * ObjectStreamClass.newInstance, present in many JVM implementations. This instantiator will create * classes in a way compatible with serialization, calling the first non-serializable superclass' * no-arg constructor. * * @author Leonardo Mesquita * @see ObjectInstantiator * @see java.io.Serializable */ @Instantiator(Typology.SERIALIZATION) public class ObjectStreamClassInstantiator implements ObjectInstantiator { private static Method newInstanceMethod; private static void initialize() { if(newInstanceMethod == null) { try { newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod("newInstance"); newInstanceMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } private final ObjectStreamClass objStreamClass; public ObjectStreamClassInstantiator(Class type) { initialize(); objStreamClass = ObjectStreamClass.lookup(type); } @SuppressWarnings("unchecked") public T newInstance() { try { return (T) newInstanceMethod.invoke(objStreamClass); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java0000644000175000017500000001410313122236310032247 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.io.ObjectStreamConstants; import java.io.Serializable; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by using a dummy input stream that always feeds data for an empty object of * the same kind. NOTE: This instantiator may not work properly if the class being instantiated * defines a "readResolve" method, since it may return objects that have been returned previously * (i.e., there's no guarantee that the returned object is a new one), or even objects from a * completely different class. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.SERIALIZATION) public class ObjectInputStreamInstantiator implements ObjectInstantiator { private static class MockStream extends InputStream { private int pointer; private byte[] data; private int sequence; private static final int[] NEXT = new int[] {1, 2, 2}; private byte[][] buffers; private final byte[] FIRST_DATA; private static byte[] HEADER; private static byte[] REPEATING_DATA; static { initialize(); } private static void initialize() { try { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(byteOut); dout.writeShort(ObjectStreamConstants.STREAM_MAGIC); dout.writeShort(ObjectStreamConstants.STREAM_VERSION); HEADER = byteOut.toByteArray(); byteOut = new ByteArrayOutputStream(); dout = new DataOutputStream(byteOut); dout.writeByte(ObjectStreamConstants.TC_OBJECT); dout.writeByte(ObjectStreamConstants.TC_REFERENCE); dout.writeInt(ObjectStreamConstants.baseWireHandle); REPEATING_DATA = byteOut.toByteArray(); } catch(IOException e) { throw new Error("IOException: " + e.getMessage()); } } public MockStream(Class clazz) { this.pointer = 0; this.sequence = 0; this.data = HEADER; // (byte) TC_OBJECT // (byte) TC_CLASSDESC // (short length) // (byte * className.length) // (long)serialVersionUID // (byte) SC_SERIALIZABLE // (short)0 // TC_ENDBLOCKDATA // TC_NULL ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(byteOut); try { dout.writeByte(ObjectStreamConstants.TC_OBJECT); dout.writeByte(ObjectStreamConstants.TC_CLASSDESC); dout.writeUTF(clazz.getName()); dout.writeLong(ObjectStreamClass.lookup(clazz).getSerialVersionUID()); dout.writeByte(ObjectStreamConstants.SC_SERIALIZABLE); dout.writeShort((short) 0); // Zero fields dout.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); dout.writeByte(ObjectStreamConstants.TC_NULL); } catch(IOException e) { throw new Error("IOException: " + e.getMessage()); } this.FIRST_DATA = byteOut.toByteArray(); buffers = new byte[][] {HEADER, FIRST_DATA, REPEATING_DATA}; } private void advanceBuffer() { pointer = 0; sequence = NEXT[sequence]; data = buffers[sequence]; } @Override public int read() throws IOException { int result = data[pointer++]; if(pointer >= data.length) { advanceBuffer(); } return result; } @Override public int available() throws IOException { return Integer.MAX_VALUE; } @Override public int read(byte[] b, int off, int len) throws IOException { int left = len; int remaining = data.length - pointer; while(remaining <= left) { System.arraycopy(data, pointer, b, off, remaining); off += remaining; left -= remaining; advanceBuffer(); remaining = data.length - pointer; } if(left > 0) { System.arraycopy(data, pointer, b, off, left); pointer += left; } return len; } } private ObjectInputStream inputStream; public ObjectInputStreamInstantiator(Class clazz) { if(Serializable.class.isAssignableFrom(clazz)) { try { this.inputStream = new ObjectInputStream(new MockStream(clazz)); } catch(IOException e) { throw new Error("IOException: " + e.getMessage()); } } else { throw new ObjenesisException(new NotSerializableException(clazz + " not serializable")); } } @SuppressWarnings("unchecked") public T newInstance() { try { return (T) inputStream.readObject(); } catch(ClassNotFoundException e) { throw new Error("ClassNotFoundException: " + e.getMessage()); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java0000644000175000017500000000256413122236310030712 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by grabbing the no-args constructor, making it accessible and then calling * Constructor.newInstance(). Although this still requires no-arg constructors, it can call * non-public constructors (if the security manager allows it). * * @author Joe Walnes * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.NOT_COMPLIANT) public class AccessibleInstantiator extends ConstructorInstantiator { public AccessibleInstantiator(Class type) { super(type); if(constructor != null) { constructor.setAccessible(true); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java0000644000175000017500000000223213122236310027557 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * The instantiator that always return a null instance * * @author Henri Tremblay */ @Instantiator(Typology.NOT_COMPLIANT) public class NullInstantiator implements ObjectInstantiator { public NullInstantiator(Class type) { } /** * @return Always null */ public T newInstance() { return null; } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java0000644000175000017500000000242113122236310030216 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * The instantiator that always throws an exception. Mainly used for tests * * @author Henri Tremblay */ @Instantiator(Typology.NOT_COMPLIANT) public class FailingInstantiator implements ObjectInstantiator { public FailingInstantiator(Class type) { } /** * @return Always throwing an exception */ public T newInstance() { throw new ObjenesisException("Always failing"); } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java0000644000175000017500000000332413122236310031175 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.basic; import java.lang.reflect.Constructor; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by grabbing the no args constructor and calling Constructor.newInstance(). * This can deal with default public constructors, but that's about it. * * @author Joe Walnes * @param Type instantiated * @see ObjectInstantiator */ @Instantiator(Typology.NOT_COMPLIANT) public class ConstructorInstantiator implements ObjectInstantiator { protected Constructor constructor; public ConstructorInstantiator(Class type) { try { constructor = type.getDeclaredConstructor((Class[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } public T newInstance() { try { return constructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/0000755000175000017500000000000013122236310023127 5ustar apoapo././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.javaobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.jav0000644000175000017500000000432213122236310032342 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import java.lang.reflect.Constructor; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates an object, WITHOUT calling it's constructor, using internal * sun.reflect.ReflectionFactory - a class only available on JDK's that use Sun's 1.4 (or later) * Java implementation. This is the best way to instantiate an object without any side effects * caused by the constructor - however it is not available on every platform. * * @author Joe Walnes * @see ObjectInstantiator */ @Instantiator(Typology.STANDARD) public class SunReflectionFactoryInstantiator implements ObjectInstantiator { private final Constructor mungedConstructor; public SunReflectionFactoryInstantiator(Class type) { Constructor javaLangObjectConstructor = getJavaLangObjectConstructor(); mungedConstructor = SunReflectionFactoryHelper.newConstructorForSerialization( type, javaLangObjectConstructor); mungedConstructor.setAccessible(true); } public T newInstance() { try { return mungedConstructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } private static Constructor getJavaLangObjectConstructor() { try { return Object.class.getConstructor((Class[]) null); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java0000644000175000017500000002524513122236310027422 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; import org.objenesis.instantiator.util.ClassDefinitionUtils; import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; /** * This instantiator will correctly bypass the constructors by instantiating the class using the default * constructor from Object. It will be allowed to do so by extending {@code MagicAccessorImpl} which prevents * its children to be verified by the class loader * * @author Henri Tremblay */ @Instantiator(Typology.STANDARD) public class MagicInstantiator implements ObjectInstantiator { private static final String MAGIC_ACCESSOR = getMagicClass(); private static final int INDEX_CLASS_THIS = 1; private static final int INDEX_CLASS_SUPERCLASS = 2; private static final int INDEX_UTF8_CONSTRUCTOR_NAME = 3; private static final int INDEX_UTF8_CONSTRUCTOR_DESC = 4; private static final int INDEX_UTF8_CODE_ATTRIBUTE = 5; private static final int INDEX_UTF8_INSTANTIATOR_CLASS = 7; private static final int INDEX_UTF8_SUPERCLASS = 8; private static final int INDEX_CLASS_INTERFACE = 9; private static final int INDEX_UTF8_INTERFACE = 10; private static final int INDEX_UTF8_NEWINSTANCE_NAME = 11; private static final int INDEX_UTF8_NEWINSTANCE_DESC = 12; private static final int INDEX_METHODREF_OBJECT_CONSTRUCTOR = 13; private static final int INDEX_CLASS_OBJECT = 14; private static final int INDEX_UTF8_OBJECT = 15; private static final int INDEX_NAMEANDTYPE_DEFAULT_CONSTRUCTOR = 16; private static final int INDEX_CLASS_TYPE = 17; private static final int INDEX_UTF8_TYPE = 18; private static int CONSTANT_POOL_COUNT = 19; private static final byte[] CONSTRUCTOR_CODE = { OPS_aload_0, OPS_invokespecial, 0, INDEX_METHODREF_OBJECT_CONSTRUCTOR, OPS_return}; private static final int CONSTRUCTOR_CODE_ATTRIBUTE_LENGTH = 12 + CONSTRUCTOR_CODE.length; private static final byte[] NEWINSTANCE_CODE = { OPS_new, 0, INDEX_CLASS_TYPE, OPS_dup, OPS_invokespecial, 0, INDEX_METHODREF_OBJECT_CONSTRUCTOR, OPS_areturn}; private static final int NEWINSTANCE_CODE_ATTRIBUTE_LENGTH = 12 + NEWINSTANCE_CODE.length; private static final String CONSTRUCTOR_NAME = ""; private static final String CONSTRUCTOR_DESC = "()V"; private ObjectInstantiator instantiator; public MagicInstantiator(Class type) { instantiator = newInstantiatorOf(type); } /** * Get the underlying instantiator. * * {@link MagicInstantiator} is a wrapper around another object * which implements {@link ObjectInstantiator} interface. * This method exposes that instantiator. * * @return the underlying instantiator */ public ObjectInstantiator getInstantiator() { return instantiator; } private ObjectInstantiator newInstantiatorOf(Class type) { String suffix = type.getSimpleName(); String className = getClass().getName() + "$$$" + suffix; Class> clazz = getExistingClass(getClass().getClassLoader(), className); if(clazz == null) { byte[] classBytes = writeExtendingClass(type, className); try { clazz = ClassDefinitionUtils.defineClass(className, classBytes, getClass().getClassLoader()); } catch (Exception e) { throw new ObjenesisException(e); } } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new ObjenesisException(e); } catch (IllegalAccessException e) { throw new ObjenesisException(e); } } /** * Will generate the bytes for a class extending the type passed in parameter. This class will * only have an empty default constructor * * @param type type to extend * @param className name of the wrapped instantiator class * @return the byte for the class * @throws ObjenesisException is something goes wrong */ private byte[] writeExtendingClass(Class type, String className) { String clazz = classNameToInternalClassName(className); DataOutputStream in = null; ByteArrayOutputStream bIn = new ByteArrayOutputStream(1000); // 1000 should be large enough to fit the entire class try { in = new DataOutputStream(bIn); in.write(MAGIC); in.write(VERSION); in.writeShort(CONSTANT_POOL_COUNT); // set all the constant pool here // 1. class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_INSTANTIATOR_CLASS); // 2. super class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_SUPERCLASS); // 3. default constructor name in.writeByte(CONSTANT_Utf8); in.writeUTF(CONSTRUCTOR_NAME); // 4. default constructor description in.writeByte(CONSTANT_Utf8); in.writeUTF(CONSTRUCTOR_DESC); // 5. Code in.writeByte(CONSTANT_Utf8); in.writeUTF("Code"); // 6. Class name in.writeByte(CONSTANT_Utf8); in.writeUTF("L" + clazz + ";"); // 7. Class name (again) in.writeByte(CONSTANT_Utf8); in.writeUTF(clazz); // 8. Superclass name in.writeByte(CONSTANT_Utf8); // in.writeUTF("java/lang/Object"); in.writeUTF(MAGIC_ACCESSOR); // 9. ObjectInstantiator interface in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_INTERFACE); // 10. ObjectInstantiator name in.writeByte(CONSTANT_Utf8); in.writeUTF(ObjectInstantiator.class.getName().replace('.', '/')); // 11. newInstance name in.writeByte(CONSTANT_Utf8); in.writeUTF("newInstance"); // 12. newInstance desc in.writeByte(CONSTANT_Utf8); in.writeUTF("()Ljava/lang/Object;"); // 13. Methodref to the Object constructor in.writeByte(CONSTANT_Methodref); in.writeShort(INDEX_CLASS_OBJECT); in.writeShort(INDEX_NAMEANDTYPE_DEFAULT_CONSTRUCTOR); // 14. Object class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_OBJECT); // 15. Object class name in.writeByte(CONSTANT_Utf8); in.writeUTF("java/lang/Object"); // 16. Default constructor name and type in.writeByte(CONSTANT_NameAndType); in.writeShort(INDEX_UTF8_CONSTRUCTOR_NAME); in.writeShort(INDEX_UTF8_CONSTRUCTOR_DESC); // 17. Type to instantiate class in.writeByte(CONSTANT_Class); in.writeShort(INDEX_UTF8_TYPE); // 18. Type to instantiate name in.writeByte(CONSTANT_Utf8); in.writeUTF(classNameToInternalClassName(type.getName())); // end of constant pool // access flags: We want public, ACC_SUPER is always there in.writeShort(ACC_PUBLIC | ACC_SUPER | ACC_FINAL); // this class index in the constant pool in.writeShort(INDEX_CLASS_THIS); // super class index in the constant pool in.writeShort(INDEX_CLASS_SUPERCLASS); // interfaces implemented count (we have none) in.writeShort(1); in.writeShort(INDEX_CLASS_INTERFACE); // fields count (we have none) in.writeShort(0); // method count (we have two: the default constructor and newInstance) in.writeShort(2); // default constructor method_info in.writeShort(ACC_PUBLIC); in.writeShort(INDEX_UTF8_CONSTRUCTOR_NAME); // index of the method name () in.writeShort(INDEX_UTF8_CONSTRUCTOR_DESC); // index of the description in.writeShort(1); // number of attributes: only one, the code // code attribute of the default constructor in.writeShort(INDEX_UTF8_CODE_ATTRIBUTE); in.writeInt(CONSTRUCTOR_CODE_ATTRIBUTE_LENGTH); // attribute length in.writeShort(0); // max_stack in.writeShort(1); // max_locals in.writeInt(CONSTRUCTOR_CODE.length); // code length in.write(CONSTRUCTOR_CODE); in.writeShort(0); // exception_table_length = 0 in.writeShort(0); // attributes count = 0, no need to have LineNumberTable and LocalVariableTable // newInstance method_info in.writeShort(ACC_PUBLIC); in.writeShort(INDEX_UTF8_NEWINSTANCE_NAME); // index of the method name (newInstance) in.writeShort(INDEX_UTF8_NEWINSTANCE_DESC); // index of the description in.writeShort(1); // number of attributes: only one, the code // code attribute of newInstance in.writeShort(INDEX_UTF8_CODE_ATTRIBUTE); in.writeInt(NEWINSTANCE_CODE_ATTRIBUTE_LENGTH); // attribute length in.writeShort(2); // max_stack in.writeShort(1); // max_locals in.writeInt(NEWINSTANCE_CODE.length); // code length in.write(NEWINSTANCE_CODE); in.writeShort(0); // exception_table_length = 0 in.writeShort(0); // attributes count = 0, no need to have LineNumberTable and LocalVariableTable // class attributes in.writeShort(0); // none. No need to have a source file attribute } catch (IOException e) { throw new ObjenesisException(e); } finally { if(in != null) { try { in.close(); } catch (IOException e) { throw new ObjenesisException(e); } } } return bIn.toByteArray(); } public T newInstance() { return instantiator.newInstance(); } private static String getMagicClass() { try { Class.forName("sun.reflect.MagicAccessorImpl", false, MagicInstantiator.class.getClassLoader()); return "sun/reflect/MagicAccessorImpl"; } catch (ClassNotFoundException e) { return "jdk/internal/reflect/MagicAccessorImpl"; } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java0000644000175000017500000000344713122236310031153 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import sun.misc.Unsafe; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; import org.objenesis.instantiator.util.UnsafeUtils; import java.lang.reflect.Field; /** * Instantiates an object, WITHOUT calling it's constructor, using * {@code sun.misc.Unsafe.allocateInstance()}. Unsafe and its methods are implemented by most * modern JVMs. * * @author Henri Tremblay * @see ObjectInstantiator */ @SuppressWarnings("restriction") @Instantiator(Typology.STANDARD) public class UnsafeFactoryInstantiator implements ObjectInstantiator { private final Unsafe unsafe; private final Class type; public UnsafeFactoryInstantiator(Class type) { this.unsafe = UnsafeUtils.getUnsafe(); // retrieve it to fail right away at instantiator creation if not there this.type = type; } public T newInstance() { try { return type.cast(unsafe.allocateInstance(type)); } catch (InstantiationException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java0000644000175000017500000000620713122236310031247 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; /** * Helper methods providing access to {@link sun.reflect.ReflectionFactory} via reflection, for use * by the {@link ObjectInstantiator}s that use it. * * @author Henri Tremblay */ @SuppressWarnings("restriction") class SunReflectionFactoryHelper { @SuppressWarnings("unchecked") public static Constructor newConstructorForSerialization(Class type, Constructor constructor) { Class reflectionFactoryClass = getReflectionFactoryClass(); Object reflectionFactory = createReflectionFactory(reflectionFactoryClass); Method newConstructorForSerializationMethod = getNewConstructorForSerializationMethod( reflectionFactoryClass); try { return (Constructor) newConstructorForSerializationMethod.invoke( reflectionFactory, type, constructor); } catch(IllegalArgumentException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } private static Class getReflectionFactoryClass() { try { return Class.forName("sun.reflect.ReflectionFactory"); } catch(ClassNotFoundException e) { throw new ObjenesisException(e); } } private static Object createReflectionFactory(Class reflectionFactoryClass) { try { Method method = reflectionFactoryClass.getDeclaredMethod( "getReflectionFactory"); return method.invoke(null); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(IllegalArgumentException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } private static Method getNewConstructorForSerializationMethod(Class reflectionFactoryClass) { try { return reflectionFactoryClass.getDeclaredMethod( "newConstructorForSerialization", Class.class, Constructor.class); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.javaobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationIns0000644000175000017500000000520513122236310032374 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.sun; import java.io.NotSerializableException; import java.lang.reflect.Constructor; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.SerializationInstantiatorHelper; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates an object using internal sun.reflect.ReflectionFactory - a class only available on * JDK's that use Sun's 1.4 (or later) Java implementation. This instantiator will create classes in * a way compatible with serialization, calling the first non-serializable superclass' no-arg * constructor. This is the best way to instantiate an object without any side effects caused by the * constructor - however it is not available on every platform. * * @author Leonardo Mesquita * @see ObjectInstantiator */ @Instantiator(Typology.SERIALIZATION) public class SunReflectionFactorySerializationInstantiator implements ObjectInstantiator { private final Constructor mungedConstructor; public SunReflectionFactorySerializationInstantiator(Class type) { Class nonSerializableAncestor = SerializationInstantiatorHelper .getNonSerializableSuperClass(type); Constructor nonSerializableAncestorConstructor; try { nonSerializableAncestorConstructor = nonSerializableAncestor .getDeclaredConstructor((Class[]) null); } catch(NoSuchMethodException e) { throw new ObjenesisException(new NotSerializableException(type+" has no suitable superclass constructor")); } mungedConstructor = SunReflectionFactoryHelper.newConstructorForSerialization( type, nonSerializableAncestorConstructor); mungedConstructor.setAccessible(true); } public T newInstance() { try { return mungedConstructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/0000755000175000017500000000000013122236310023253 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java0000644000175000017500000000405213122236310027410 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.perc; import java.io.ObjectInputStream; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by making a call to internal Perc private methods. It is only supposed to * work on Perc JVMs. This instantiator will not call any constructors. The code was provided by * Aonix Perc support team. * * @author Henri Tremblay * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.STANDARD) public class PercInstantiator implements ObjectInstantiator { private final Method newInstanceMethod; private final Object[] typeArgs = new Object[] { null, Boolean.FALSE }; public PercInstantiator(Class type) { typeArgs[0] = type; try { newInstanceMethod = ObjectInputStream.class.getDeclaredMethod("newInstance", Class.class, Boolean.TYPE); newInstanceMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } @SuppressWarnings("unchecked") public T newInstance() { try { return (T) newInstanceMethod.invoke(null, typeArgs); } catch (Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java0000644000175000017500000000705113122236310032150 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.perc; import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by making a call to internal Perc private methods. It is only supposed to * work on Perc JVMs. This instantiator will create classes in a way compatible with serialization, * calling the first non-serializable superclass' no-arg constructor. *

* Based on code provided by Aonix but doesn't work right now * * @author Henri Tremblay * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.SERIALIZATION) public class PercSerializationInstantiator implements ObjectInstantiator { private Object[] typeArgs; private final Method newInstanceMethod; public PercSerializationInstantiator(Class type) { // Find the first unserializable parent class Class unserializableType = type; while(Serializable.class.isAssignableFrom(unserializableType)) { unserializableType = unserializableType.getSuperclass(); } try { // Get the special Perc method to call Class percMethodClass = Class.forName("COM.newmonics.PercClassLoader.Method"); newInstanceMethod = ObjectInputStream.class.getDeclaredMethod("noArgConstruct", new Class[] {Class.class, Object.class, percMethodClass}); newInstanceMethod.setAccessible(true); // Create invoke params Class percClassClass = Class.forName("COM.newmonics.PercClassLoader.PercClass"); Method getPercClassMethod = percClassClass.getDeclaredMethod("getPercClass", Class.class); Object someObject = getPercClassMethod.invoke(null, unserializableType); Method findMethodMethod = someObject.getClass().getDeclaredMethod("findMethod", new Class[] {String.class}); Object percMethod = findMethodMethod.invoke(someObject, "()V"); typeArgs = new Object[] {unserializableType, type, percMethod}; } catch(ClassNotFoundException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } } @SuppressWarnings("unchecked") public T newInstance() { try { return (T) newInstanceMethod.invoke(null, typeArgs); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/0000755000175000017500000000000013122236310023742 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java0000644000175000017500000000565013122236310030744 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.android; import java.io.ObjectStreamClass; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiator for Android API leve 18 and higher. Same as the version 17 but the * newInstance now takes a long in parameter * * @author Henri Tremblay */ @Instantiator(Typology.STANDARD) public class Android18Instantiator implements ObjectInstantiator { private final Class type; private final Method newInstanceMethod; private final Long objectConstructorId; public Android18Instantiator(Class type) { this.type = type; newInstanceMethod = getNewInstanceMethod(); objectConstructorId = findConstructorIdForJavaLangObjectConstructor(); } public T newInstance() { try { return type.cast(newInstanceMethod.invoke(null, type, objectConstructorId)); } catch(Exception e) { throw new ObjenesisException(e); } } private static Method getNewInstanceMethod() { try { Method newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod("newInstance", Class.class, Long.TYPE); newInstanceMethod.setAccessible(true); return newInstanceMethod; } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } private static Long findConstructorIdForJavaLangObjectConstructor() { try { Method newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod("getConstructorId", Class.class); newInstanceMethod.setAccessible(true); return (Long) newInstanceMethod.invoke(null, Object.class); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.javaobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator0000644000175000017500000000566513122236310032417 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.android; import java.io.ObjectStreamClass; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * {@link ObjectInstantiator} for Android which creates objects using the constructor from the first * non-serializable parent class constructor, using internal methods on the Dalvik implementation of * {@link ObjectStreamClass}. * * @author Ian Parkinson (Google Inc.) */ @Instantiator(Typology.SERIALIZATION) public class AndroidSerializationInstantiator implements ObjectInstantiator { private final Class type; private final ObjectStreamClass objectStreamClass; private final Method newInstanceMethod; public AndroidSerializationInstantiator(Class type) { this.type = type; newInstanceMethod = getNewInstanceMethod(); Method m = null; try { m = ObjectStreamClass.class.getMethod("lookupAny", Class.class); } catch (NoSuchMethodException e) { throw new ObjenesisException(e); } try { objectStreamClass = (ObjectStreamClass) m.invoke(null, type); } catch (IllegalAccessException e) { throw new ObjenesisException(e); } catch (InvocationTargetException e) { throw new ObjenesisException(e); } } public T newInstance() { try { return type.cast(newInstanceMethod.invoke(objectStreamClass, type)); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(IllegalArgumentException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } private static Method getNewInstanceMethod() { try { Method newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod( "newInstance", Class.class); newInstanceMethod.setAccessible(true); return newInstanceMethod; } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java0000644000175000017500000000417213122236310030732 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.android; import java.io.ObjectInputStream; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiator for Android API level 10 and lover which creates objects without driving their * constructors, using internal methods on the Dalvik implementation of * {@link java.io.ObjectInputStream}. * * @author Piotr 'Qertoip' Włodarek */ @Instantiator(Typology.STANDARD) public class Android10Instantiator implements ObjectInstantiator { private final Class type; private final Method newStaticMethod; public Android10Instantiator(Class type) { this.type = type; newStaticMethod = getNewStaticMethod(); } public T newInstance() { try { return type.cast(newStaticMethod.invoke(null, type, Object.class)); } catch(Exception e) { throw new ObjenesisException(e); } } private static Method getNewStaticMethod() { try { Method newStaticMethod = ObjectInputStream.class.getDeclaredMethod( "newInstance", Class.class, Class.class); newStaticMethod.setAccessible(true); return newStaticMethod; } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java0000644000175000017500000000576413122236310030751 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.android; import java.io.ObjectStreamClass; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiator for Android API level 11 to 17 which creates objects without driving their * constructors, using internal methods on the Dalvik implementation of {@link ObjectStreamClass}. * * @author Ian Parkinson (Google Inc.) */ @Instantiator(Typology.STANDARD) public class Android17Instantiator implements ObjectInstantiator { private final Class type; private final Method newInstanceMethod; private final Integer objectConstructorId; public Android17Instantiator(Class type) { this.type = type; newInstanceMethod = getNewInstanceMethod(); objectConstructorId = findConstructorIdForJavaLangObjectConstructor(); } public T newInstance() { try { return type.cast(newInstanceMethod.invoke(null, type, objectConstructorId)); } catch(Exception e) { throw new ObjenesisException(e); } } private static Method getNewInstanceMethod() { try { Method newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod( "newInstance", Class.class, Integer.TYPE); newInstanceMethod.setAccessible(true); return newInstanceMethod; } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } private static Integer findConstructorIdForJavaLangObjectConstructor() { try { Method newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod( "getConstructorId", Class.class); newInstanceMethod.setAccessible(true); return (Integer) newInstanceMethod.invoke(null, Object.class); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java0000644000175000017500000000347713122236310031555 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator; import java.io.Serializable; /** * Helper for common serialization-compatible instantiation functions * * @author Leonardo Mesquita */ public class SerializationInstantiatorHelper { /** * Returns the first non-serializable superclass of a given class. According to Java Object * Serialization Specification, objects read from a stream are initialized by calling an * accessible no-arg constructor from the first non-serializable superclass in the object's * hierarchy, allowing the state of non-serializable fields to be correctly initialized. * * @param Type to instantiate * @param type Serializable class for which the first non-serializable superclass is to be found * @return The first non-serializable superclass of 'type'. * @see java.io.Serializable */ public static Class getNonSerializableSuperClass(Class type) { Class result = type; while(Serializable.class.isAssignableFrom(result)) { result = result.getSuperclass(); if(result == null) { throw new Error("Bad class hierarchy: No non-serializable parents"); } } return result; } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/0000755000175000017500000000000013122236310023065 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java0000644000175000017500000000327013122236310026735 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.gcj; import java.lang.reflect.InvocationTargetException; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by making a call to internal GCJ private methods. It is only supposed to * work on GCJ JVMs. This instantiator will not call any constructors. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.STANDARD) public class GCJInstantiator extends GCJInstantiatorBase { public GCJInstantiator(Class type) { super(type); } @Override public T newInstance() { try { return type.cast(newObjectMethod.invoke(dummyStream, type, Object.class)); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java0000644000175000017500000000423013122236310027525 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.gcj; import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; /** * Base class for GCJ-based instantiators. It initializes reflection access to method * ObjectInputStream.newObject, as well as creating a dummy ObjectInputStream to be used as the * "this" argument for the method. * * @author Leonardo Mesquita */ public abstract class GCJInstantiatorBase implements ObjectInstantiator { static Method newObjectMethod = null; static ObjectInputStream dummyStream; private static class DummyStream extends ObjectInputStream { public DummyStream() throws IOException { } } private static void initialize() { if(newObjectMethod == null) { try { newObjectMethod = ObjectInputStream.class.getDeclaredMethod("newObject", new Class[] { Class.class, Class.class}); newObjectMethod.setAccessible(true); dummyStream = new DummyStream(); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } catch(IOException e) { throw new ObjenesisException(e); } } } protected final Class type; public GCJInstantiatorBase(Class type) { this.type = type; initialize(); } public abstract T newInstance(); } objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java0000644000175000017500000000341213122236310031471 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.instantiator.gcj; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.SerializationInstantiatorHelper; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * Instantiates a class by making a call to internal GCJ private methods. It is only supposed to * work on GCJ JVMs. This instantiator will create classes in a way compatible with serialization, * calling the first non-serializable superclass' no-arg constructor. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator */ @Instantiator(Typology.SERIALIZATION) public class GCJSerializationInstantiator extends GCJInstantiatorBase { private Class superType; public GCJSerializationInstantiator(Class type) { super(type); this.superType = SerializationInstantiatorHelper.getNonSerializableSuperClass(type); } @Override public T newInstance() { try { return type.cast(newObjectMethod.invoke(dummyStream, type, superType)); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisSerializer.java0000644000175000017500000000273313122236310024426 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import org.objenesis.strategy.SerializingInstantiatorStrategy; /** * Objenesis implementation using the {@link SerializingInstantiatorStrategy}. * * @author Henri Tremblay */ public class ObjenesisSerializer extends ObjenesisBase { /** * Default constructor using the {@link org.objenesis.strategy.SerializingInstantiatorStrategy} */ public ObjenesisSerializer() { super(new SerializingInstantiatorStrategy()); } /** * Instance using the {@link org.objenesis.strategy.SerializingInstantiatorStrategy} with or without caching * {@link org.objenesis.instantiator.ObjectInstantiator}s * * @param useCache If {@link org.objenesis.instantiator.ObjectInstantiator}s should be cached */ public ObjenesisSerializer(boolean useCache) { super(new SerializingInstantiatorStrategy(), useCache); } } objenesis-2.6/main/src/main/java/org/objenesis/strategy/0000755000175000017500000000000013122236310021445 5ustar apoapoobjenesis-2.6/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java0000644000175000017500000000462113122236310027657 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; /** * Strategy returning only one instantiator type. Useful if you know on which JVM Objenesis * will be used and want to specify it explicitly. * * @author Henri Tremblay */ public class SingleInstantiatorStrategy implements InstantiatorStrategy { private Constructor constructor; /** * Create a strategy that will return always the same instantiator type. We assume this instantiator * has one constructor taking the class to instantiate in parameter. * * @param the type we want to instantiate * @param instantiator the instantiator type */ public > SingleInstantiatorStrategy(Class instantiator) { try { constructor = instantiator.getConstructor(Class.class); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } /** * Return an instantiator for the wanted type and of the one and only type of instantiator returned by this * class. * * @param the type we want to instantiate * @param type Class to instantiate * @return The ObjectInstantiator for the class */ @SuppressWarnings("unchecked") public ObjectInstantiator newInstantiatorOf(Class type) { try { return (ObjectInstantiator) constructor.newInstance(type); } catch (InstantiationException e) { throw new ObjenesisException(e); } catch (IllegalAccessException e) { throw new ObjenesisException(e); } catch (InvocationTargetException e) { throw new ObjenesisException(e); } } } objenesis-2.6/main/src/main/java/org/objenesis/strategy/PlatformDescription.java0000644000175000017500000001370413122236310026305 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import org.objenesis.ObjenesisException; import java.lang.reflect.Field; /** * List of constants describing the currently used platform. * * @author Henri Tremblay */ public final class PlatformDescription { /** JVM_NAME prefix for JRockit */ public static final String JROCKIT = "BEA"; /** JVM_NAME prefix for GCJ */ public static final String GNU = "GNU libgcj"; /** JVM_NAME prefix for Java HotSpot */ public static final String HOTSPOT = "Java HotSpot"; /** * JVM_NAME prefix for Java HotSpot * * @deprecated Use {@link #HOTSPOT} instead */ @Deprecated public static final String SUN = HOTSPOT; /** JVM_NAME prefix for the OpenJDK */ public static final String OPENJDK = "OpenJDK"; /** JVM_NAME prefix for Aonix PERC */ public static final String PERC = "PERC"; /** JVM_NAME prefix for Dalvik/Android */ public static final String DALVIK = "Dalvik"; /** Java specification version */ public static final String SPECIFICATION_VERSION = System .getProperty("java.specification.version"); /** JVM version */ public static final String VM_VERSION = System.getProperty("java.runtime.version"); /** JVM version */ public static final String VM_INFO = System.getProperty("java.vm.info"); /** VM vendor version */ public static final String VENDOR_VERSION = System.getProperty("java.vm.version"); /** VM vendor name */ public static final String VENDOR = System.getProperty("java.vm.vendor"); /** JVM name */ public static final String JVM_NAME = System.getProperty("java.vm.name"); /** Android version. Will be 0 for none android platform */ public static final int ANDROID_VERSION = getAndroidVersion(); /** Flag telling if this version of Android is based on the OpenJDK */ public static final boolean IS_ANDROID_OPENJDK = getIsAndroidOpenJDK(); /** Google App Engine version or null is we are not on GAE */ public static final String GAE_VERSION = getGaeRuntimeVersion(); /** * Describes the platform. Outputs Java version and vendor. * * @return Description of the current platform */ public static String describePlatform() { String desc = "Java " + SPECIFICATION_VERSION + " (" + "VM vendor name=\"" + VENDOR + "\", " + "VM vendor version=" + VENDOR_VERSION + ", " + "JVM name=\"" + JVM_NAME + "\", " + "JVM version=" + VM_VERSION + ", " + "JVM info=" + VM_INFO; // Add the API level is it's an Android platform int androidVersion = ANDROID_VERSION; if(androidVersion != 0) { desc += ", API level=" + ANDROID_VERSION; } desc += ")"; return desc; } /** * Check if the current JVM is of the type passed in parameter. Normally, this will be a constant * from this class. We basically do * System.getProperty("java.vm.name").startWith(name). * * @param name jvm name we are looking for * @return if it's the requested JVM */ public static boolean isThisJVM(String name) { return JVM_NAME.startsWith(name); } /** * Check if this JVM is an Android JVM based on OpenJDK. * * @return if it's an Android version based on the OpenJDK. Will return false if this JVM isn't an Android JVM at all */ public static boolean isAndroidOpenJDK() { return IS_ANDROID_OPENJDK; } private static boolean getIsAndroidOpenJDK() { if(getAndroidVersion() == 0) { return false; // Not android at all } // Sadly, Android N is still API 23. So we can't base ourselves on the API level to know if it is an OpenJDK // version or not String bootClasspath = System.getProperty("java.boot.class.path"); return bootClasspath != null && bootClasspath.toLowerCase().contains("core-oj.jar"); } public static boolean isGoogleAppEngine() { return GAE_VERSION != null; } private static String getGaeRuntimeVersion() { return System.getProperty("com.google.appengine.runtime.version"); } private static int getAndroidVersion() { if(!isThisJVM(DALVIK)) { return 0; } return getAndroidVersion0(); } private static int getAndroidVersion0() { Class clazz; try { clazz = Class.forName("android.os.Build$VERSION"); } catch(ClassNotFoundException e) { throw new ObjenesisException(e); } Field field; try { field = clazz.getField("SDK_INT"); } catch(NoSuchFieldException e) { // Might be a really old API (before 4), go for SDK return getOldAndroidVersion(clazz); } int version; try { version = (Integer) field.get(null); } catch(IllegalAccessException e) { throw new RuntimeException(e); } return version; } private static int getOldAndroidVersion(Class versionClass) { Field field; try { field = versionClass.getField("SDK"); } catch(NoSuchFieldException e) { throw new ObjenesisException(e); } String version; try { version = (String) field.get(null); } catch(IllegalAccessException e) { throw new RuntimeException(e); } return Integer.parseInt(version); } private PlatformDescription() { } } objenesis-2.6/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java0000644000175000017500000000214513122236310026514 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import org.objenesis.instantiator.ObjectInstantiator; /** * Defines a strategy to determine the best instantiator for a class. * * @author Henri Tremblay */ public interface InstantiatorStrategy { /** * Create a dedicated instantiator for the given class * * @param Type to instantiate * @param type Class that will be instantiated * @return Dedicated instantiator */ ObjectInstantiator newInstantiatorOf(Class type); } objenesis-2.6/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java0000644000175000017500000000774313122236310027200 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.android.Android10Instantiator; import org.objenesis.instantiator.android.Android17Instantiator; import org.objenesis.instantiator.android.Android18Instantiator; import org.objenesis.instantiator.basic.AccessibleInstantiator; import org.objenesis.instantiator.basic.ObjectInputStreamInstantiator; import org.objenesis.instantiator.gcj.GCJInstantiator; import org.objenesis.instantiator.perc.PercInstantiator; import org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator; import org.objenesis.instantiator.sun.UnsafeFactoryInstantiator; import java.io.Serializable; import static org.objenesis.strategy.PlatformDescription.*; /** * Guess the best instantiator for a given class. The instantiator will instantiate the class * without calling any constructor. Currently, the selection doesn't depend on the class. It relies * on the *

    *
  • JVM version
  • *
  • JVM vendor
  • *
  • JVM vendor version
  • *
* However, instantiators are stateful and so dedicated to their class. * * @author Henri Tremblay * @see ObjectInstantiator */ public class StdInstantiatorStrategy extends BaseInstantiatorStrategy { /** * Return an {@link ObjectInstantiator} allowing to create instance without any constructor being * called. * * @param type Class to instantiate * @return The ObjectInstantiator for the class */ public ObjectInstantiator newInstantiatorOf(Class type) { if(PlatformDescription.isThisJVM(HOTSPOT) || PlatformDescription.isThisJVM(OPENJDK)) { // Java 7 GAE was under a security manager so we use a degraded system if(PlatformDescription.isGoogleAppEngine() && PlatformDescription.SPECIFICATION_VERSION.equals("1.7")) { if(Serializable.class.isAssignableFrom(type)) { return new ObjectInputStreamInstantiator(type); } return new AccessibleInstantiator(type); } // The UnsafeFactoryInstantiator would also work. But according to benchmarks, it is 2.5 // times slower. So I prefer to use this one return new SunReflectionFactoryInstantiator(type); } else if(PlatformDescription.isThisJVM(DALVIK)) { if(PlatformDescription.isAndroidOpenJDK()) { // Starting at Android N which is based on OpenJDK return new UnsafeFactoryInstantiator(type); } if(ANDROID_VERSION <= 10) { // Android 2.3 Gingerbread and lower return new Android10Instantiator(type); } if(ANDROID_VERSION <= 17) { // Android 3.0 Honeycomb to 4.2 Jelly Bean return new Android17Instantiator(type); } // Android 4.3 until Android N return new Android18Instantiator(type); } else if(PlatformDescription.isThisJVM(JROCKIT)) { // JRockit is compliant with HotSpot return new SunReflectionFactoryInstantiator(type); } else if(PlatformDescription.isThisJVM(GNU)) { return new GCJInstantiator(type); } else if(PlatformDescription.isThisJVM(PERC)) { return new PercInstantiator(type); } // Fallback instantiator, should work with most modern JVM return new UnsafeFactoryInstantiator(type); } } objenesis-2.6/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java0000644000175000017500000000155313122236310027311 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; /** * Base {@link InstantiatorStrategy} class basically. Only implements {@link InstantiatorStrategy} * * @author Henri Tremblay */ public abstract class BaseInstantiatorStrategy implements InstantiatorStrategy { } objenesis-2.6/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java0000644000175000017500000000646413122236310030725 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.strategy; import java.io.NotSerializableException; import java.io.Serializable; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.android.AndroidSerializationInstantiator; import org.objenesis.instantiator.basic.ObjectInputStreamInstantiator; import org.objenesis.instantiator.basic.ObjectStreamClassInstantiator; import org.objenesis.instantiator.gcj.GCJSerializationInstantiator; import org.objenesis.instantiator.perc.PercSerializationInstantiator; import org.objenesis.instantiator.sun.SunReflectionFactorySerializationInstantiator; import static org.objenesis.strategy.PlatformDescription.*; /** * Guess the best serializing instantiator for a given class. The returned instantiator will * instantiate classes like the genuine java serialization framework (the constructor of the first * not serializable class will be called). Currently, the selection doesn't depend on the class. It * relies on the *
    *
  • JVM version
  • *
  • JVM vendor
  • *
  • JVM vendor version
  • *
* However, instantiators are stateful and so dedicated to their class. * * @author Henri Tremblay * @see ObjectInstantiator */ public class SerializingInstantiatorStrategy extends BaseInstantiatorStrategy { /** * Return an {@link ObjectInstantiator} allowing to create instance following the java * serialization framework specifications. * * @param type Class to instantiate * @return The ObjectInstantiator for the class */ public ObjectInstantiator newInstantiatorOf(Class type) { if(!Serializable.class.isAssignableFrom(type)) { throw new ObjenesisException(new NotSerializableException(type+" not serializable")); } if(JVM_NAME.startsWith(HOTSPOT) || PlatformDescription.isThisJVM(OPENJDK)) { // Java 7 GAE was under a security manager so we use a degraded system if(isGoogleAppEngine() && PlatformDescription.SPECIFICATION_VERSION.equals("1.7")) { return new ObjectInputStreamInstantiator(type); } return new SunReflectionFactorySerializationInstantiator(type); } else if(JVM_NAME.startsWith(DALVIK)) { if(PlatformDescription.isAndroidOpenJDK()) { return new ObjectStreamClassInstantiator(type); } return new AndroidSerializationInstantiator(type); } else if(JVM_NAME.startsWith(GNU)) { return new GCJSerializationInstantiator(type); } else if(JVM_NAME.startsWith(PERC)) { return new PercSerializationInstantiator(type); } return new SunReflectionFactorySerializationInstantiator(type); } } objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisException.java0000644000175000017500000000260713122236310024253 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; /** * Exception thrown by Objenesis. It wraps any instantiation exceptions. Note that this exception is * runtime to prevent having to catch it. * * @author Henri Tremblay */ public class ObjenesisException extends RuntimeException { private static final long serialVersionUID = -2677230016262426968L; /** * @param msg Error message */ public ObjenesisException(String msg) { super(msg); } /** * @param cause Wrapped exception. The message will be the one of the cause. */ public ObjenesisException(Throwable cause) { super(cause); } /** * @param msg Error message * @param cause Wrapped exception */ public ObjenesisException(String msg, Throwable cause) { super(msg, cause); } } objenesis-2.6/main/src/main/java/org/objenesis/Objenesis.java0000644000175000017500000000276313122236310022377 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import org.objenesis.instantiator.ObjectInstantiator; /** * Common interface to all kind of Objenesis objects * * @author Henri Tremblay */ public interface Objenesis { /** * Will create a new object without any constructor being called * * @param Type instantiated * @param clazz Class to instantiate * @return New instance of clazz */ T newInstance(Class clazz); /** * Will pick the best instantiator for the provided class. If you need to create a lot of * instances from the same class, it is way more efficient to create them from the same * ObjectInstantiator than calling {@link #newInstance(Class)}. * * @param Type to instantiate * @param clazz Class to instantiate * @return Instantiator dedicated to the class */ ObjectInstantiator getInstantiatorOf(Class clazz); } objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisHelper.java0000644000175000017500000000551613122236310023536 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import java.io.Serializable; import org.objenesis.instantiator.ObjectInstantiator; /** * Use Objenesis in a static way. It is strongly not recommended to use this class. * * @author Henri Tremblay */ public final class ObjenesisHelper { private static final Objenesis OBJENESIS_STD = new ObjenesisStd(); private static final Objenesis OBJENESIS_SERIALIZER = new ObjenesisSerializer(); private ObjenesisHelper() { } /** * Will create a new object without any constructor being called * * @param Type instantiated * @param clazz Class to instantiate * @return New instance of clazz */ public static T newInstance(Class clazz) { return OBJENESIS_STD.newInstance(clazz); } /** * Will create an object just like it's done by ObjectInputStream.readObject (the default * constructor of the first non serializable class will be called) * * @param Type instantiated * @param clazz Class to instantiate * @return New instance of clazz */ public static T newSerializableInstance(Class clazz) { return (T) OBJENESIS_SERIALIZER.newInstance(clazz); } /** * Will pick the best instantiator for the provided class. If you need to create a lot of * instances from the same class, it is way more efficient to create them from the same * ObjectInstantiator than calling {@link #newInstance(Class)}. * * @param Type to instantiate * @param clazz Class to instantiate * @return Instantiator dedicated to the class */ public static ObjectInstantiator getInstantiatorOf(Class clazz) { return OBJENESIS_STD.getInstantiatorOf(clazz); } /** * Same as {@link #getInstantiatorOf(Class)} but providing an instantiator emulating * ObjectInputStream.readObject behavior. * * @see #newSerializableInstance(Class) * @param Type to instantiate * @param clazz Class to instantiate * @return Instantiator dedicated to the class */ public static ObjectInstantiator getSerializableObjectInstantiatorOf(Class clazz) { return OBJENESIS_SERIALIZER.getInstantiatorOf(clazz); } } objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisBase.java0000644000175000017500000000700413122236310023163 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.InstantiatorStrategy; import java.util.concurrent.ConcurrentHashMap; /** * Base class to extend if you want to have a class providing your own default strategy. Can also be * instantiated directly. * * @author Henri Tremblay */ public class ObjenesisBase implements Objenesis { /** Strategy used by this Objenesi implementation to create classes */ protected final InstantiatorStrategy strategy; /** Strategy cache. Key = Class, Value = InstantiatorStrategy */ protected ConcurrentHashMap> cache; /** * Constructor allowing to pick a strategy and using cache * * @param strategy Strategy to use */ public ObjenesisBase(InstantiatorStrategy strategy) { this(strategy, true); } /** * Flexible constructor allowing to pick the strategy and if caching should be used * * @param strategy Strategy to use * @param useCache If {@link ObjectInstantiator}s should be cached */ public ObjenesisBase(InstantiatorStrategy strategy, boolean useCache) { if(strategy == null) { throw new IllegalArgumentException("A strategy can't be null"); } this.strategy = strategy; this.cache = useCache ? new ConcurrentHashMap>() : null; } @Override public String toString() { return getClass().getName() + " using " + strategy.getClass().getName() + (cache == null ? " without" : " with") + " caching"; } /** * Will create a new object without any constructor being called * * @param clazz Class to instantiate * @return New instance of clazz */ public T newInstance(Class clazz) { return getInstantiatorOf(clazz).newInstance(); } /** * Will pick the best instantiator for the provided class. If you need to create a lot of * instances from the same class, it is way more efficient to create them from the same * ObjectInstantiator than calling {@link #newInstance(Class)}. * * @param clazz Class to instantiate * @return Instantiator dedicated to the class */ @SuppressWarnings("unchecked") public ObjectInstantiator getInstantiatorOf(Class clazz) { if(clazz.isPrimitive()) { throw new IllegalArgumentException("Primitive types can't be instantiated in Java"); } if(cache == null) { return strategy.newInstantiatorOf(clazz); } ObjectInstantiator instantiator = cache.get(clazz.getName()); if(instantiator == null) { ObjectInstantiator newInstantiator = strategy.newInstantiatorOf(clazz); instantiator = cache.putIfAbsent(clazz.getName(), newInstantiator); if(instantiator == null) { instantiator = newInstantiator; } } return (ObjectInstantiator) instantiator; } } objenesis-2.6/main/assembly.xml0000644000175000017500000000224113122236310014737 0ustar apoapo bin zip ${project.build.outputDirectory}/META-INF / NOTICE LICENSE ${project.build.directory} / *.jar objenesis-2.6/main/pom.xml0000644000175000017500000000533713122236310013724 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 objenesis Objenesis A library for instantiating Java objects http://objenesis.org maven-jar-plugin ${project.build.outputDirectory}/META-INF/MANIFEST.MF com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin maven-remote-resources-plugin org.apache.felix maven-bundle-plugin true COM.newmonics.PercClassloader;resolution:=optional, sun.misc;resolution:=optional, sun.reflect;resolution:=optional bundle-manifest process-classes manifest release maven-assembly-plugin false assembly.xml make-assembly package single objenesis-2.6/tck-android/0000755000175000017500000000000013122236310013652 5ustar apoapoobjenesis-2.6/tck-android/lint.xml0000644000175000017500000000006513122236310015343 0ustar apoapo objenesis-2.6/tck-android/.settings/0000755000175000017500000000000013122236310015570 5ustar apoapoobjenesis-2.6/tck-android/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005722313122236310022563 0ustar apoapoeclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=100 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=1 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=3 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=3 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true objenesis-2.6/tck-android/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000524313122236310022243 0ustar apoapoeclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Objenesis formatter_settings_version=12 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=false sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true objenesis-2.6/tck-android/src/0000755000175000017500000000000013122236310014441 5ustar apoapoobjenesis-2.6/tck-android/src/main/0000755000175000017500000000000013122236310015365 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/0000755000175000017500000000000013122236310016306 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/org/0000755000175000017500000000000013122236310017075 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/org/objenesis/0000755000175000017500000000000013122236310021056 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/org/objenesis/tck/0000755000175000017500000000000013122236310021637 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/org/objenesis/tck/android/0000755000175000017500000000000013122236310023257 5ustar apoapoobjenesis-2.6/tck-android/src/main/java/org/objenesis/tck/android/TckInstrumentation.java0000644000175000017500000000346513122236310027777 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.android; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import org.objenesis.tck.Main; import org.objenesis.tck.TextReporter; import android.app.Activity; import android.app.Instrumentation; import android.os.Bundle; /** * Wraps the Objenesis TCK so that it can be invoked on Android as an {@link Instrumentation}. * * @author Ian Parkinson (Google Inc.) */ public class TckInstrumentation extends Instrumentation { @Override public void onCreate(Bundle arguments) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(outputStream); System.setOut(printStream); System.setErr(printStream); try { launch(); } catch (IOException e) { e.printStackTrace(); } Bundle bundle = new Bundle(); String fromStdout = outputStream.toString(); bundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, fromStdout); finish(Activity.RESULT_OK, bundle); } private void launch() throws IOException { TextReporter reporter = new TextReporter(System.out, System.err); Main.run(reporter); } } objenesis-2.6/tck-android/src/main/java/org/objenesis/tck/android/ObjenesisTest.java0000644000175000017500000000463413122236310026712 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.android; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.objenesis.Objenesis; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; import org.objenesis.tck.Candidate; import org.objenesis.tck.Reporter; import org.objenesis.tck.TCK; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** * Test case running the entire tck on android. * * @author Henri Tremblay */ public class ObjenesisTest extends AndroidTestCase { public static class JUnitReporter implements Reporter { private Candidate currentCandidate; @Override public void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer) { } @Override public void startTest(Candidate candidate) { currentCandidate = candidate; } @Override public void exception(Candidate.CandidateType type, Exception exception) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); try { out.println("Exception when instantiating " + currentCandidate + " for " + type + ": "); exception.printStackTrace(out); fail(buffer.toString()); } finally { out.close(); } } @Override public void result(Candidate.CandidateType type, boolean worked) { assertTrue("Instantiating " + currentCandidate + " for " + type + " failed", worked); } @Override public void endTests() { } } @SmallTest public void testObjenesis() throws Exception { TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), new JUnitReporter()); tck.runTests(); } } objenesis-2.6/tck-android/src/main/AndroidManifest.xml0000644000175000017500000000301113122236310021151 0ustar apoapo objenesis-2.6/tck-android/pom.xml0000644000175000017500000001056413122236310015175 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 objenesis-tck-android Objenesis Android TCK Objenesis' TCK built for Android devices apk ${env.ANDROID_HOME} org.objenesis objenesis ${project.version} provided ${project.groupId} objenesis-tck ${project.version} com.google.android android 4.1.1.4 provided com.google.android android-test 4.1.1.4 provided junit junit org.hamcrest hamcrest-core com.simpligility.maven.plugins android-maven-plugin 4.4.3 true false org.objenesis.tck.android android.test.InstrumentationTestRunner com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin maven-remote-resources-plugin com.simpligility.maven.plugins android-maven-plugin 25 true org.codehaus.mojo exec-maven-plugin false execute integration-test exec ${android.home}/platform-tools/adb shell am instrument -w org.objenesis.tck.android/.TckInstrumentation intellij-specific ${project.groupId} objenesis ${project.version} objenesis-2.6/tck-android/.gitignore0000644000175000017500000000017513122236310015645 0ustar apoapobin/ gen/ target/ .classpath .project org.eclipse.m2e.core.prefs org.eclipse.core.resources.prefs org.eclipse.pde.core.prefs objenesis-2.6/tck-android/project.properties0000644000175000017500000000004313122236310017433 0ustar apoapo# Project target. target=android-8 objenesis-2.6/objenesis-formatting.xml0000644000175000017500000007430613122236310016340 0ustar apoapo objenesis-2.6/Benchmarks.md0000644000175000017500000000506013122236310014053 0ustar apoapoHere are multiple benchmarks that are meant to verify Objenesis performance. The source code is available [here](https://github.com/easymock/objenesis/tree/master/benchmark) if you want to challenge it. # Sun implementations (CreateObject) This benchmark compares two implementations working on HotSpot. They are instantiating the class Object. We have also added an instantiation with the default constructor. The munged constructor version is a special constructor HotSpot is using to perform serialization. The unsafe version is using `Unsafe.allocateInstance`. A bit easier to implement in Objenesis but much slower than the munged version. So we kept the later one as the default for HotSpot. Benchmark |Mean |Mean error|Units ---------------------------|---------|----------|------- createObjectWithConstructor|3.509.724|0.017 |nsec/op createObjectWithSun |6.995 |0.087 |nsec/op createObjectWithUnsafe |20.382 |0.379 |nsec/op # Instantiator creation (ConcurrentGetInstantiator) When the client code ask for the instantiator of a given class, Objenesis creates one and can cache it or not. If it is cached, the next time the instantiator is requested for the same class, the cached instantiator will be returned instead of a new one. Instantiators are thread-safe so there's no need to worry. During migration to Java 5, the cache implementation using a synchronize was replaced by a concurrent collection. This benchmark shows the difference in performance between the two cache implementations and of Objenesis without cache. Type |Mean |Units -----------------|-----------|------- Cached (Java 1.3)|2535.952 |nsec/op Cached (Java 5) |238.946 |nsec/op No cache (Java 5)|5253937.944|nsec/op Then, the standard strategy used by Objenesis deduces the best instantiator for your platform. Another possibility is to decide that you known the platform you are on and you prefer to use the single instantiator that will create always the same type of instantiator using reflection. Finally, if you want to avoid using reflection, you can use a custom strategy returning always one instantiator using "new". As you will see, it doesn't really matter which one you use, the performance is similar. Type |Mean |Units --------|-----------|------- Custom |5270008.460|nsec/op Single |5205981.442|nsec/op Standard|5269205.477|nsec/op Both benchmarks are performed in a highly concurrent environment to reflect what is expected to be normal usage. They were executed on Windows 8 using Java 1.7.0_25 64 bits version.objenesis-2.6/SupportedJVMs.md0000644000175000017500000000613413122236310014526 0ustar apoapo# List of currently supported JVMs * Sun Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9 * OpenJDK 6, 7, 8, 9 * Android API level 8 to 26 (Serialization support starting from Honeycomb) * Azul Zulu (tested on 1.8.0_45-b14) * Azul Zing JDK 1.8 (tested on 1.8.0-zing_16.10.1.0-b2) * IKVM (tested on 8.1.5717) * BEA JRockit R27, R28 * GCJ version 3.4.4 (tested on Windows/Cygwin) * Aonix PERC (no serialization support), tested on version 5.0.0667 ## Google App Engine GAE is only really partially supported due to the constraints of the platform. Only serializable objects can be instantiated. So the Serializing instantiator will behave almost correctly. There is only one loophole: `readResolve` will be called if implemented by the created class. This isn't the case on the other platforms. The Standard instantiator will * call the constructor from the first non-serializable parent if the class is serializable * the default constructor if the class is not This is far from ideal but will kinda work in some cases. Calling a constructor defeats a bit the purpose of Objenesis to say the least... If someone has a better solution, we are listening. This is the result of the TCK. Remember that 'Y' means the class was instantiated without exception. It doesn't mean that no constructor was called. |Class type |Objenesis serializer|Objenesis std| |---------------------------------------------------|:-----------------:|:-----------:| |Constructor throwing exception |N/A |n | |Constructor throwing exception (serializable) |Y |Y | |Constructor with arguments |N/A |n | |Constructor with arguments (serializable) |Y |Y | |Constructor with mandatory arguments |N/A |n | |Constructor with mandatory arguments (serializable)|Y |Y | |Default package constructor |N/A |Y | |Default package constructor (serializable) |Y |Y | |Default private constructor |N/A |Y | |Default private constructor (serializable) |Y |Y | |Default protected constructor |N/A |Y | |Default protected constructor (serializable) |Y |Y | |Default public constructor |N/A |Y | |Default public constructor (serializable) |Y |Y | |No constructor |N/A |Y | |No constructor (serializable) |Y |Y | |Serializable replacing with another class |Y |Y | |Serializable resolving to another class |n |n | |Serializable with ancestor throwing exception |N/A |n | objenesis-2.6/header.txt0000644000175000017500000000112013122236310013436 0ustar apoapoCopyright ${inceptionYear}-${year} the original author or authors. 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. objenesis-2.6/settings-example.xml0000644000175000017500000000063613122236310015473 0ustar apoapo sonatype-nexus-snapshots myusername mypassword sonatype-nexus-staging myusername mypassword objenesis-2.6/tck/0000755000175000017500000000000013122236310012234 5ustar apoapoobjenesis-2.6/tck/.settings/0000755000175000017500000000000013122236310014152 5ustar apoapoobjenesis-2.6/tck/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005752013122236310021145 0ustar apoapoeclipse.preferences.version=1 org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.codeComplete.argumentSuffixes= org.eclipse.jdt.core.codeComplete.fieldPrefixes= org.eclipse.jdt.core.codeComplete.fieldSuffixes= org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=100 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=1 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=3 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=3 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true objenesis-2.6/tck/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000573013122236310020626 0ustar apoapoeclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Objenesis formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=false sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true objenesis-2.6/tck/src/0000755000175000017500000000000013122236310013023 5ustar apoapoobjenesis-2.6/tck/src/test/0000755000175000017500000000000013122236310014002 5ustar apoapoobjenesis-2.6/tck/src/test/java/0000755000175000017500000000000013122236310014723 5ustar apoapoobjenesis-2.6/tck/src/test/java/org/0000755000175000017500000000000013122236310015512 5ustar apoapoobjenesis-2.6/tck/src/test/java/org/objenesis/0000755000175000017500000000000013122236310017473 5ustar apoapoobjenesis-2.6/tck/src/test/java/org/objenesis/tck/0000755000175000017500000000000013122236310020254 5ustar apoapoobjenesis-2.6/tck/src/test/java/org/objenesis/tck/SerializableTest.java0000644000175000017500000002015113122236310024364 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Externalizable; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.ObjectStreamException; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import org.junit.After; import org.junit.Test; import static org.junit.Assert.*; /** * Test showcasing how the normal serialization should behave (constructor and special methods called). You * can use it to compare with an instantiator to see how it mimics it. * * @author Henri Tremblay */ public class SerializableTest { public static class IsSerializable implements Serializable { public IsSerializable() { called.add("IsSerializable.constructor"); } } public static class ExtendsSerializable extends IsSerializable { public ExtendsSerializable() { called.add("ExtendsSerializable.constructor"); } } public static class NotSerializable { public NotSerializable() { called.add("NotSerializable.constructor"); } } public static class ExtendsNotSerializableButIs extends NotSerializable implements Serializable { public ExtendsNotSerializableButIs() { called.add("ExtendsNotSeriazableButIs.constructor"); } } public static class IsExternalizable implements Externalizable { public IsExternalizable() { called.add("IsExternalizable.constructor"); } @Override public void writeExternal(ObjectOutput out) throws IOException { called.add("IsExternalizable.write"); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { called.add("IsExternalizable.read"); } private Object writeReplace() throws ObjectStreamException { called.add("IsExternalizable.writeReplace"); return this; } private Object readResolve() throws ObjectStreamException { called.add("IsExternalizable.readResolve"); return this; } } public static class IsExternalizableAndSerializable implements Externalizable, Serializable { public IsExternalizableAndSerializable() { called.add("IsExternalizableAndSerializable.constructor"); } @Override public void writeExternal(ObjectOutput out) throws IOException { called.add("IsExternalizableAndSerializable.write"); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { called.add("IsExternalizableAndSerializable.read"); } } public static class IsExternalizableButExtends extends ExtendsNotSerializableButIs implements Externalizable { public IsExternalizableButExtends() { called.add("IsExternalizableButExtends.constructor"); } @Override public void writeExternal(ObjectOutput out) throws IOException { called.add("IsExternalizableButExtends.write"); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { called.add("IsExternalizableButExtends.read"); } } public static class ReadWriteObject implements Serializable { public ReadWriteObject() { called.add("ReadWriteObject.constructor"); } // Write the object to the stream private void writeObject(java.io.ObjectOutputStream out) throws IOException { called.add("ReadWriteObject.write"); } // Read the object from the stream private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { called.add("ReadWriteObject.read"); } } public static class ReadWriteReplace implements Serializable { public ReadWriteReplace() { called.add("ReadWriteReplace.constructor"); } private Object writeReplace() throws ObjectStreamException { called.add("ReadWriteReplace.write"); return this; } private Object readResolve() throws ObjectStreamException { called.add("ReadWriteReplace.read"); return this; } } private static Set called = new HashSet(); @After public void verify() { assertTrue(called.toString(), called.isEmpty()); } @Test public void isSerializable() throws Exception { writeRead(new IsSerializable()); assertNotCalled("IsSerializable.constructor"); } @Test public void extendsSerializable() throws Exception { writeRead(new ExtendsSerializable()); assertNotCalled("IsSerializable.constructor"); assertNotCalled("ExtendsSerializable.constructor"); } @Test public void notSerializable() throws Exception { try { writeRead(new NotSerializable()); fail("Class is not serializable so can't be read"); } catch(NotSerializableException e) { } assertNotCalled("NotSerializable.constructor"); } @Test public void extendsNotSerializable() throws Exception { writeRead(new ExtendsNotSerializableButIs()); assertCalled("NotSerializable.constructor"); assertNotCalled("ExtendsNotSeriazableButIs.constructor"); } @Test public void isExternalizable() throws Exception { writeRead(new IsExternalizable()); assertCalled("IsExternalizable.constructor"); assertCalled("IsExternalizable.read"); assertCalled("IsExternalizable.write"); assertCalled("IsExternalizable.writeReplace"); assertCalled("IsExternalizable.readResolve"); } @Test public void isExternalizableAndSerializable() throws Exception { writeRead(new IsExternalizableAndSerializable()); assertCalled("IsExternalizableAndSerializable.constructor"); assertCalled("IsExternalizableAndSerializable.read"); assertCalled("IsExternalizableAndSerializable.write"); } @Test public void isExternalizableButExtends() throws Exception { writeRead(new IsExternalizableButExtends()); assertCalled("NotSerializable.constructor"); assertCalled("ExtendsNotSeriazableButIs.constructor"); assertCalled("IsExternalizableButExtends.constructor"); assertCalled("IsExternalizableButExtends.read"); assertCalled("IsExternalizableButExtends.write"); } @Test public void readWriteObject() throws Exception { writeRead(new ReadWriteObject()); assertNotCalled("ReadWriteObject.constructor"); assertCalled("ReadWriteObject.read"); assertCalled("ReadWriteObject.write"); } @Test public void readWriteReplace() throws Exception { writeRead(new ReadWriteReplace()); assertNotCalled("ReadWriteReplace.constructor"); assertCalled("ReadWriteReplace.read"); assertCalled("ReadWriteReplace.write"); } private void assertCalled(String s) { assertTrue(called.remove(s)); } private void assertNotCalled(String s) { assertFalse(called.remove(s)); } private void writeRead(Object s) throws IOException, ClassNotFoundException { called.clear(); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bOut); out.writeObject(s); out.close(); byte[] buffer = bOut.toByteArray(); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer)); in.readObject(); in.close(); } } objenesis-2.6/tck/src/test/java/org/objenesis/tck/OsgiTest.java0000644000175000017500000000670613122236310022671 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.File; import java.io.IOException; import java.io.Serializable; import org.junit.Test; import org.junit.runner.RunWith; import org.objenesis.Objenesis; import org.objenesis.ObjenesisHelper; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerMethod; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import static org.junit.Assert.*; import static org.ops4j.pax.exam.CoreOptions.*; /** * @author Henri Tremblay */ @RunWith(PaxExam.class) @ExamReactorStrategy(PerMethod.class) public class OsgiTest implements Serializable{ private static final long serialVersionUID = 1L; @Configuration public Option[] config() { String version = getImplementationVersion(Objenesis.class); return options( bundle("file:../main/target/objenesis-" + version + ".jar"), junitBundles() ); } @Test public void testCanInstantiate() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newInstance(getClass()).getClass()); } @Test public void testCanInstantiateSerialize() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newSerializableInstance(getClass()).getClass()); } private String getImplementationVersion(final Class c) { String version = c.getPackage().getImplementationVersion(); // Null means we are an IDE, not in Maven. So we have an IDE project dependency instead // of a Maven dependency with the jar. Which explains why the version is null (no Manifest // since there's no jar). In that case we get the version from the pom.xml. if(version == null) { try { XPathFactory xPathFactory = XPathFactory.newInstance(); final XPath xPath = xPathFactory.newXPath(); XPathExpression xPathExpression; try { xPathExpression = xPath.compile("/project/parent/version"); } catch(final XPathExpressionException e) { throw new RuntimeException(e); } final DocumentBuilderFactory xmlFact = DocumentBuilderFactory.newInstance(); xmlFact.setNamespaceAware(false); final DocumentBuilder builder = xmlFact.newDocumentBuilder(); final Document doc = builder.parse(new File("pom.xml")); version = xPathExpression.evaluate(doc); } catch(final Exception e) { throw new RuntimeException(e); } } return version; } } objenesis-2.6/tck/src/test/java/org/objenesis/tck/TextReporterTest.java0000644000175000017500000000767513122236310024445 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.Before; import org.junit.Test; import org.objenesis.Objenesis; import org.objenesis.ObjenesisBase; import org.objenesis.instantiator.basic.ConstructorInstantiator; import org.objenesis.instantiator.basic.FailingInstantiator; import org.objenesis.strategy.SingleInstantiatorStrategy; import static org.junit.Assert.*; /** * @author Joe Walnes * @author Henri Tremblay */ public class TextReporterTest { private TextReporter textReporter; private ByteArrayOutputStream summaryBuffer; @Before public void setUp() throws Exception { summaryBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream logBuffer = new ByteArrayOutputStream(); textReporter = new TextReporter(new PrintStream(summaryBuffer), new PrintStream(logBuffer)); } @Test public void testReportsSuccessesInTabularFormat() { Objenesis instantiator1 = new ObjenesisBase(new SingleInstantiatorStrategy( ConstructorInstantiator.class)); Objenesis instantiator2 = new ObjenesisBase(new SingleInstantiatorStrategy( FailingInstantiator.class)); textReporter.startTests("Some platform", instantiator1, instantiator2); textReporter.startTest(new Candidate(TCKTest.CandidateA.class, "candidate A", Candidate.CandidateType.STANDARD, Candidate.CandidateType.SERIALIZATION)); textReporter.result(Candidate.CandidateType.STANDARD,false); textReporter.result(Candidate.CandidateType.SERIALIZATION, true); textReporter.startTest(new Candidate(TCKTest.CandidateB.class, "candidate B", Candidate.CandidateType.STANDARD)); textReporter.result(Candidate.CandidateType.STANDARD,true); textReporter.startTest(new Candidate(TCKTest.CandidateC.class,"candidate C", Candidate.CandidateType.STANDARD, Candidate.CandidateType.SERIALIZATION)); textReporter.exception(Candidate.CandidateType.STANDARD, new RuntimeException("Problem")); textReporter.result(Candidate.CandidateType.SERIALIZATION, false); textReporter.startTest(new Candidate(TCKTest.CandidateD.class,"candidate D", Candidate.CandidateType.SERIALIZATION)); textReporter.result(Candidate.CandidateType.SERIALIZATION, true); textReporter.endTests(); ByteArrayOutputStream expectedSummaryBuffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(expectedSummaryBuffer); out.println("Running TCK on platform: Some platform"); out.println(); out.println("Instantiators used: "); out.println(" Objenesis standard : org.objenesis.instantiator.basic.ConstructorInstantiator"); out.println(" Objenesis serializer: org.objenesis.instantiator.basic.FailingInstantiator"); out.println(); out.println(" Objenesis standard Objenesis serializer"); out.println("candidate A n Y "); out.println("candidate B Y N/A "); out.println("candidate C n n "); out.println("candidate D N/A Y "); out.println(); out.println("--- FAILED: 3 error(s) occurred ---"); out.println(); assertEquals(expectedSummaryBuffer.toString(), summaryBuffer.toString()); } } objenesis-2.6/tck/src/test/java/org/objenesis/tck/TCKTest.java0000644000175000017500000001420413122236310022401 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.IOException; import org.junit.Test; import org.objenesis.Objenesis; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.tck.features.Feature; import static org.junit.Assert.*; /** * @author Joe Walnes * @author Henri Tremblay */ public class TCKTest { public static class StubbedInstantiator implements Objenesis { public T newInstance(Class clazz) { return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } @Test public void testReportsAllCandidatesAndInstantiatorCombinationsToReporter() { Reporter reporter = new RecordingReporter(); // Given... a TCK with some candidate classes: A, B and C. TCK tck = new TCK(new StubbedInstantiator(), new StubbedInstantiator(), reporter) { @Override protected void loadCandidates() throws IOException { registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.STANDARD); registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.STANDARD); registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.SERIALIZATION); registerCandidate(CandidateC.class, "Candidate C", Candidate.CandidateType.STANDARD); } }; // When... the TCK tests are run tck.runTests(); // Expect... the reporter to have received a sequence of calls // notifying it of what the TCK is doing. assertEquals("" + "startTests()\n" + "startTest('Candidate A')\nresult(STANDARD, false)\n" + "startTest('Candidate B')\nresult(STANDARD, false)\nresult(SERIALIZATION, false)\n" + "startTest('Candidate C')\nresult(STANDARD, false)\n" + "endTests()\n", reporter.toString()); } @Test public void testReportsSuccessIfCandidateCanBeInstantiated() { // When... the TCK tests are run Reporter reporter = new RecordingReporter(); // Given... a TCK with some candidate classes: A, B and C. TCK tck = new TCK(new SelectiveInstantiator(), new SelectiveInstantiator(), reporter) { @Override protected void loadCandidates() throws IOException { registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.STANDARD); registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.SERIALIZATION); registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.STANDARD); registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.SERIALIZATION); registerCandidate(CandidateC.class, "Candidate C", Candidate.CandidateType.STANDARD); registerCandidate(CandidateD.class, "Candidate D", Candidate.CandidateType.SERIALIZATION); } }; tck.runTests(); // Expect... the reporter to be notified that A succeeded // but B failed. assertEquals("" + "startTests()\n" + "startTest('Candidate A')\nresult(STANDARD, true)\nresult(SERIALIZATION, true)\n" + "startTest('Candidate B')\nresult(STANDARD, false)\nresult(SERIALIZATION, false)\n" + "startTest('Candidate C')\nexception(STANDARD)\n" + "startTest('Candidate D')\nresult(SERIALIZATION, true)\n" + "endTests()\n", reporter.toString()); } // Some sample classes used for testing. public static class SelectiveInstantiator implements Objenesis { public T newInstance(Class clazz) { if(clazz == CandidateA.class) { return clazz.cast(new CandidateA()); } if(clazz == CandidateC.class) { throw new RuntimeException("fail"); } return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } public static class CandidateA { } public static class CandidateB { } public static class CandidateC { } public static class CandidateD implements Feature { @Override public boolean isCompliant(Objenesis objenesis) { return true; } } /** * A poor man's mock. Using a recording test double to verify interactions between the TCK and * the Recorder. *

* Note: This test case could be simplified by using a mock object library. However, I wanted to simplify * dependencies - particularly as in the future, the mock libraries * may depend on objenesis - getting into an awkward cyclical dependency situation. -Joe. */ private static class RecordingReporter implements Reporter { private final StringBuilder log = new StringBuilder(); @Override public void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer) { log.append("startTests()\n"); } @Override public void startTest(Candidate candidate) { log.append("startTest('").append(candidate.getDescription()).append("')\n"); } @Override public void result(Candidate.CandidateType type, boolean worked) { log.append("result(").append(type).append(", ").append(worked).append(")\n"); } @Override public void exception(Candidate.CandidateType type, Exception exception) { log.append("exception(").append(type).append(")\n"); } @Override public void endTests() { log.append("endTests()\n"); } @Override public String toString() { return log.toString(); } } } objenesis-2.6/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java0000644000175000017500000000447013122236310023705 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.Test; import org.objenesis.Objenesis; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; import static org.junit.Assert.*; /** * Integration test for Objenesis. Should pass successfully on every supported JVM for all Objenesis * interface implementation. * * @author Henri Tremblay */ public class ObjenesisTest { public static class JUnitReporter implements Reporter { private Candidate currentCandidate; @Override public void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer) { } @Override public void startTest(Candidate candidate) { currentCandidate = candidate; } @Override public void result(Candidate.CandidateType type, boolean worked) { assertTrue("Instantiating " + currentCandidate + " for " + type + " failed", worked); } @Override public void exception(Candidate.CandidateType type, Exception exception) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); try { out.println("Exception when instantiating " + currentCandidate + " for " + type + ": "); exception.printStackTrace(out); fail(buffer.toString()); } finally { out.close(); } } @Override public void endTests() { } } @Test public void test() throws Exception { TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), new JUnitReporter()); tck.runTests(); } } objenesis-2.6/tck/src/test/java/org/objenesis/tck/AbstractLoaderTest.java0000644000175000017500000001026713122236310024657 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.ByteArrayInputStream; import java.io.IOException; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; /** * @author Henri Tremblay * @author Joe Walnes */ public class AbstractLoaderTest { private StringBuilder recordedEvents; private AbstractLoader loader; private AbstractLoader.ErrorHandler errorHandler; @Before public void setUp() throws Exception { recordedEvents = new StringBuilder(); AbstractLoader.ErrorHandler errorHandler = new CandidateLoader.ErrorHandler() { public void classNotFound(String name) { recordedEvents.append("classNotFound('").append(name).append("')\n"); } }; loader = new AbstractLoader(getClass().getClassLoader(), errorHandler) { @Override protected void handlePropertyEntry(Class clazz, String description, Candidate.CandidateType type) { recordedEvents.append("registerCandidate('class " + clazz.getName() + "', '" + description + "')\n"); } }; } @Test public void testReadsClassesAndDescriptionsFromPropertiesFile() throws IOException { String input = "" + "org.objenesis.tck.AbstractLoaderTest$A = A candidate\n" + "\n" + "# a comment and some whitespace\n" + "\n" + "org.objenesis.tck.AbstractLoaderTest$B = B candidate\n" + "org.objenesis.tck.AbstractLoaderTest$C = C candidate\n"; loader.loadFrom(new ByteArrayInputStream(input.getBytes()), Candidate.CandidateType.STANDARD); assertEquals("" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$A', 'A candidate')\n" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$B', 'B candidate')\n" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$C', 'C candidate')\n", recordedEvents.toString()); } @Test public void testReportsMissingClassesToErrorHandler() throws IOException { String input = "" + "org.objenesis.tck.AbstractLoaderTest$A = A candidate\n" + "org.objenesis.tck.AbstractLoaderTest$NonExistant = Dodgy candidate\n" + "org.objenesis.tck.AbstractLoaderTest$C = C candidate\n"; loader.loadFrom(new ByteArrayInputStream(input.getBytes()), Candidate.CandidateType.STANDARD); assertEquals("" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$A', 'A candidate')\n" + "classNotFound('org.objenesis.tck.AbstractLoaderTest$NonExistant')\n" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$C', 'C candidate')\n", recordedEvents.toString()); } @Test public void testLoadsFromResourceInClassPath() throws IOException { // See CandidateLoaderTest-sample.properties. loader.loadFromResource("org/objenesis/tck/CandidateLoaderTest-sample.properties", Candidate.CandidateType.STANDARD); assertEquals("" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$A', 'A candidate')\n" + "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$B', 'B candidate')\n", recordedEvents.toString()); } @Test public void testThrowsIOExceptionIfResourceNotInClassPath() throws IOException { try { loader.loadFromResource( "Blatently-Bogus.properties", Candidate.CandidateType.STANDARD); fail("Expected exception"); } catch(IOException expectedException) { // Good! } } // Sample classes. public static class A { } public static class B { } public static class C { } } objenesis-2.6/tck/src/test/resources/0000755000175000017500000000000013122236310016014 5ustar apoapoobjenesis-2.6/tck/src/test/resources/logback-test.xml0000644000175000017500000000163513122236310021122 0ustar apoapo %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n objenesis-2.6/tck/src/test/resources/org/0000755000175000017500000000000013122236310016603 5ustar apoapoobjenesis-2.6/tck/src/test/resources/org/objenesis/0000755000175000017500000000000013122236310020564 5ustar apoapoobjenesis-2.6/tck/src/test/resources/org/objenesis/tck/0000755000175000017500000000000013122236310021345 5ustar apoapoobjenesis-2.6/tck/src/test/resources/org/objenesis/tck/CandidateLoaderTest-sample.properties0000644000175000017500000000134613122236310030611 0ustar apoapo# # Copyright 2006-2017 the original author or authors. # # 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. # # See CandidateLoaderTest.java org.objenesis.tck.AbstractLoaderTest$A = A candidate org.objenesis.tck.AbstractLoaderTest$B = B candidate objenesis-2.6/tck/src/main/0000755000175000017500000000000013122236310013747 5ustar apoapoobjenesis-2.6/tck/src/main/java/0000755000175000017500000000000013122236310014670 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/0000755000175000017500000000000013122236310015457 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/objenesis/0000755000175000017500000000000013122236310017440 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/objenesis/tck/0000755000175000017500000000000013122236310020221 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/0000755000175000017500000000000013122236310022320 5ustar apoapo././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.ja0000644000175000017500000000216413122236310032235 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorWithArguments implements Serializable { private static final long serialVersionUID = 1L; private final String something; private final int another; public SerializableConstructorWithArguments(String something, int another) { this.something = something; this.another = another; } public String toString() { return something + another; } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java0000644000175000017500000000175613122236310030243 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class ConstructorWithArguments { private final String something; private final int another; public ConstructorWithArguments(String something, int another) { this.something = something; this.another = another; } public String toString() { return something + another; } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java0000644000175000017500000000140513122236310030271 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class DefaultPackageConstructor { DefaultPackageConstructor() { } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArg0000644000175000017500000000202613122236310032264 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorWithMandatoryArguments implements Serializable { private static final long serialVersionUID = 1L; public SerializableConstructorWithMandatoryArguments(String something) { if(something == null) { throw new IllegalArgumentException("Need arguments"); } } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java0000644000175000017500000000163413122236310027317 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableResolver implements Serializable { private static final long serialVersionUID = 1L; protected Object readResolve() { return new SerializableReplacer(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java0000644000175000017500000000154113122236310031112 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class ConstructorThrowingException { public ConstructorThrowingException() { throw new IllegalArgumentException("Constructor throwing an exception"); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java0000644000175000017500000000132113122236310026002 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class NoConstructor { } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.j0000644000175000017500000000162313122236310032211 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultPrivateConstructor implements Serializable { private static final long serialVersionUID = 1L; private SerializableDefaultPrivateConstructor() { } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java0000644000175000017500000000162013122236310032110 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class ConstructorWithMandatoryArguments { public ConstructorWithMandatoryArguments(String something) { if(something == null) { throw new IllegalArgumentException("Need arguments"); } } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.j0000644000175000017500000000161313122236310032131 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultPackageConstructor implements Serializable { private static final long serialVersionUID = 1L; SerializableDefaultPackageConstructor() { } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.ja0000644000175000017500000000162013122236310032153 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultPublicConstructor implements Serializable { private static final long serialVersionUID = 1L; public SerializableDefaultPublicConstructor() { } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java0000644000175000017500000000141213122236310030152 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class DefaultPublicConstructor { public DefaultPublicConstructor() { } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java0000644000175000017500000000163513122236310027254 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableReplacer implements Serializable { private static final long serialVersionUID = 1L; protected Object writeReplace() { return new SerializableResolver(); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingException.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingExceptio0000644000175000017500000000174713122236310032353 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorThrowingException implements Serializable { private static final long serialVersionUID = 1L; public SerializableConstructorThrowingException() { throw new IllegalArgumentException("Constructor throwing an exception"); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java0000644000175000017500000000150713122236310030337 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableNoConstructor implements Serializable { private static final long serialVersionUID = 1L; } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java0000644000175000017500000000141513122236310030351 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class DefaultPrivateConstructor { private DefaultPrivateConstructor() { } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingExcepti0000644000175000017500000000170213122236310032250 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableWithAncestorThrowingException extends ConstructorThrowingException implements Serializable { private static final long serialVersionUID = 1L; public SerializableWithAncestorThrowingException() { } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java0000644000175000017500000000142313122236310030667 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; /** * @author Joe Walnes */ public class DefaultProtectedConstructor { protected DefaultProtectedConstructor() { } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.javaobjenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor0000644000175000017500000000163113122236310032277 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultProtectedConstructor implements Serializable { private static final long serialVersionUID = 1L; protected SerializableDefaultProtectedConstructor() { } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/Main.java0000644000175000017500000000321613122236310021752 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.IOException; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; /** * Command line launcher for Technology Compatibility Kit (TCK). * * @author Joe Walnes * @author Henri Tremblay * @see TCK */ public class Main { /** * Main class of the TCK. Can also be called as a normal method from an application server. * * @param args No parameters are required * @throws IOException When the TCK fails to read properties' files. */ public static void main(String[] args) throws IOException { TextReporter reporter = new TextReporter(System.out, System.err); run(reporter); if(reporter.hasErrors()) { System.exit(1); } } /** * Run the full test suite using standard Objenesis instances * * @param reporter result are recorded in the reporter */ public static void run(Reporter reporter) { TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), reporter); tck.runTests(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/AbstractLoader.java0000644000175000017500000001043513122236310023761 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.Properties; /** * Class loading a property file and delegating the treatment of each line to a concrete implementations. * * @author Henri Tremblay */ public abstract class AbstractLoader { private final ClassLoader classloader; private final ErrorHandler errorHandler; /** * Handler for reporting errors from the AbstractLoader. */ public interface ErrorHandler { /** * Called whenever, trying to retrieve a candidate class from its name, a * ClassNotFoundException is thrown * * @param name Candidate class name */ void classNotFound(String name); } /** * Error handler that logs errors to a text stream. */ public static class LoggingErrorHandler implements CandidateLoader.ErrorHandler { private final PrintStream out; /** * @param out Stream in which to log */ public LoggingErrorHandler(PrintStream out) { this.out = out; } public void classNotFound(String name) { out.println("Class not found : " + name); } } /** * @param classloader ClassLoader from which candidates classes are loaded * @param errorHandler Handler called in case of error */ public AbstractLoader(ClassLoader classloader, ErrorHandler errorHandler) { this.classloader = classloader; this.errorHandler = errorHandler; } /** * @param inputStream Stream containing the properties * @param type Type of the candidate loaded from the stream * @throws IOException If something goes wrong while reading the stream */ public void loadFrom(InputStream inputStream, final Candidate.CandidateType type) throws IOException { // Properties contains a convenient key=value parser, however it stores // the entries in a Hashtable which loses the original order. // So, we create a special Properties instance that writes its // entries directly to the concrete implementations. Properties properties = new Properties() { private static final long serialVersionUID = 1L; @Override public Object put(Object key, Object value) { handlePropertyEntry((String) key, (String) value, type); return null; } }; properties.load(inputStream); } /** * Load a candidate property file * * @param resource File name * @param type Type of the candidate loaded from the stream * @throws IOException If there's problem reading the file */ public void loadFromResource(String resource, Candidate.CandidateType type) throws IOException { InputStream candidatesConfig = classloader.getResourceAsStream(resource); if(candidatesConfig == null) { throw new IOException("Resource '" + resource + "' not found"); } try { loadFrom(candidatesConfig, type); } finally { candidatesConfig.close(); } } private void handlePropertyEntry(String key, String value, Candidate.CandidateType type) { try { Class candidate = Class.forName(key, true, classloader); handlePropertyEntry(candidate, value, type); } catch(ClassNotFoundException e) { errorHandler.classNotFound(key); } } /** * Will receive one class and its description pairs from the file * * @param clazz class on the line * @param description description of the class * @param type type of the candidate */ protected abstract void handlePropertyEntry(Class clazz, String description, Candidate.CandidateType type); } objenesis-2.6/tck/src/main/java/org/objenesis/tck/CandidateLoader.java0000644000175000017500000000255113122236310024072 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; /** * Loads a set of candidate classes from a properties file into the TCK. *

* The properties file takes the form of candidateClassName=shortDescription. * * @author Joe Walnes * @see TCK */ class CandidateLoader extends AbstractLoader { private final TCK tck; /** * @param tck TCK that will use the candidates * @param errorHandler Handler called in case of error */ public CandidateLoader(TCK tck, AbstractLoader.ErrorHandler errorHandler) { super(tck.getClass().getClassLoader(), errorHandler); this.tck = tck; } protected void handlePropertyEntry(Class clazz, String description, Candidate.CandidateType type) { tck.registerCandidate(clazz, description, type); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/TCK.java0000644000175000017500000001364513122236310021516 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.IOException; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.objenesis.Objenesis; import org.objenesis.strategy.PlatformDescription; import org.objenesis.tck.features.Feature; /** * Technology Compatibility Kit (TCK) for {@link Objenesis}s. *

* This TCK tests Objenesis implementations against a set of candidate classes (class it attempts to instantiate), * reporting the results to a {@link Reporter}. * *

Example usage

* *
 * TextReporter reporter = new TextReporter(System.out, System.err);
 * TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), reporter);
 * tck.runTests(reporter);
 * reporter.printResults();
 * 
* * @author Joe Walnes * @author Henri Tremblay * @see org.objenesis.instantiator.ObjectInstantiator * @see Reporter * @see Main */ public class TCK { private final Objenesis objenesisStandard; private final Objenesis objenesisSerializer; private final Reporter reporter; private final List candidates = new ArrayList(); /** * @param objenesisStandard Objenesis instance used to instantiate classes the standard way (no constructor called) * @param objenesisSerializer Objenesis instance used to instantiate classes in a serialization compliant way (first not serializable constructor called) * @param reporter Where to report the results of the tests to */ public TCK(Objenesis objenesisStandard, Objenesis objenesisSerializer, Reporter reporter) { this.objenesisStandard = objenesisStandard; this.objenesisSerializer = objenesisSerializer; this.reporter = reporter; try { loadCandidates(); } catch(IOException e) { throw new RuntimeException(e); } Collections.sort(candidates); } protected void loadCandidates() throws IOException { CandidateLoader candidateLoader = new CandidateLoader(this, new CandidateLoader.LoggingErrorHandler(System.err)); candidateLoader.loadFromResource("org/objenesis/tck/candidates/standard-candidates.properties", Candidate.CandidateType.STANDARD); candidateLoader.loadFromResource("org/objenesis/tck/candidates/serializable-candidates.properties", Candidate.CandidateType.SERIALIZATION); } /** * Register a candidate class to attempt to instantiate. * * @param candidateClass Class to attempt to instantiate * @param description Description of the class */ public void registerCandidate(Class candidateClass, String description, Candidate.CandidateType type) { Candidate candidate = new Candidate(candidateClass, description, type); int index = candidates.indexOf(candidate); if(index >= 0) { Candidate existingCandidate = candidates.get(index); if(!description.equals(existingCandidate.getDescription())) { throw new IllegalStateException("Two different descriptions for candidate " + candidateClass.getName()); } existingCandidate.getTypes().add(type); } else { candidates.add(candidate); } } /** * Run all TCK tests. */ public void runTests() { reporter.startTests(describePlatform(), objenesisStandard, objenesisSerializer); for(Candidate candidate : candidates) { reporter.startTest(candidate); if(candidate.getTypes().contains(Candidate.CandidateType.STANDARD)) { runTest(reporter, candidate.getClazz(), objenesisStandard, Candidate.CandidateType.STANDARD); } if(candidate.getTypes().contains(Candidate.CandidateType.SERIALIZATION)) { runTest(reporter, candidate.getClazz(), objenesisSerializer, Candidate.CandidateType.SERIALIZATION); } } reporter.endTests(); } private void runTest(Reporter reporter, Class candidate, Objenesis objenesis, Candidate.CandidateType type) { if(Feature.class.isAssignableFrom(candidate)) { runFeature(reporter, candidate, objenesis, type); } else { runCandidate(reporter, candidate, objenesis, type); } } private void runFeature(Reporter reporter, Class clazz, Objenesis objenesis, Candidate.CandidateType type) { try { @SuppressWarnings("unchecked") Constructor constructor = (Constructor) clazz.getConstructor(); Feature feature = constructor.newInstance(); boolean compliant = feature.isCompliant(objenesis); reporter.result(type, compliant); } catch(Exception e) { reporter.exception(type, e); } } private void runCandidate(Reporter reporter, Class candidate, Objenesis objenesis, Candidate.CandidateType type) { try { Object instance = objenesis.newInstance(candidate); boolean success = instance != null && instance.getClass() == candidate; reporter.result(type, success); } catch(Exception e) { reporter.exception(type, e); } } /** * Describes the platform. Outputs Java version and vendor. To change this behavior, override * this method. * * @return Description of the current platform */ protected String describePlatform() { return PlatformDescription.describePlatform(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/0000755000175000017500000000000013122236310021466 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java0000644000175000017500000000644613122236310027511 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.search; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.PlatformDescription; import org.objenesis.tck.candidates.SerializableNoConstructor; import java.io.Serializable; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Iterator; import java.util.SortedSet; /** * This class will try every available instantiator on the platform to see which works. * * @author Henri Tremblay */ public class SearchWorkingInstantiator implements Serializable { // implements Serializable just for the test private SearchWorkingInstantiatorListener listener; public static void main(String[] args) throws Exception { System.out.println(); System.out.println(PlatformDescription.describePlatform()); System.out.println(); SearchWorkingInstantiator searchWorkingInstantiator = new SearchWorkingInstantiator(new SystemOutListener()); searchWorkingInstantiator.searchForInstantiator(SerializableNoConstructor.class); } public SearchWorkingInstantiator(SearchWorkingInstantiatorListener listener) { this.listener = listener; } public void searchForInstantiator(Class toInstantiate) { SortedSet classes = ClassEnumerator.getClassesForPackage(ObjectInstantiator.class.getPackage()); for (Iterator it = classes.iterator(); it.hasNext();) { String className = it.next(); // Skip if inner class or isn't named like a instantiator if(className.contains("$") || !className.endsWith("Instantiator")) { continue; } Class c = null; try { c = Class.forName(className); } catch(Exception e) { listener.instantiatorUnsupported(c, e); continue; } if(c.isInterface() || !ObjectInstantiator.class.isAssignableFrom(c)) { continue; } Constructor constructor; try { constructor = c.getConstructor(Class.class); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } try { ObjectInstantiator instantiator = (ObjectInstantiator) constructor.newInstance(toInstantiate); instantiator.newInstance(); listener.instantiatorSupported(c); } catch(Exception e) { Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e; listener.instantiatorUnsupported(c, t); } } } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java0000644000175000017500000000152213122236310031205 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.search; /** * @author Henri Tremblay */ public interface SearchWorkingInstantiatorListener { void instantiatorSupported(Class c); void instantiatorUnsupported(Class c, Throwable t); } objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java0000644000175000017500000001140013122236310025434 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.search; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarFile; /** * Taken and adapted from here * * @author Henri Tremblay */ public class ClassEnumerator { private static void processDirectory(File directory, String pkgname, SortedSet classes) { // Get the list of the files contained in the package String[] files = directory.list(); for (int i = 0; i < files.length; i++) { String fileName = files[i]; // we are only interested in .class files if (fileName.endsWith(".class")) { // removes the .class extension String className = pkgname + '.' + fileName.substring(0, fileName.length() - 6); classes.add(className); continue; } File subdir = new File(directory, fileName); if (subdir.isDirectory()) { processDirectory(subdir, pkgname + '.' + fileName, classes); } } } private static void processJarfile(URL resource, String pkgname, SortedSet classes) { String relPath = pkgname.replace('.', '/'); String resPath = resource.getPath(); String jarPath = resPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); JarFile jarFile; try { jarFile = new JarFile(jarPath); } catch (IOException e) { throw new RuntimeException("Unexpected IOException reading JAR File '" + jarPath + "'", e); } Enumeration entries = jarFile.entries(); while(entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String entryName = entry.getName(); String className = null; if(entryName.endsWith(".class") && entryName.startsWith(relPath) && entryName.length() > (relPath.length() + "/".length())) { className = entryName.replace('/', '.').replace('\\', '.').replace(".class", ""); } if (className != null) { classes.add(className); } } } /** * Return all the classes in this package recursively. The class loader of the {@code ClassEnumerator} class * is used * * @param pkg the searched package * @return list of full class names */ public static SortedSet getClassesForPackage(Package pkg) { return getClassesForPackage(pkg, ClassEnumerator.class.getClassLoader()); } /** * Return all the classes in this package recursively. * * @param pkg the searched package * @param classLoader class loader where to look for classes * @return list of full class names */ public static SortedSet getClassesForPackage(Package pkg, ClassLoader classLoader) { SortedSet classes = new TreeSet(new Comparator() { public int compare(String o1, String o2) { String simpleName1 = getSimpleName(o1); String simpleName2 = getSimpleName(o2); return simpleName1.compareTo(simpleName2); } private String getSimpleName(String className) { return className.substring(className.lastIndexOf('.')); } }); String pkgname = pkg.getName(); String relPath = pkgname.replace('.', '/'); // Get a File object for the package Enumeration resources; try { resources = classLoader.getResources(relPath); } catch (IOException e) { throw new RuntimeException(e); } while(resources.hasMoreElements()) { URL resource = resources.nextElement(); if (resource.toString().startsWith("jar:")) { processJarfile(resource, pkgname, classes); } else { processDirectory(new File(resource.getPath()), pkgname, classes); } } return classes; } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java0000644000175000017500000000271513122236310026020 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.search; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; /** * @author Henri Tremblay */ public class SystemOutListener implements SearchWorkingInstantiatorListener { private static final String PATTERN = "%-65s: %s%n"; public void instantiatorSupported(Class c) { System.out.printf(PATTERN, c.getSimpleName() + " (" + getTypology(c) + ")", "Working!"); } public void instantiatorUnsupported(Class c, Throwable t) { System.out.printf(PATTERN, c.getSimpleName() + "(" + getTypology(c) + ")", "KO - " + t); } private Typology getTypology(Class c) { Instantiator instantiatorAnn = c.getAnnotation(Instantiator.class); return instantiatorAnn == null ? Typology.UNKNOWN : instantiatorAnn.value(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/0000755000175000017500000000000013122236310022037 5ustar apoapoobjenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsSerializableClass.java0000644000175000017500000000235413122236310027635 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import org.objenesis.Objenesis; /** * A class extending a serializable class can be instantiated without calling any constructor * * @author Henri Tremblay */ public class ExtendsSerializableClass extends AbstractFeature { public static class ExtendsSerializable extends SerializableClass.IsSerializable { public ExtendsSerializable() { called.add(ExtendsSerializable.class.getSimpleName() + "."); } } @Override public boolean isCompliant(Objenesis objenesis) { objenesis.newInstance(ExtendsSerializable.class); return called.isEmpty(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadObjectNotCalled.java0000644000175000017500000000307413122236310026476 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import java.io.IOException; import java.io.ObjectStreamException; import java.io.Serializable; import org.objenesis.Objenesis; /** * {@code Serializable} special methods should not be called during instantiation. * * @author Henri Tremblay */ public class ReadObjectNotCalled extends AbstractFeature { public static class ReadObjectAndAll implements Serializable { private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { called.add("readObject"); } private Object readResolve() throws ObjectStreamException { called.add("readResolve"); return this; } private void readObjectNoData() throws ObjectStreamException { called.add("readObjectNoData"); } } @Override public boolean isCompliant(Objenesis objenesis) { objenesis.newInstance(ReadObjectAndAll.class); return called.isEmpty(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/NotSerializableClass.java0000644000175000017500000000237313122236310026764 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import org.objenesis.Objenesis; import org.objenesis.ObjenesisException; /** * Not serializable classes can't be instantiated. * * @author Henri Tremblay */ public class NotSerializableClass extends AbstractFeature { public static class NotSerializable { public NotSerializable() { called.add(NotSerializable.class.getSimpleName() + "."); } } @Override public boolean isCompliant(Objenesis objenesis) { try { objenesis.newInstance(NotSerializable.class); } catch(ObjenesisException e) { return true; } return false; } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadExternalNotCalled.java0000644000175000017500000000301513122236310027045 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; import org.objenesis.Objenesis; /** * {@code Externalizable} methods should not be called during instantiation. * * @author Henri Tremblay */ public class ReadExternalNotCalled extends AbstractFeature { public static class ReadExternalAndAll implements Serializable, Externalizable { @Override public void writeExternal(ObjectOutput out) throws IOException { called.add("writeExternal"); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { called.add("readExternal"); } } @Override public boolean isCompliant(Objenesis objenesis) { objenesis.newInstance(ReadExternalAndAll.class); return called.isEmpty(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/Feature.java0000644000175000017500000000174413122236310024303 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import org.objenesis.Objenesis; /** * A feature is a behavior that we expect from an instantiator. For example, we expect a serializing instantiator * to call the no-arg constructor of the first none-serializable parent class. * * @author Henri Tremblay */ public interface Feature { boolean isCompliant(Objenesis objenesis); } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/AbstractFeature.java0000644000175000017500000000224213122236310025761 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import java.util.ArrayList; import java.util.List; import org.objenesis.Objenesis; /** * Base class for features. It provides recording of calls. The recording is static * to the class so we expect {@link Feature#isCompliant(Objenesis)} multiple implementations to be called in * the same thread. * * @author Henri Tremblay */ public abstract class AbstractFeature implements Feature { protected static final List called = new ArrayList(); public AbstractFeature() { called.clear(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsNotSerializableParentClass.java0000644000175000017500000000260013122236310031462 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import java.io.Serializable; import org.objenesis.Objenesis; /** * No-arg of the first none serializable parent class is called. * * @author Henri Tremblay */ public class ExtendsNotSerializableParentClass extends AbstractFeature { public static class ExtendsNotSerializable extends NotSerializableClass.NotSerializable implements Serializable { public ExtendsNotSerializable() { called.add(ExtendsNotSerializable.class.getSimpleName() + "."); } } @Override public boolean isCompliant(Objenesis objenesis) { objenesis.newInstance(ExtendsNotSerializable.class); return called.size() == 1 && called.get(0).equals(NotSerializableClass.NotSerializable.class.getSimpleName() + "."); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/SerializableClass.java0000644000175000017500000000231213122236310026274 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck.features; import java.io.Serializable; import org.objenesis.Objenesis; /** * A serializable class can be instantiated without calling any constructor * * @author Henri Tremblay */ public class SerializableClass extends AbstractFeature { public static class IsSerializable implements Serializable { public IsSerializable() { called.add(Serializable.class.getSimpleName() + "."); } } @Override public boolean isCompliant(Objenesis objenesis) { objenesis.newInstance(IsSerializable.class); return called.isEmpty(); } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/TextReporter.java0000644000175000017500000001720613122236310023541 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.objenesis.Objenesis; /** * Reports results from TCK as tabulated text, suitable for dumping to the console or a file and * being read by a human. * * @author Joe Walnes * @author Henri Tremblay * @see TCK * @see Reporter */ public class TextReporter implements Reporter { private static class Result { Candidate candidate; Candidate.CandidateType type; boolean result; Exception exception; /** * @param candidate Candidate tested * @param type Type of test performed * @param result If the test is successful or not * @param exception Exception that might have occurred during the test */ public Result(Candidate candidate, Candidate.CandidateType type, boolean result, Exception exception) { this.candidate = candidate; this.type = type; this.result = result; this.exception = exception; } } private final PrintStream summary; private final PrintStream log; private long startTime; private int errorCount; private Objenesis objenesisStandard; private Objenesis objenesisSerializer; private Candidate currentCandidate; private final Map> results = new TreeMap>(); private String platformDescription; /** * @param summary Output of main report. * @param log Any additional information, useful for diagnostics. */ public TextReporter(PrintStream summary, PrintStream log) { this.summary = summary; this.log = log; } @Override public void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer) { this.platformDescription = platformDescription; this.objenesisStandard = objenesisStandard; this.objenesisSerializer = objenesisSerializer; this.currentCandidate = null; this.errorCount = 0; this.results.clear(); this.startTime = System.currentTimeMillis(); } @Override public void startTest(Candidate candidate) { currentCandidate = candidate; } @Override public void result(Candidate.CandidateType type, boolean success) { addResult(type, success, null); } @Override public void exception(Candidate.CandidateType type, Exception exception) { addResult(type, false, exception); } private void addResult(Candidate.CandidateType type, boolean success, Exception exception) { if(!success) { errorCount++; } Map result = results.get(currentCandidate); if(result == null) { results.put(currentCandidate, result = new HashMap()); } result.put(type, new Result(currentCandidate, type, success, exception)); } @Override public void endTests() { long totalTime = System.currentTimeMillis() - startTime; printResult(totalTime); } /** * Print the final summary report * * @param totalTime Time spent running the TCK */ private void printResult(long totalTime) { // Platform summary.println("Running TCK on platform: " + platformDescription); summary.println(); // Instantiator implementations summary.println("Instantiators used: "); summary.println(" Objenesis standard : " + objenesisStandard.getInstantiatorOf(String.class).getClass().getName()); summary.println(" Objenesis serializer: " + objenesisSerializer.getInstantiatorOf(String.class).getClass().getName()); summary.println(); Collection candidateNames = new ArrayList(); for(Map.Entry> entry : results.entrySet()) { candidateNames.add(entry.getKey().getDescription()); } int maxObjenesisWidth = "Objenesis serializer".length(); int maxCandidateWidth = lengthOfLongestStringIn(candidateNames); // Strategy used summary.print(pad("", maxCandidateWidth) + ' '); summary.print(pad("Objenesis standard", maxObjenesisWidth) + ' '); summary.print(pad("Objenesis serializer", maxObjenesisWidth)); summary.println(); List exceptions = new ArrayList(); // Candidates for(Map.Entry> entry : results.entrySet()) { summary.print(pad(entry.getKey().getDescription(), maxCandidateWidth) + ' '); Result standardResult = entry.getValue().get(Candidate.CandidateType.STANDARD); Result serializationResult = entry.getValue().get(Candidate.CandidateType.SERIALIZATION); if(standardResult == null && serializationResult == null) { continue; } if(standardResult == null) { summary.print(pad("N/A", maxObjenesisWidth) + " "); } else { summary.print(pad(standardResult.result ? "Y" : "n", maxObjenesisWidth) + " "); if(standardResult.exception != null) { exceptions.add(standardResult); } } if(serializationResult == null) { summary.print(pad("N/A", maxObjenesisWidth)); } else { summary.print(pad(serializationResult.result ? "Y" : "n", maxObjenesisWidth)); if(serializationResult.exception != null) { exceptions.add(serializationResult); } } summary.println(); } summary.println(); // Final if(errorCount != 0) { for(Result element : exceptions) { log.println("--- Candidate '" + element.candidate.getDescription() + "', Type '" + element.type + "' ---"); element.exception.printStackTrace(log); log.println(); } log.println(); summary.println("--- FAILED: " + errorCount + " error(s) occurred ---"); } else { summary.println("--- SUCCESSFUL: TCK tests passed without errors in " + totalTime + " ms"); } summary.println(); } /** * Return true if the reporter has registered some errors * * @return if there was errors during execution */ public boolean hasErrors() { return errorCount != 0; } private String pad(String text, int width) { if(text.length() == width) { return text; } else if(text.length() > width) { return text.substring(0, width); } else { StringBuilder padded = new StringBuilder(text); while(padded.length() < width) { padded.append(' '); } return padded.toString(); } } private int lengthOfLongestStringIn(Collection descriptions) { int result = 0; for(String s : descriptions) { result = Math.max(result, s.length()); } return result; } } objenesis-2.6/tck/src/main/java/org/objenesis/tck/Reporter.java0000644000175000017500000000436513122236310022676 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import org.objenesis.Objenesis; /** * Reports results from the TCK back to the user. *

* The sequence these methods are called is described below: * *

 * startTests(startTest(result | exception)) * endTests
 * 
* * @author Joe Walnes * @author Henri Tremblay * @see TCK * @see TextReporter */ public interface Reporter { /** * Report that the tests are starting. Provides information that is useful to be reported. * * @param platformDescription Description the platform being run on (i.e. JVM version, vendor, etc) * @param objenesisStandard Standard Objenesis instance used * @param objenesisSerializer Serialization Objenesis instance used */ void startTests(String platformDescription, Objenesis objenesisStandard, Objenesis objenesisSerializer); /** * Report that a test between a candidate and an objenesis instance is about to start. * * @param candidate Starting to test this candidate. */ void startTest(Candidate candidate); /** * Report details about what happened when performing an instantiation test or a serialization feature test. * * @param type type of test * @param worked Whether the test was successful or not */ void result(Candidate.CandidateType type, boolean worked); /** * Report that something bad happened during the test. * * @param type type of test * @param exception Exception thrown */ void exception(Candidate.CandidateType type, Exception exception); /** * Report that all tests have finished. Nothing will be called after this method. */ void endTests(); } objenesis-2.6/tck/src/main/java/org/objenesis/tck/Candidate.java0000644000175000017500000000373413122236310022747 0ustar apoapo/** * Copyright 2006-2017 the original author or authors. * * 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. */ package org.objenesis.tck; import java.util.Arrays; import java.util.EnumSet; /** * Represents a candidate for instantiation * * @author Henri Tremblay */ public class Candidate implements Comparable { public enum CandidateType { STANDARD, SERIALIZATION, } private final Class clazz; private final String description; private final EnumSet types; public Candidate(Class clazz, String description, CandidateType... types) { this.clazz = clazz; this.description = description; this.types = EnumSet.copyOf(Arrays.asList(types)); } public Class getClazz() { return clazz; } public String getDescription() { return description; } public EnumSet getTypes() { return types; } @Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } Candidate candidate = (Candidate) o; return clazz.equals(candidate.clazz); } @Override public int hashCode() { return clazz.hashCode(); } @Override public int compareTo(Candidate o) { return description.compareTo(o.description); } @Override public String toString() { return clazz.getName() + "[" + description + "]"; } } objenesis-2.6/tck/src/main/resources/0000755000175000017500000000000013122236310015761 5ustar apoapoobjenesis-2.6/tck/src/main/resources/org/0000755000175000017500000000000013122236310016550 5ustar apoapoobjenesis-2.6/tck/src/main/resources/org/objenesis/0000755000175000017500000000000013122236310020531 5ustar apoapoobjenesis-2.6/tck/src/main/resources/org/objenesis/tck/0000755000175000017500000000000013122236310021312 5ustar apoapoobjenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/0000755000175000017500000000000013122236310023411 5ustar apoapoobjenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/standard-candidates.properties0000644000175000017500000000572313122236310031433 0ustar apoapo# # Copyright 2006-2017 the original author or authors. # # 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. # # List of candidate classes to attempt to instantiate in the Objenesis TCK. # Different visibilities of constructor. org.objenesis.tck.candidates.NoConstructor = No constructor org.objenesis.tck.candidates.SerializableNoConstructor = No constructor (serializable) org.objenesis.tck.candidates.DefaultPublicConstructor = Default public constructor org.objenesis.tck.candidates.SerializableDefaultPublicConstructor = Default public constructor (serializable) org.objenesis.tck.candidates.DefaultProtectedConstructor = Default protected constructor org.objenesis.tck.candidates.SerializableDefaultProtectedConstructor = Default protected constructor (serializable) org.objenesis.tck.candidates.DefaultPackageConstructor = Default package constructor org.objenesis.tck.candidates.SerializableDefaultPackageConstructor = Default package constructor (serializable) org.objenesis.tck.candidates.DefaultPrivateConstructor = Default private constructor org.objenesis.tck.candidates.SerializableDefaultPrivateConstructor = Default private constructor (serializable) org.objenesis.tck.candidates.SerializableWithAncestorThrowingException = Serializable with ancestor throwing exception org.objenesis.tck.candidates.SerializableReplacer = Serializable replacing with another class org.objenesis.tck.candidates.SerializableResolver = Serializable resolving to another class # Constructors that work with arguments passed in. org.objenesis.tck.candidates.ConstructorThrowingException = Constructor throwing exception org.objenesis.tck.candidates.SerializableConstructorThrowingException = Constructor throwing exception (serializable) org.objenesis.tck.candidates.ConstructorWithArguments = Constructor with arguments org.objenesis.tck.candidates.SerializableConstructorWithArguments = Constructor with arguments (serializable) org.objenesis.tck.candidates.ConstructorWithMandatoryArguments = Constructor with mandatory arguments org.objenesis.tck.candidates.SerializableConstructorWithMandatoryArguments = Constructor with mandatory arguments (serializable) objenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties0000644000175000017500000000522213122236310032273 0ustar apoapo# # Copyright 2006-2017 the original author or authors. # # 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. # # List of candidate classes to attempt to instantiate in the Objenesis TCK. # Different visibilities of constructor. org.objenesis.tck.candidates.SerializableNoConstructor = No constructor (serializable) org.objenesis.tck.candidates.SerializableDefaultPublicConstructor = Default public constructor (serializable) org.objenesis.tck.candidates.SerializableDefaultProtectedConstructor = Default protected constructor (serializable) org.objenesis.tck.candidates.SerializableDefaultPackageConstructor = Default package constructor (serializable) org.objenesis.tck.candidates.SerializableDefaultPrivateConstructor = Default private constructor (serializable) org.objenesis.tck.candidates.SerializableReplacer = Serializable replacing with another class org.objenesis.tck.candidates.SerializableResolver = Serializable resolving to another class # Constructors that work with arguments passed in. org.objenesis.tck.candidates.SerializableConstructorThrowingException = Constructor throwing exception (serializable) org.objenesis.tck.candidates.SerializableConstructorWithArguments = Constructor with arguments (serializable) org.objenesis.tck.candidates.SerializableConstructorWithMandatoryArguments = Constructor with mandatory arguments (serializable) # Features we want from a Serialization instantiator. org.objenesis.tck.features.SerializableClass = Serializable class calls no constructor org.objenesis.tck.features.ExtendsSerializableClass = Extending a serializable class calls no constructor org.objenesis.tck.features.NotSerializableClass = Not serializable class fail org.objenesis.tck.features.ExtendsNotSerializableParentClass = None-serializable parent no-arg constructor called org.objenesis.tck.features.ReadObjectNotCalled = Serialization special methods not called org.objenesis.tck.features.ReadExternalNotCalled = Externalizable readExternal() not called objenesis-2.6/tck/pom.xml0000644000175000017500000001145613122236310013560 0ustar apoapo 4.0.0 org.objenesis objenesis-parent 2.6 objenesis-tck Objenesis TCK Objenesis' TCK http://objenesis.org 4.11.0 org.objenesis objenesis ${project.version} org.ops4j.pax.exam pax-exam-junit4 ${paxexam.version} test org.osgi org.osgi.core org.ops4j.pax.exam pax-exam-container-native ${paxexam.version} test org.ops4j.pax.exam pax-exam-link-mvn ${paxexam.version} test org.apache.felix org.apache.felix.framework 5.6.4 test ch.qos.logback logback-classic 1.2.3 test com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin maven-remote-resources-plugin maven-jar-plugin org.objenesis.tck.Main maven-shade-plugin false package shade maven-javadoc-plugin jvm-test maven-surefire-plugin specific-jvm test test ${my.jvm} full org.codehaus.mojo exec-maven-plugin false java -jar ${project.build.directory}/${project.build.finalName}.jar test-release integration-test exec objenesis-2.6/.editorconfig0000644000175000017500000000075213122236310014134 0ustar apoapo# EditorConfig helps developers define and maintain consistent # coding styles between different editors and IDEs # editorconfig.org root = true [*] # Change these settings to your own preference indent_style = space indent_size = 3 # We recommend you to keep these unchanged end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false [*.html] indent_size = 2 [*.jsp] indent_size = 2 [*.xml] indent_size = 2