pax_global_header00006660000000000000000000000064125565641320014523gustar00rootroot0000000000000052 comment=522f934b46fccf3a71b005bf17d6b5d660ebd145 objenesis-2.2/000077500000000000000000000000001255656413200133475ustar00rootroot00000000000000objenesis-2.2/.editorconfig000066400000000000000000000007521255656413200160300ustar00rootroot00000000000000# 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 objenesis-2.2/.gitignore000066400000000000000000000003661255656413200153440ustar00rootroot00000000000000target/ 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.2/.travis.yml000066400000000000000000000000721255656413200154570ustar00rootroot00000000000000language: java sudo: false branches: only: - master objenesis-2.2/Benchmarks.md000066400000000000000000000050601255656413200157470ustar00rootroot00000000000000Here 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.2/CONTRIBUTING.md000066400000000000000000000007701255656413200156040ustar00rootroot00000000000000# 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.2/LICENSE.txt000066400000000000000000000261361255656413200152020ustar00rootroot00000000000000 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.2/README.md000066400000000000000000000057341255656413200146370ustar00rootroot00000000000000Objenesis ======== 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 http://objenesis.org. Developer information ===================== Travis status ------------- [![Build Status](https://travis-ci.org/easymock/objenesis.svg?branch=master)](https://travis-ci.org/easymock/objenesis) Environment setup ----------------- I'm using: - Eclipse 4.3.2 (Kepler Service Release 2) - Maven 3.2.3 - IntelliJ 14 Ultimate (thanks to JetBrains for the license) 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 `mvn package -Pbenchmark` ### 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 (to be tested) -------------------------------------------------------------------------------------- `mvn release:prepare -Pfull,all,release` `mvn release:perform -Pfull,all,release` Deploy the website -------------------------------------------------------------------------------------- - Generate it - Copy the result to the gh-pages branch objenesis-2.2/SupportedJVMs.md000066400000000000000000000060371255656413200164240ustar00rootroot00000000000000# List of currently supported JVMs * Sun Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 * OpenJDK 6, 7, 8, 9 * Dalvik API level 8 to 18 (No serialization support for Gingerbread) * Azul Zulu (tested on 1.8.0_45-b14) * BEA JRockit versions 7.0 (1.3.1), 1.4.2 and 1.5 * 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.2/benchmark/000077500000000000000000000000001255656413200153015ustar00rootroot00000000000000objenesis-2.2/benchmark/.settings/000077500000000000000000000000001255656413200172175ustar00rootroot00000000000000objenesis-2.2/benchmark/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000601701255656413200242050ustar00rootroot00000000000000eclipse.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.2/benchmark/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000060261255656413200236720ustar00rootroot00000000000000eclipse.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.2/benchmark/launch.bat000066400000000000000000000002771255656413200172510ustar00rootroot00000000000000mvn clean package echo "Possible filters" echo "org.objenesis.benchmark.CreateObject.*" echo "org.objenesis.benchmark.ConcurrentGetInstantiator.*" java -jar target/benchmarks.jar %* objenesis-2.2/benchmark/launch.sh000077500000000000000000000014571255656413200171210ustar00rootroot00000000000000#!/usr/bin/env bash # # Copyright 2006-2015 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.2/benchmark/pom.xml000066400000000000000000000067531255656413200166310ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 objenesis-benchmark Objenesis Benchmark Objenesis' Benchmark http://objenesis.org 1.6 1.6 1.10.3 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.1 maven-compiler-plugin com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin maven-remote-resources-plugin maven-deploy-plugin true org.apache.maven.plugins maven-shade-plugin 2.4 package shade ${uberjar.name} org.openjdk.jmh.Main *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA objenesis-2.2/benchmark/src/000077500000000000000000000000001255656413200160705ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/000077500000000000000000000000001255656413200170145ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/java/000077500000000000000000000000001255656413200177355ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/java/org/000077500000000000000000000000001255656413200205245ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/java/org/objenesis/000077500000000000000000000000001255656413200225055ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/java/org/objenesis/benchmark/000077500000000000000000000000001255656413200244375ustar00rootroot00000000000000objenesis-2.2/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java000066400000000000000000000067561255656413200325020ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java000066400000000000000000000075671255656413200276530ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/gae/000077500000000000000000000000001255656413200141035ustar00rootroot00000000000000objenesis-2.2/gae/README.md000066400000000000000000000003111255656413200153550ustar00rootroot00000000000000War application to deploy on GAE and test Objenesis =================================================== Dev server ---------- `mvn appengine:devserver` Deployment ---------- `mvn appengine:update` objenesis-2.2/gae/eclipse-launch-profiles/000077500000000000000000000000001255656413200206205ustar00rootroot00000000000000objenesis-2.2/gae/eclipse-launch-profiles/DevAppServer.launch000066400000000000000000000014741255656413200243700ustar00rootroot00000000000000 objenesis-2.2/gae/eclipse-launch-profiles/UpdateApplication.launch000066400000000000000000000014711255656413200254250ustar00rootroot00000000000000 objenesis-2.2/gae/pom.xml000066400000000000000000000112631255656413200154230ustar00rootroot00000000000000 4.0.0 objenesis-parent org.objenesis 2.2 gae war Objenesis GAE War to deploy and test on GAE objenesis 2 1.9.24 0.9.58.v20150505 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-tck ${project.version} ${project.groupId} objenesis 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 2.6 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} true objenesis-2.2/gae/src/000077500000000000000000000000001255656413200146725ustar00rootroot00000000000000objenesis-2.2/gae/src/main/000077500000000000000000000000001255656413200156165ustar00rootroot00000000000000objenesis-2.2/gae/src/main/java/000077500000000000000000000000001255656413200165375ustar00rootroot00000000000000objenesis-2.2/gae/src/main/java/org/000077500000000000000000000000001255656413200173265ustar00rootroot00000000000000objenesis-2.2/gae/src/main/java/org/objenesis/000077500000000000000000000000001255656413200213075ustar00rootroot00000000000000objenesis-2.2/gae/src/main/java/org/objenesis/gae/000077500000000000000000000000001255656413200220435ustar00rootroot00000000000000objenesis-2.2/gae/src/main/java/org/objenesis/gae/JspReporter.java000066400000000000000000000162601255656413200251720ustar00rootroot00000000000000/** * Copyright 2006-2015 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 org.objenesis.Objenesis; import org.objenesis.tck.Reporter; import org.objenesis.tck.TCK; import javax.servlet.jsp.JspWriter; import java.io.PrintWriter; import java.util.*; /** * Reports results from TCK in an HTML table. * * @author Henri Tremblay * @see TCK * @see Reporter */ public class JspReporter implements Reporter { private static class Result { String objenesisDescription; String candidateDescription; boolean result; Exception exception; /** * @param objenesisDescription Description of the tested Objenesis instance * @param candidateDescription Description of the tested candidate * @param result If the test is successful or not * @param exception Exception that might have occured during the test */ public Result(String objenesisDescription, String candidateDescription, boolean result, Exception exception) { this.objenesisDescription = objenesisDescription; this.candidateDescription = candidateDescription; this.result = result; this.exception = exception; } } private final PrintWriter summary; private final PrintWriter log; private long startTime; private long totalTime = 0; private int errorCount = 0; private SortedMap allCandidates = new TreeMap(); private SortedMap allInstantiators = new TreeMap(); private String currentObjenesis; private String currentCandidate; private Map> objenesisResults = new HashMap>(); 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); } public void startTests(String platformDescription, Map allCandidates, Map allInstantiators) { // HT: in case the same reporter is reused, I'm guessing that it will // always be the same platform this.platformDescription = platformDescription; this.allCandidates.putAll(allCandidates); this.allInstantiators.putAll(allInstantiators); for(String desc : allInstantiators.keySet()) { objenesisResults.put(desc, new HashMap()); } startTime = System.currentTimeMillis(); } public void startTest(String candidateDescription, String objenesisDescription) { currentCandidate = candidateDescription; currentObjenesis = objenesisDescription; } public void result(boolean instantiatedObject) { if(!instantiatedObject) { errorCount++; } objenesisResults.get(currentObjenesis).put(currentCandidate, new Result( currentObjenesis, currentCandidate, instantiatedObject, null)); } public void exception(Exception exception) { errorCount++; objenesisResults.get(currentObjenesis).put(currentCandidate, new Result( currentObjenesis, currentCandidate, false, exception)); } public void endTest() { } public void endTests() { totalTime += System.currentTimeMillis() - startTime; } /** * Print the final summary report * * @param parentConstructorTest If the test checking that the none serializable constructor was called was successful */ public void printResult(boolean parentConstructorTest) { // Platform summary.println("

Running TCK on platform: " + platformDescription + "

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

Instantiators used:
"); for(Map.Entry o : allInstantiators.entrySet()) { String inst = ((Objenesis) o.getValue()).getInstantiatorOf(String.class).getClass() .getSimpleName(); summary.println(" " + o.getKey() + ": " + inst + "
"); } summary.println("

"); // Parent constructor special test summary.println("

Not serializable parent constructor called as expected: " + (parentConstructorTest ? 'Y' : 'N')); summary.println("

"); if(!parentConstructorTest) { errorCount++; } Set instantiators = this.allInstantiators.keySet(); Set candidates = this.allCandidates.keySet(); int maxObjenesisWidth = lengthOfLongestStringIn(instantiators); int maxCandidateWidth = lengthOfLongestStringIn(candidates); // Strategy used summary.println(""); for(String desc : instantiators) { summary.print(""); } summary.println(""); List exceptions = new ArrayList(); // Candidates (and keep the exceptions meanwhile) for(String candidateDesc : candidates) { summary.print(""); for(String instDesc : instantiators) { Result result = objenesisResults.get(instDesc).get(candidateDesc); if(result == null) { summary.print(""); } else { summary.print(""); if(result.exception != null) { exceptions.add(result); } } } } summary.println("
" + desc + "
" + candidateDesc + "N/A" + (result.result ? "Y" : "n") + "
"); // Final if(errorCount != 0) { for(Result element : exceptions) { log.println("
--- Candidate '" + element.candidateDescription + "', Instantiator '"
               + element.objenesisDescription + "' ---");
            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

"); } } /** * Return true if the reporter has registered some errors * * @return if there was errors during execution */ public boolean hasErrors() { return errorCount != 0; } private int lengthOfLongestStringIn(Collection descriptions) { int result = 0; for(Iterator it = descriptions.iterator(); it.hasNext();) { result = Math.max(result, it.next().length()); } return result; } } objenesis-2.2/gae/src/main/java/org/objenesis/gae/JspWriterListener.java000066400000000000000000000033101255656413200263420ustar00rootroot00000000000000/** * Copyright 2006-2015 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 org.objenesis.tck.search.SearchWorkingInstantiatorListener; import javax.servlet.jsp.JspWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; /** * @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(), "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(), "KO - " + b.toString())); } catch (IOException e) { throw new RuntimeException(e); } } } objenesis-2.2/gae/src/main/webapp/000077500000000000000000000000001255656413200170745ustar00rootroot00000000000000objenesis-2.2/gae/src/main/webapp/WEB-INF/000077500000000000000000000000001255656413200201235ustar00rootroot00000000000000objenesis-2.2/gae/src/main/webapp/WEB-INF/appengine-web.xml000066400000000000000000000017621255656413200233740ustar00rootroot00000000000000 ${app.id} ${app.version} true objenesis-2.2/gae/src/main/webapp/WEB-INF/logging.properties000066400000000000000000000020461255656413200236710ustar00rootroot00000000000000# # Copyright 2006-2015 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.2/gae/src/main/webapp/WEB-INF/web.xml000066400000000000000000000016101255656413200214200ustar00rootroot00000000000000 objenesis-2.2/gae/src/main/webapp/index.jsp000066400000000000000000000046141255656413200207260ustar00rootroot00000000000000<%-- Copyright 2006-2015 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" language="java" %> <%@ page import="main.java.org.objenesis.gae.JspReporter" %> <%@ page import="main.java.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" %> <%@ page import="java.io.PrintWriter" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.TreeMap" %> 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 { boolean result = Main.run(reporter); reporter.printResult(result); } catch(Exception e) { out.println("
");
    e.printStackTrace(new PrintWriter(out));
    out.println("
"); } %> objenesis-2.2/header.txt000066400000000000000000000011351255656413200153400ustar00rootroot00000000000000Copyright ${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.2/main/000077500000000000000000000000001255656413200142735ustar00rootroot00000000000000objenesis-2.2/main/.settings/000077500000000000000000000000001255656413200162115ustar00rootroot00000000000000objenesis-2.2/main/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000601701255656413200231770ustar00rootroot00000000000000eclipse.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.2/main/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000060701255656413200226630ustar00rootroot00000000000000eclipse.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.2/main/assembly.xml000066400000000000000000000023101255656413200166300ustar00rootroot00000000000000 bin zip ${project.build.outputDirectory}/META-INF / NOTICE LICENSE ${project.build.directory} / *.jar objenesis-2.2/main/pom.xml000066400000000000000000000046571255656413200156240ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 objenesis Objenesis A library for instantiating Java objects http://objenesis.org com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin org.apache.maven.plugins maven-remote-resources-plugin org.apache.felix maven-bundle-plugin true COM.jrockit.reflect;resolution:=optional, jrockit.vm;resolution:=optional, COM.newmonics.PercClassloader;resolution:=optional, sun.misc;resolution:=optional, sun.reflect;resolution:=optional release org.apache.maven.plugins maven-assembly-plugin false assembly.xml make-assembly package single objenesis-2.2/main/src/000077500000000000000000000000001255656413200150625ustar00rootroot00000000000000objenesis-2.2/main/src/main/000077500000000000000000000000001255656413200160065ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/000077500000000000000000000000001255656413200167275ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/000077500000000000000000000000001255656413200175165ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/000077500000000000000000000000001255656413200214775ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/Objenesis.java000066400000000000000000000030411255656413200242610ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/ObjenesisBase.java000066400000000000000000000067461255656413200250730ustar00rootroot00000000000000/** * Copyright 2006-2015 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.concurrent.ConcurrentHashMap; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.InstantiatorStrategy; /** * 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(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.2/main/src/main/java/org/objenesis/ObjenesisException.java000066400000000000000000000026701255656413200261470ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/ObjenesisHelper.java000066400000000000000000000056421255656413200254320ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/ObjenesisSerializer.java000066400000000000000000000030061255656413200263140ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/ObjenesisStd.java000066400000000000000000000027301255656413200247400ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/instantiator/000077500000000000000000000000001255656413200242165ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java000066400000000000000000000017111255656413200306670ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java000066400000000000000000000035601255656413200334420ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/instantiator/android/000077500000000000000000000000001255656413200256365ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java000066400000000000000000000037461255656413200326340ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java000066400000000000000000000055401255656413200326350ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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.) */ 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.2/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java000066400000000000000000000054241255656413200326370ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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); } } } AndroidSerializationInstantiator.java000066400000000000000000000054341255656413200351460ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/android/** * Copyright 2006-2015 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; /** * {@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.) */ 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.2/main/src/main/java/org/objenesis/instantiator/basic/000077500000000000000000000000001255656413200252775ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java000066400000000000000000000023321255656413200325770ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ public class AccessibleInstantiator extends ConstructorInstantiator { public AccessibleInstantiator(Class type) { super(type); if(constructor != null) { constructor.setAccessible(true); } } } objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ClassDefinitionUtils.java000066400000000000000000000213461255656413200322470ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /* * Copyright 2003,2004 The Apache Software Foundation * * 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. */ import org.objenesis.ObjenesisException; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; /** * 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(); } }); AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { Class loader = Class.forName("java.lang.ClassLoader"); // JVM crash w/o this DEFINE_CLASS = loader.getDeclaredMethod("defineClass", new Class[]{ String.class, byte[].class, Integer.TYPE, Integer.TYPE, ProtectionDomain.class }); DEFINE_CLASS.setAccessible(true); } catch (ClassNotFoundException e) { throw new ObjenesisException(e); } catch (NoSuchMethodException e) { throw new ObjenesisException(e); } return null; } }); } /** * 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 { Object[] args = new Object[]{className, b, new Integer(0), new Integer(b.length), PROTECTION_DOMAIN }; Class c = (Class) DEFINE_CLASS.invoke(loader, args); // 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.2/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java000066400000000000000000000030731255656413200330720ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java000066400000000000000000000022351255656413200321150ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * The instantiator that always throws an exception. Mainly used for tests * * @author Henri Tremblay */ public class FailingInstantiator implements ObjectInstantiator { public FailingInstantiator(Class type) { } /** * @return Always throwing an exception */ public T newInstance() { throw new ObjenesisException("Always failing"); } } objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java000066400000000000000000000024531255656413200327640ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * The simplest instantiator - simply calls Class.newInstance(). This can deal with default public * constructors, but that's about it. * * @author Joe Walnes * @see ObjectInstantiator */ 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.2/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java000066400000000000000000000020451255656413200314550ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * The instantiator that always return a null instance * * @author Henri Tremblay */ public class NullInstantiator implements ObjectInstantiator { public NullInstantiator(Class type) { } /** * @return Always null */ public T newInstance() { return null; } } objenesis-2.2/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java000066400000000000000000000132141255656413200341450ustar00rootroot00000000000000/** * Copyright 2006-2015 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 java.io.*; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java000066400000000000000000000044071255656413200341170ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java000066400000000000000000000145031255656413200323640ustar00rootroot00000000000000/** * Copyright 2006-2015 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 java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import static org.objenesis.instantiator.basic.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} shoud make it work * * @author Henri Tremblay */ 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.2/main/src/main/java/org/objenesis/instantiator/gcj/000077500000000000000000000000001255656413200247615ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java000066400000000000000000000031251255656413200306300ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java000066400000000000000000000043351255656413200314270ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java000066400000000000000000000032401255656413200333640ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/jrockit/000077500000000000000000000000001255656413200256635ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/jrockit/JRockitLegacyInstantiator.java000066400000000000000000000046651255656413200336330ustar00rootroot00000000000000/** * COPYRIGHT & LICENSE * * This code is Copyright (c) 2006 BEA Systems, inc. It is provided free, as-is and without any warranties for the purpose of * inclusion in Objenesis or any other open source project with a FSF approved license, as long as this notice is not * removed. There are no limitations on modifying or repackaging the code apart from this. * * BEA does not guarantee that the code works, and provides no support for it. Use at your own risk. * * Originally developed by Leonardo Mesquita. Copyright notice added by Henrik Ståhl, BEA JRockit Product Manager. * */ package org.objenesis.instantiator.jrockit; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; /** * Instantiates a class by making a call to internal JRockit private methods. It is only supposed to * work on JRockit 1.4.2 JVMs prior to release R25.1. From release R25.1 on, JRockit supports * sun.reflect.ReflectionFactory, making this "trick" unnecessary. This instantiator will not call * any constructors. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator * @see org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator */ public class JRockitLegacyInstantiator implements ObjectInstantiator { private static Method safeAllocObjectMethod = null; private static void initialize() { if(safeAllocObjectMethod == null) { Class memSystem; try { memSystem = Class.forName("jrockit.vm.MemSystem"); safeAllocObjectMethod = memSystem.getDeclaredMethod("safeAllocObject", new Class[] {Class.class}); safeAllocObjectMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(ClassNotFoundException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } private final Class type; public JRockitLegacyInstantiator(Class type) { initialize(); this.type = type; } public T newInstance() { try { return type.cast(safeAllocObjectMethod.invoke(null, type)); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-2.2/main/src/main/java/org/objenesis/instantiator/perc/000077500000000000000000000000001255656413200251475ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java000066400000000000000000000037261255656413200313130ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java000066400000000000000000000067611255656413200340530ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ 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.2/main/src/main/java/org/objenesis/instantiator/sun/000077500000000000000000000000001255656413200250235ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java000066400000000000000000000234571255656413200313210ustar00rootroot00000000000000/** * Copyright 2006-2015 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.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.basic.ClassDefinitionUtils; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import static org.objenesis.instantiator.basic.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 */ public class MagicInstantiator 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_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); } 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("sun/reflect/MagicAccessorImpl"); // 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(); } } objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java000066400000000000000000000062071255656413200331430ustar00rootroot00000000000000/** * Copyright 2006-2015 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); } } } SunReflectionFactoryInstantiator.java000066400000000000000000000040761255656413200343260ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/** * Copyright 2006-2015 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; /** * 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 */ 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); } } } SunReflectionFactorySerializationInstantiator.java000066400000000000000000000047631255656413200370670ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/instantiator/sun/** * Copyright 2006-2015 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; /** * 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 */ public class SunReflectionFactorySerializationInstantiator implements ObjectInstantiator { private final Constructor mungedConstructor; public SunReflectionFactorySerializationInstantiator(Class type) { Class nonSerializableAncestor = SerializationInstantiatorHelper .getNonSerializableSuperClass(type); Constructor nonSerializableAncestorConstructor; try { nonSerializableAncestorConstructor = nonSerializableAncestor .getConstructor((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.2/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java000066400000000000000000000037041255656413200330430ustar00rootroot00000000000000/** * Copyright 2006-2015 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.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import sun.misc.Unsafe; import java.lang.reflect.Field; /** * Instantiates an object, WITHOUT calling it's constructor, using * sun.misc.Unsafe.allocateInstance(). Unsafe and its methods are implemented by most * modern JVMs. * * @author Henri Tremblay * @see ObjectInstantiator */ @SuppressWarnings("restriction") public class UnsafeFactoryInstantiator implements ObjectInstantiator { private static Unsafe unsafe; private final Class type; public UnsafeFactoryInstantiator(Class type) { if (unsafe == null) { 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); } } this.type = type; } public T newInstance() { try { return type.cast(unsafe.allocateInstance(type)); } catch (InstantiationException e) { throw new ObjenesisException(e); } } }objenesis-2.2/main/src/main/java/org/objenesis/strategy/000077500000000000000000000000001255656413200233415ustar00rootroot00000000000000objenesis-2.2/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java000066400000000000000000000016041255656413200312020ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java000066400000000000000000000022101255656413200304010ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/strategy/PlatformDescription.java000066400000000000000000000124131255656413200301750ustar00rootroot00000000000000/** * Copyright 2006-2015 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(); /** 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); } public static boolean isGoogleAppEngine() { return getGaeRuntimeVersion() != 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.2/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java000066400000000000000000000060121255656413200326060ustar00rootroot00000000000000/** * Copyright 2006-2015 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 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 java.io.NotSerializableException; import java.io.Serializable; 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)) { if(isGoogleAppEngine()) { return new ObjectInputStreamInstantiator(type); } return new ObjectStreamClassInstantiator(type); } else if(JVM_NAME.startsWith(DALVIK)) { 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 ObjectStreamClassInstantiator(type); } } objenesis-2.2/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java000066400000000000000000000046211255656413200315530ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java000066400000000000000000000105541255656413200310660ustar00rootroot00000000000000/** * Copyright 2006-2015 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.jrockit.JRockitLegacyInstantiator; 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)) { if(PlatformDescription.isGoogleAppEngine()) { 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(JROCKIT)) { if(VM_VERSION.startsWith("1.4")) { // JRockit vendor version will be RXX where XX is the version // Versions prior to 26 need special handling // From R26 on, java.vm.version starts with R if(!VENDOR_VERSION.startsWith("R")) { // On R25.1 and R25.2, ReflectionFactory should work. Otherwise, we must use the // Legacy instantiator. if(VM_INFO == null || !VM_INFO.startsWith("R25.1") || !VM_INFO.startsWith("R25.2")) { return new JRockitLegacyInstantiator(type); } } } // After that, JRockit became compliant with HotSpot return new SunReflectionFactoryInstantiator(type); } else if(PlatformDescription.isThisJVM(DALVIK)) { 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 and higher (hopefully) return new Android18Instantiator(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.2/main/src/test/000077500000000000000000000000001255656413200160415ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/000077500000000000000000000000001255656413200167625ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/android/000077500000000000000000000000001255656413200204025ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/android/os/000077500000000000000000000000001255656413200210235ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/android/os/Build.java000066400000000000000000000016171255656413200227320ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/test/java/org/000077500000000000000000000000001255656413200175515ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/000077500000000000000000000000001255656413200215325ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/ClassReader.java000066400000000000000000000253551255656413200245770ustar00rootroot00000000000000/** * Copyright 2006-2015 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.basic.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.2/main/src/test/java/org/objenesis/EmptyClass.java000066400000000000000000000015651255656413200244700ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/test/java/org/objenesis/ExternalizableTest.java000066400000000000000000000026131255656413200262100ustar00rootroot00000000000000/** * Copyright 2006-2015 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.Test; import java.io.*; import java.util.ArrayList; /** * This test makes sure an issue mentioned is not occurring. * @author Henri Tremblay */ public class ExternalizableTest { public static class A extends ArrayList implements Externalizable { public A() { } 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); // This call should work because the ArrayList constructor as been called. This is required by A implementing Externalizable a.add("Test"); } } objenesis-2.2/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java000066400000000000000000000034671255656413200270470ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/test/java/org/objenesis/ObjenesisTest.java000066400000000000000000000046721255656413200251670ustar00rootroot00000000000000/** * Copyright 2006-2015 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; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.InstantiatorStrategy; /** * @author Henri Tremblay */ public class ObjenesisTest { @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 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.2/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java000066400000000000000000000023011255656413200301110ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/test/java/org/objenesis/instantiator/000077500000000000000000000000001255656413200242515ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/instantiator/basic/000077500000000000000000000000001255656413200253325ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/instantiator/basic/ClassDefinitionUtilsTest.java000066400000000000000000000036501255656413200331400ustar00rootroot00000000000000/** * Copyright 2006-2015 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.Test; import static org.junit.Assert.*; /** * @author Henri Tremblay */ public class ClassDefinitionUtilsTest { String className = "org.objenesis.EmptyClass"; @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/EmptyClass", actual); } @Test public void testClassNameToResource() { String actual = ClassDefinitionUtils.classNameToResource(className); assertEquals("org/objenesis/EmptyClass.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.2/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java000066400000000000000000000023451255656413200332600ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/main/src/test/java/org/objenesis/instantiator/sun/000077500000000000000000000000001255656413200250565ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java000066400000000000000000000024651255656413200322100ustar00rootroot00000000000000/** * Copyright 2006-2015 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.Ignore; import org.junit.Test; import org.objenesis.EmptyClass; import org.objenesis.instantiator.ObjectInstantiator; import static org.junit.Assert.*; /** * @author Henri Tremblay */ @Ignore("Won't work on every JVM") public class MagicInstantiatorTest { @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()); } } objenesis-2.2/main/src/test/java/org/objenesis/strategy/000077500000000000000000000000001255656413200233745ustar00rootroot00000000000000objenesis-2.2/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java000066400000000000000000000030161255656413200310670ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/objenesis-formatting.xml000066400000000000000000000747511255656413200202400ustar00rootroot00000000000000 objenesis-2.2/pom.xml000066400000000000000000000402171255656413200146700ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 pom Objenesis parent project A library for instantiating Java objects http://objenesis.org 2006 3.1.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.2 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.5 1.5 maven-jar-plugin true 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.9 maven-assembly-plugin 2.5.3 maven-compiler-plugin 3.2 maven-jar-plugin 2.5 maven-surefire-plugin 2.18.1 maven-clean-plugin 2.6.1 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.2 maven-resources-plugin 2.7 maven-site-plugin 3.4 maven-source-plugin 2.4 maven-javadoc-plugin 2.10.2 org.apache.felix maven-bundle-plugin 2.5.3 bundle-manifest prepare-package manifest 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/** src/main/java/org/objenesis/instantiator/jrockit/*.java dependency-reduced-pom.xml eclipse_config/** website/** **/*.bat project.properties lint.xml gen/** bin/** **/*.txt ${project.inceptionYear} ${year}
check check
org.apache.maven.plugins maven-remote-resources-plugin 1.5 process org.apache:apache-jar-resource-bundle:1.3 org.codehaus.mojo versions-maven-plugin 2.1 org.codehaus.mojo findbugs-maven-plugin 3.0.1 true Naming org.eclipse.m2e lifecycle-mapping 1.0.0 com.keyboardsamurais.maven maven-timestamp-plugin [1.0,) create org.apache.maven.plugins maven-remote-resources-plugin [1.0,) process org.codehaus.mojo findbugs-maven-plugin [2.5.5,) findbugs
org.apache.maven.plugins maven-project-info-reports-plugin 2.8 org.codehaus.mojo findbugs-maven-plugin 3.0.1 org.apache.maven.plugins maven-pmd-plugin 3.4 1.5 bintray JFrog Bintray https://api.bintray.com/maven/easymock/maven/objenesis full org.apache.maven.plugins maven-source-plugin attach-sources jar org.apache.maven.plugins maven-javadoc-plugin attach-javadocs jar org.codehaus.mojo findbugs-maven-plugin findbugs findbugs 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.2/settings-example.xml000066400000000000000000000006361255656413200173670ustar00rootroot00000000000000 sonatype-nexus-snapshots myusername mypassword sonatype-nexus-staging myusername mypassword objenesis-2.2/tck-android/000077500000000000000000000000001255656413200155465ustar00rootroot00000000000000objenesis-2.2/tck-android/.gitignore000066400000000000000000000001751255656413200175410ustar00rootroot00000000000000bin/ gen/ target/ .classpath .project org.eclipse.m2e.core.prefs org.eclipse.core.resources.prefs org.eclipse.pde.core.prefs objenesis-2.2/tck-android/.settings/000077500000000000000000000000001255656413200174645ustar00rootroot00000000000000objenesis-2.2/tck-android/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000576671255656413200244730ustar00rootroot00000000000000eclipse.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.2/tck-android/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000053331255656413200241370ustar00rootroot00000000000000eclipse.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.2/tck-android/lint.xml000066400000000000000000000000651255656413200172370ustar00rootroot00000000000000 objenesis-2.2/tck-android/pom.xml000066400000000000000000000111201255656413200170560ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 objenesis-tck-android Objenesis Android TCK Objenesis' TCK built for Android devices apk ${env.ANDROID_HOME} ${project.groupId} objenesis-tck ${project.version} ${project.groupId} objenesis 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.3.0 true org.objenesis.tck.android android.test.InstrumentationTestRunner maven-compiler-plugin 1.5 1.5 com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin org.apache.maven.plugins maven-remote-resources-plugin com.simpligility.maven.plugins android-maven-plugin 18 true org.codehaus.mojo exec-maven-plugin 1.3.2 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.2/tck-android/project.properties000066400000000000000000000000431255656413200213270ustar00rootroot00000000000000# Project target. target=android-8 objenesis-2.2/tck-android/src/000077500000000000000000000000001255656413200163355ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/000077500000000000000000000000001255656413200172615ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/AndroidManifest.xml000066400000000000000000000030101255656413200230440ustar00rootroot00000000000000 objenesis-2.2/tck-android/src/main/java/000077500000000000000000000000001255656413200202025ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/java/org/000077500000000000000000000000001255656413200207715ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/java/org/objenesis/000077500000000000000000000000001255656413200227525ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/java/org/objenesis/tck/000077500000000000000000000000001255656413200235335ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/java/org/objenesis/tck/android/000077500000000000000000000000001255656413200251535ustar00rootroot00000000000000objenesis-2.2/tck-android/src/main/java/org/objenesis/tck/android/ObjenesisTest.java000066400000000000000000000055651255656413200306120ustar00rootroot00000000000000/** * Copyright 2006-2015 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 java.util.Map; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; import org.objenesis.tck.Main; import org.objenesis.tck.Reporter; 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 String currentObjenesis; private String currentCandidate; public void startTests(String platformDescription, Map allCandidates, Map allInstantiators) { } public void startTest(String candidateDescription, String objenesisDescription) { currentCandidate = candidateDescription; currentObjenesis = objenesisDescription; } public void endObjenesis(String description) { } public void endTests() { } public void exception(Exception exception) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); out.println("Exception when instantiating " + currentCandidate + " with " + currentObjenesis + ": "); exception.printStackTrace(out); fail(buffer.toString()); } public void result(boolean instantiatedObject) { assertTrue("Instantiating " + currentCandidate + " with " + currentObjenesis + " failed", instantiatedObject); } public void endTest() { } } @SmallTest public void testObjenesisStd() throws Exception { Main.runStandardTest(new ObjenesisStd(), new JUnitReporter()); } @SmallTest public void testObjenesisSerializer() throws Exception { Main.runSerializerTest(new ObjenesisSerializer(), new JUnitReporter()); } @SmallTest public void testObjenesisSerializerParentConstructorCalled() throws Exception { boolean result = Main.runParentConstructorTest(new ObjenesisSerializer()); assertTrue(result); } }objenesis-2.2/tck-android/src/main/java/org/objenesis/tck/android/TckInstrumentation.java000066400000000000000000000035611255656413200316700ustar00rootroot00000000000000/** * Copyright 2006-2015 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); boolean result = Main.run(reporter); reporter.printResult(result); } } objenesis-2.2/tck/000077500000000000000000000000001255656413200141305ustar00rootroot00000000000000objenesis-2.2/tck/.settings/000077500000000000000000000000001255656413200160465ustar00rootroot00000000000000objenesis-2.2/tck/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000601701255656413200230340ustar00rootroot00000000000000eclipse.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.2/tck/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000060261255656413200225210ustar00rootroot00000000000000eclipse.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.2/tck/pom.xml000066400000000000000000000134021255656413200154450ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 objenesis-tck Objenesis TCK Objenesis' TCK http://objenesis.org 1.2.17 1.2.1 1.7.12 org.objenesis objenesis ${project.version} org.springframework.osgi spring-osgi-test ${spring.osgi.version} test org.springframework.osgi spring-osgi-annotation ${spring.osgi.version} test org.springframework.osgi spring-osgi-extender ${spring.osgi.version} test org.slf4j jcl-over-slf4j ${slf4j.version} test org.slf4j slf4j-api ${slf4j.version} test org.slf4j slf4j-log4j12 ${slf4j.version} test log4j log4j ${log4j.version} test org.eclipse org.eclipse.osgi 3.8.0.v20120529-1548 test src/test/resources true com.keyboardsamurais.maven maven-timestamp-plugin com.mycila.maven-license-plugin maven-license-plugin org.apache.maven.plugins maven-remote-resources-plugin org.apache.maven.plugins maven-jar-plugin org.objenesis.tck.Main org.apache.maven.plugins maven-shade-plugin 2.4.1 false package shade org.apache.maven.plugins maven-javadoc-plugin jvm-test maven-surefire-plugin specific-jvm test test ${my.jvm} full org.codehaus.mojo exec-maven-plugin 1.3.2 false java -jar ${project.build.directory}/${project.build.finalName}.jar test-release integration-test exec objenesis-2.2/tck/src/000077500000000000000000000000001255656413200147175ustar00rootroot00000000000000objenesis-2.2/tck/src/main/000077500000000000000000000000001255656413200156435ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/000077500000000000000000000000001255656413200165645ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/000077500000000000000000000000001255656413200173535ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/000077500000000000000000000000001255656413200213345ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/000077500000000000000000000000001255656413200221155ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/CandidateLoader.java000066400000000000000000000077671255656413200260040ustar00rootroot00000000000000/** * Copyright 2006-2015 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; /** * 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 */ public class CandidateLoader { private final TCK tck; private final ClassLoader classloader; private final ErrorHandler errorHandler; /** * Handler for reporting errors from the CandidateLoader. */ 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 tck TCK that will use the candidates * @param classloader ClassLoader from which candidates classes are loaded * @param errorHandler Handler called in case of error */ public CandidateLoader(TCK tck, ClassLoader classloader, ErrorHandler errorHandler) { this.tck = tck; this.classloader = classloader; this.errorHandler = errorHandler; } /** * @param inputStream Stream containing the properties * @throws IOException If something goes wrong while reading the stream */ public void loadFrom(InputStream inputStream) 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 TCK (which retains order). Properties properties = new Properties() { private static final long serialVersionUID = 1L; @Override public Object put(Object key, Object value) { handlePropertyEntry((String) key, (String) value); return null; } }; properties.load(inputStream); } /** * Load a candidate property file * * @param cls Class on which getResourceAsStream is called * @param resource File name * @throws IOException If there's problem reading the file */ public void loadFromResource(Class cls, String resource) throws IOException { InputStream candidatesConfig = cls.getResourceAsStream(resource); if(candidatesConfig == null) { throw new IOException("Resource '" + resource + "' not found relative to " + cls.getName()); } try { loadFrom(candidatesConfig); } finally { candidatesConfig.close(); } } private void handlePropertyEntry(String key, String value) { try { Class candidate = Class.forName(key, true, classloader); tck.registerCandidate(candidate, value); } catch(ClassNotFoundException e) { errorHandler.classNotFound(key); } } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/Main.java000066400000000000000000000117051255656413200236500ustar00rootroot00000000000000/** * Copyright 2006-2015 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; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; import java.io.IOException; import java.io.Serializable; /** * Command line launcher for Technology Compatibility Kit (TCK). * * @author Joe Walnes * @see TCK */ public class Main { private static class MockSuperClass { private final boolean superConstructorCalled; public MockSuperClass() { superConstructorCalled = true; } public boolean isSuperConstructorCalled() { return superConstructorCalled; } } private static class MockClass extends MockSuperClass implements Serializable { private static final long serialVersionUID = 1L; private final boolean constructorCalled; @SuppressWarnings("unused") public MockClass() { constructorCalled = true; } public boolean isConstructorCalled() { return constructorCalled; } } /** * 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); boolean result = run(reporter); reporter.printResult(result); if(reporter.hasErrors()) { System.exit(1); } } /** * Run the full test suite using standard Objenesis instances * * @param reporter result are recorded in the reporter * @return if the parent constructor test was successful */ public static boolean run(Reporter reporter) { runStandardTest(new ObjenesisStd(), reporter); runSerializerTest(new ObjenesisSerializer(), reporter); boolean result = runParentConstructorTest(new ObjenesisSerializer()); return result; } /** * Run the serializing suite on the provided Objenesis instance * * @param reporter result are recorded in the reporter * @param objenesis Objenesis instance to test */ public static void runSerializerTest(Objenesis objenesis, Reporter reporter) { runTest(objenesis, reporter, "Objenesis serializer", "candidates/serializable-candidates.properties"); } /** * Run the standard suite on the provided Objenesis instance * * @param reporter result are recorded in the reporter * @param objenesis Objenesis instance to test */ public static void runStandardTest(Objenesis objenesis, Reporter reporter) { runTest(objenesis, reporter, "Objenesis std", "candidates/candidates.properties"); } /** * A special test making sure the first none serializable class no-args constructor is called * * @param objenesis Objenesis instance to test * @return if the test was successful */ public static boolean runParentConstructorTest(Objenesis objenesis) { try { Object result = objenesis.newInstance(MockClass.class); MockClass mockObject = (MockClass) result; return mockObject.isSuperConstructorCalled() && !mockObject.isConstructorCalled(); } catch(Exception e) { System.err.println("--- Not serializable parent constructor called as expected ---"); e.printStackTrace(System.err); return false; } } /** * Run a suite of tests (candidates) on the Objenesis instance, sending the results to the * reporter * * @param objenesis Objenesis instance to test * @param reporter result are recorded in the reporter * @param description description of the ran suite * @param candidates property file containing a list of classes to test (key) and their * description (value) */ public static void runTest(Objenesis objenesis, Reporter reporter, String description, String candidates) { TCK tck = new TCK(); tck.registerObjenesisInstance(objenesis, description); CandidateLoader candidateLoader = new CandidateLoader(tck, Main.class.getClassLoader(), new CandidateLoader.LoggingErrorHandler(System.err)); try { candidateLoader.loadFromResource(Main.class, candidates); } catch(IOException e) { throw new RuntimeException(e); } tck.runTests(reporter); } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/Reporter.java000066400000000000000000000051301255656413200245610ustar00rootroot00000000000000/** * Copyright 2006-2015 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.Map; /** * Reports results from the TCK back to the user. *

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

* *
 * startTests(startObjenesis(result | exception) * endObjenesis) * endTests
 * 
* * @author Joe Walnes * @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 allCandidates Descriptions (String) of all candidates (Object) being used in tests. * @param allObjenesisInstances Descriptions (String) of all Objenesis instances (Object) being * used in tests. */ void startTests(String platformDescription, Map allCandidates, Map allObjenesisInstances); /** * Report that a test between a candidate and an objenesis instance if about to start. * * @param candidateDescription Description of the candidate class. * @param objenesisDescription Description of the objenesis instance. */ void startTest(String candidateDescription, String objenesisDescription); /** * Report details about what happened when an Objenesis instance tried to instantiate the current * candidate. * * @param instantiatedObject Whether the ObjectInstantiator successfully instantiated the * candidate class. */ void result(boolean instantiatedObject); /** * Report that something bad happened during the test. * * @param exception Exception thrown by instantiator. */ void exception(Exception exception); /** * Report that tests have been completed for a particular Objenesis instance and candidate. */ void endTest(); /** * Report that all tests have finished. Nothing will be called after this method. */ void endTests(); } objenesis-2.2/tck/src/main/java/org/objenesis/tck/TCK.java000066400000000000000000000116621255656413200234070ustar00rootroot00000000000000/** * Copyright 2006-2015 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; import org.objenesis.strategy.PlatformDescription; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Technology Compatibility Kit (TCK) for {@link Objenesis}s. *

* This TCK accepts a set of candidate classes (class it attempts to instantiate) and a set of * Objenesis implementations. It then tries instantiating every candidate with every Objenesis * implementations, reporting the results to a {@link Reporter}. * *

Example usage

* *
 * TCK tck = new TCK();
 * // register candidate classes.
 * tck.registerCandidate(SomeClass.class, "A basic class");
 * tck.registerCandidate(SomeEvil.class, "Something evil");
 * tck.registerCandidate(NotEvil.class, "Something nice");
 * // register Objenesis instances.
 * tck.registerObjenesisInstance(new ObjenesisStd(), "Objenesis");
 * tck.registerObjenesisInstance(new ObjenesisSerializaer(), "Objenesis for serialization");
 * // go!
 * Reporter reporter = new TextReporter(System.out, System.err);
 * tck.runTests(reporter);
 * 
* * @author Joe Walnes * @see org.objenesis.instantiator.ObjectInstantiator * @see Reporter * @see Main */ public class TCK { private final List objenesisInstances = new ArrayList(); private final List> candidates = new ArrayList>(); private final Map descriptions = new HashMap(); /** * 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) { candidates.add(candidateClass); descriptions.put(candidateClass, description); } /** * Register an Objenesis instance to use when attempting to instantiate a class. * * @param objenesis Tested Objenesis instance * @param description Description of the Objenesis instance */ public void registerObjenesisInstance(Objenesis objenesis, String description) { objenesisInstances.add(objenesis); descriptions.put(objenesis, description); } /** * Run all TCK tests. * * @param reporter Where to report the results of the test to. */ public void runTests(Reporter reporter) { reporter.startTests(describePlatform(), findAllDescriptions(candidates, descriptions), findAllDescriptions(objenesisInstances, descriptions)); for(Class candidateClass : candidates) { String candidateDescription = descriptions.get(candidateClass); for(Objenesis objenesis : objenesisInstances) { String objenesisDescription = descriptions.get(objenesis); reporter.startTest(candidateDescription, objenesisDescription); runTest(reporter, candidateClass, objenesis); reporter.endTest(); } } reporter.endTests(); } private void runTest(Reporter reporter, Class candidate, Objenesis objenesis) { try { Object instance = objenesis.newInstance(candidate); boolean success = instance != null && instance.getClass() == candidate; reporter.result(success); } catch(Exception e) { reporter.exception(e); } } /** * Return the human readable description for list of TCK items (Objenesis instances or test * candidates) * * @param keys list of items for which we are searching for a description * @param descriptions all descriptions * @return map of items with their description. Will contain one entry per entry in the original * key list */ private Map findAllDescriptions(List keys, Map descriptions) { Map results = new HashMap(keys.size()); for(Object o : keys) { results.put(descriptions.get(o), o); } return results; } /** * 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.2/tck/src/main/java/org/objenesis/tck/TextReporter.java000066400000000000000000000172611255656413200254360ustar00rootroot00000000000000/** * Copyright 2006-2015 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; import java.io.PrintStream; import java.util.*; /** * Reports results from TCK as tabulated text, suitable for dumping to the console or a file and * being read by a human. It can be reused to provide a summary reports of different candidates as * long as the same objenesisDescription is not used twice. * * @author Joe Walnes * @author Henri Tremblay * @see TCK * @see Reporter */ public class TextReporter implements Reporter { private static class Result { String objenesisDescription; String candidateDescription; boolean result; Exception exception; /** * @param objenesisDescription Description of the tested Objenesis instance * @param candidateDescription Description of the tested candidate * @param result If the test is successful or not * @param exception Exception that might have occured during the test */ public Result(String objenesisDescription, String candidateDescription, boolean result, Exception exception) { this.objenesisDescription = objenesisDescription; this.candidateDescription = candidateDescription; this.result = result; this.exception = exception; } } private final PrintStream summary; private final PrintStream log; private long startTime; private long totalTime = 0; private int errorCount = 0; private SortedMap allCandidates = new TreeMap(); private SortedMap allInstantiators = new TreeMap(); private String currentObjenesis; private String currentCandidate; private Map> objenesisResults = new HashMap>(); 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; } public void startTests(String platformDescription, Map allCandidates, Map allInstantiators) { // HT: in case the same reporter is reused, I'm guessing that it will // always be the same platform this.platformDescription = platformDescription; this.allCandidates.putAll(allCandidates); this.allInstantiators.putAll(allInstantiators); for(String desc : allInstantiators.keySet()) { objenesisResults.put(desc, new HashMap()); } startTime = System.currentTimeMillis(); } public void startTest(String candidateDescription, String objenesisDescription) { currentCandidate = candidateDescription; currentObjenesis = objenesisDescription; } public void result(boolean instantiatedObject) { if(!instantiatedObject) { errorCount++; } objenesisResults.get(currentObjenesis).put(currentCandidate, new Result( currentObjenesis, currentCandidate, instantiatedObject, null)); } public void exception(Exception exception) { errorCount++; objenesisResults.get(currentObjenesis).put(currentCandidate, new Result( currentObjenesis, currentCandidate, false, exception)); } public void endTest() { } public void endTests() { totalTime += System.currentTimeMillis() - startTime; } /** * Print the final summary report * * @param parentConstructorTest If the test checking that the none serializable constructor was called was successful */ public void printResult(boolean parentConstructorTest) { // Platform summary.println("Running TCK on platform: " + platformDescription); summary.println(); // Instantiator implementations summary.println("Instantiators used: "); for(Map.Entry o : allInstantiators.entrySet()) { String inst = ((Objenesis) o.getValue()).getInstantiatorOf(String.class).getClass() .getSimpleName(); summary.println(" " + o.getKey() + ": " + inst); } summary.println(); // Parent constructor special test summary.println("Not serializable parent constructor called as expected: " + (parentConstructorTest ? 'Y' : 'N')); summary.println(); if(!parentConstructorTest) { errorCount++; } Set instantiators = this.allInstantiators.keySet(); Set candidates = this.allCandidates.keySet(); int maxObjenesisWidth = lengthOfLongestStringIn(instantiators); int maxCandidateWidth = lengthOfLongestStringIn(candidates); // Strategy used summary.print(pad("", maxCandidateWidth) + ' '); for(String desc : instantiators) { summary.print(pad(desc, maxObjenesisWidth) + ' '); } summary.println(); List exceptions = new ArrayList(); // Candidates (and keep the exceptions meanwhile) for(String candidateDesc : candidates) { summary.print(pad(candidateDesc, maxCandidateWidth) + ' '); for(String instDesc : instantiators) { Result result = objenesisResults.get(instDesc).get(candidateDesc); if(result == null) { summary.print(pad("N/A", maxObjenesisWidth) + " "); } else { summary.print(pad(result.result ? "Y" : "n", maxObjenesisWidth) + " "); if(result.exception != null) { exceptions.add(result); } } } summary.println(); } summary.println(); // Final if(errorCount != 0) { for(Result element : exceptions) { log.println("--- Candidate '" + element.candidateDescription + "', Instantiator '" + element.objenesisDescription + "' ---"); 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"); } 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(Iterator it = descriptions.iterator(); it.hasNext();) { result = Math.max(result, it.next().length()); } return result; } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/000077500000000000000000000000001255656413200242145ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java000066400000000000000000000015411255656413200330060ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java000066400000000000000000000017561255656413200321370ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java000066400000000000000000000016201255656413200340040ustar00rootroot00000000000000/** * Copyright 2006-2015 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"); } } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java000066400000000000000000000014051255656413200321650ustar00rootroot00000000000000/** * Copyright 2006-2015 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() { } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java000066400000000000000000000014151255656413200322450ustar00rootroot00000000000000/** * Copyright 2006-2015 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() { } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java000066400000000000000000000014231255656413200325630ustar00rootroot00000000000000/** * Copyright 2006-2015 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() { } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java000066400000000000000000000014121255656413200320460ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java000066400000000000000000000013211255656413200276760ustar00rootroot00000000000000/** * Copyright 2006-2015 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 { } SerializableConstructorThrowingException.java000066400000000000000000000017471255656413200352660ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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"); } } SerializableConstructorWithArguments.java000066400000000000000000000021641255656413200344010ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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; } } SerializableConstructorWithMandatoryArguments.java000066400000000000000000000020261255656413200362550ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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"); } } } SerializableDefaultPackageConstructor.java000066400000000000000000000016131255656413200344360ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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() { } } SerializableDefaultPrivateConstructor.java000066400000000000000000000016231255656413200345160ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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() { } } SerializableDefaultProtectedConstructor.java000066400000000000000000000016311255656413200350340ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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() { } } SerializableDefaultPublicConstructor.java000066400000000000000000000016201255656413200343170ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java000066400000000000000000000015071255656413200322330ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java000066400000000000000000000016731255656413200311520ustar00rootroot00000000000000/** * Copyright 2006-2015 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(); } } objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java000066400000000000000000000016721255656413200312150ustar00rootroot00000000000000/** * Copyright 2006-2015 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(); } } SerializableWithAncestorThrowingException.java000066400000000000000000000017021255656413200353420ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/candidates/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/search/000077500000000000000000000000001255656413200233625ustar00rootroot00000000000000objenesis-2.2/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java000066400000000000000000000106521255656413200273400ustar00rootroot00000000000000/** * Copyright 2006-2015 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 Class loadClass(String className) { try { return Class.forName(className); } catch (ClassNotFoundException e) { throw new RuntimeException("Unexpected ClassNotFoundException loading class '" + className + "'"); } } 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(loadClass(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(loadClass(className)); } } } public static SortedSet> getClassesForPackage(Package pkg) { return getClassesForPackage(pkg, ClassEnumerator.class.getClassLoader()); } public static SortedSet> getClassesForPackage(Package pkg, ClassLoader classLoader) { SortedSet> classes = new TreeSet>(new Comparator>() { public int compare(Class o1, Class o2) { return o1.getSimpleName().compareTo(o2.getSimpleName()); } }); 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.2/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java000066400000000000000000000055371255656413200314050ustar00rootroot00000000000000/** * Copyright 2006-2015 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.*; /** * 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();) { Class c = it.next(); 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.2/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java000066400000000000000000000015221255656413200331010ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java000066400000000000000000000021101255656413200277010ustar00rootroot00000000000000/** * Copyright 2006-2015 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 class SystemOutListener implements SearchWorkingInstantiatorListener { private static final String PATTERN = "%-50s: %s%n"; public void instantiatorSupported(Class c) { System.out.printf(PATTERN, c.getSimpleName(), "Working!"); } public void instantiatorUnsupported(Class c, Throwable t) { System.out.printf(PATTERN, c.getSimpleName(), "KO - " + t); } } objenesis-2.2/tck/src/main/resources/000077500000000000000000000000001255656413200176555ustar00rootroot00000000000000objenesis-2.2/tck/src/main/resources/org/000077500000000000000000000000001255656413200204445ustar00rootroot00000000000000objenesis-2.2/tck/src/main/resources/org/objenesis/000077500000000000000000000000001255656413200224255ustar00rootroot00000000000000objenesis-2.2/tck/src/main/resources/org/objenesis/tck/000077500000000000000000000000001255656413200232065ustar00rootroot00000000000000objenesis-2.2/tck/src/main/resources/org/objenesis/tck/candidates/000077500000000000000000000000001255656413200253055ustar00rootroot00000000000000objenesis-2.2/tck/src/main/resources/org/objenesis/tck/candidates/candidates.properties000066400000000000000000000057231255656413200315310ustar00rootroot00000000000000# # Copyright 2006-2015 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.2/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties000066400000000000000000000037441255656413200341760ustar00rootroot00000000000000# # Copyright 2006-2015 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) objenesis-2.2/tck/src/test/000077500000000000000000000000001255656413200156765ustar00rootroot00000000000000objenesis-2.2/tck/src/test/java/000077500000000000000000000000001255656413200166175ustar00rootroot00000000000000objenesis-2.2/tck/src/test/java/org/000077500000000000000000000000001255656413200174065ustar00rootroot00000000000000objenesis-2.2/tck/src/test/java/org/objenesis/000077500000000000000000000000001255656413200213675ustar00rootroot00000000000000objenesis-2.2/tck/src/test/java/org/objenesis/tck/000077500000000000000000000000001255656413200221505ustar00rootroot00000000000000objenesis-2.2/tck/src/test/java/org/objenesis/tck/CandidateLoaderTest.java000066400000000000000000000101121255656413200266510ustar00rootroot00000000000000/** * Copyright 2006-2015 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 static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.IOException; import org.junit.Before; import org.junit.Test; /** * @author Joe Walnes */ public class CandidateLoaderTest { private StringBuilder recordedEvents; private CandidateLoader candidateLoader; @Before public void setUp() throws Exception { recordedEvents = new StringBuilder(); TCK tck = new TCK() { @Override public void registerCandidate(Class candidateClass, String description) { recordedEvents.append("registerCandidate('").append(candidateClass).append("', '") .append(description).append("')\n"); } }; CandidateLoader.ErrorHandler errorHandler = new CandidateLoader.ErrorHandler() { public void classNotFound(String name) { recordedEvents.append("classNotFound('").append(name).append("')\n"); } }; candidateLoader = new CandidateLoader(tck, getClass().getClassLoader(), errorHandler); } @Test public void testReadsClassesAndDescriptionsFromPropertiesFile() throws IOException { String input = "" + "org.objenesis.tck.CandidateLoaderTest$A = A candidate\n" + "\n" + "# a comment and some whitespace\n" + "\n" + "org.objenesis.tck.CandidateLoaderTest$B = B candidate\n" + "org.objenesis.tck.CandidateLoaderTest$C = C candidate\n"; candidateLoader.loadFrom(new ByteArrayInputStream(input.getBytes())); assertEquals("" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$A', 'A candidate')\n" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$B', 'B candidate')\n" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$C', 'C candidate')\n", recordedEvents.toString()); } @Test public void testReportsMissingClassesToErrorHandler() throws IOException { String input = "" + "org.objenesis.tck.CandidateLoaderTest$A = A candidate\n" + "org.objenesis.tck.CandidateLoaderTest$NonExistant = Dodgy candidate\n" + "org.objenesis.tck.CandidateLoaderTest$C = C candidate\n"; candidateLoader.loadFrom(new ByteArrayInputStream(input.getBytes())); assertEquals("" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$A', 'A candidate')\n" + "classNotFound('org.objenesis.tck.CandidateLoaderTest$NonExistant')\n" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$C', 'C candidate')\n", recordedEvents.toString()); } @Test public void testLoadsFromResourceInClassPath() throws IOException { // See CandidateLoaderTest-sample.properties. candidateLoader.loadFromResource(getClass(), "CandidateLoaderTest-sample.properties"); assertEquals("" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$A', 'A candidate')\n" + "registerCandidate('class org.objenesis.tck.CandidateLoaderTest$B', 'B candidate')\n", recordedEvents.toString()); } @Test public void testThrowsIOExceptionIfResourceNotInClassPath() throws IOException { try { candidateLoader.loadFromResource(getClass(), "Blatently-Bogus.properties"); fail("Expected exception"); } catch(IOException expectedException) { // Good! } } // Sample classes. public static class A { } public static class B { } public static class C { } } objenesis-2.2/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java000066400000000000000000000054621255656413200256030ustar00rootroot00000000000000/** * Copyright 2006-2015 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 static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.Map; import org.junit.Test; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; /** * 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 String currentObjenesis; private String currentCandidate; public void startTests(String platformDescription, Map allCandidates, Map allInstantiators) { } public void startTest(String candidateDescription, String objenesisDescription) { currentCandidate = candidateDescription; currentObjenesis = objenesisDescription; } public void endObjenesis(String description) { } public void endTests() { } public void exception(Exception exception) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); out.println("Exception when instantiating " + currentCandidate + " with " + currentObjenesis + ": "); exception.printStackTrace(out); fail(buffer.toString()); } public void result(boolean instantiatedObject) { assertTrue("Instantiating " + currentCandidate + " with " + currentObjenesis + " failed", instantiatedObject); } public void endTest() { } } @Test public void testObjenesisStd() throws Exception { Main.runStandardTest(new ObjenesisStd(), new JUnitReporter()); } @Test public void testObjenesisSerializer() throws Exception { Main.runSerializerTest(new ObjenesisSerializer(), new JUnitReporter()); } @Test public void testObjenesisSerializerParentConstructorCalled() throws Exception { boolean result = Main.runParentConstructorTest(new ObjenesisSerializer()); assertTrue(result); } } objenesis-2.2/tck/src/test/java/org/objenesis/tck/OsgiTest.java000066400000000000000000000063221255656413200245570ustar00rootroot00000000000000/** * Copyright 2006-2015 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 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 org.objenesis.Objenesis; import org.objenesis.ObjenesisHelper; import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests; import org.w3c.dom.Document; /** * @author Henri Tremblay */ public class OsgiTest extends AbstractConfigurableBundleCreatorTests implements Serializable { private static final long serialVersionUID = 1L; @Override protected String[] getTestBundlesNames() { String version = getImplementationVersion(Objenesis.class); // 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 and hope the Maven // jar is up-to-date in the local repository 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 new String[] {"org.objenesis, objenesis, " + version}; } public void testCanInstantiate() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newInstance(getClass()).getClass()); } public void testCanInstantiateSerialize() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newSerializableInstance(getClass()).getClass()); } protected String getImplementationVersion(final Class c) { return c.getPackage().getImplementationVersion(); } } objenesis-2.2/tck/src/test/java/org/objenesis/tck/TCKTest.java000066400000000000000000000132541255656413200243010ustar00rootroot00000000000000/** * Copyright 2006-2015 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 static org.junit.Assert.*; import java.util.Map; import org.junit.Test; import org.objenesis.Objenesis; import org.objenesis.instantiator.ObjectInstantiator; /** * @author Joe Walnes * @author Henri Tremblay */ public class TCKTest { public static class StubbedInstantiator1 implements Objenesis { public T newInstance(Class clazz) { return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } public static class StubbedInstantiator2 implements Objenesis { public T newInstance(Class clazz) { return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } @Test public void testReportsAllCandidatesAndInstantiatorCombinationsToReporter() { // Given... a TCK with some candidate classes: A, B and C. TCK tck = new TCK(); tck.registerCandidate(CandidateA.class, "Candidate A"); tck.registerCandidate(CandidateB.class, "Candidate B"); tck.registerCandidate(CandidateC.class, "Candidate C"); // And... two ObjectInstantiators registered tck.registerObjenesisInstance(new StubbedInstantiator1(), "Instantiator1"); tck.registerObjenesisInstance(new StubbedInstantiator2(), "Instantiator2"); // When... the TCK tests are run Reporter reporter = new RecordingReporter(); tck.runTests(reporter); // Expect... the reporter to have received a sequence of calls // notifying it of what the TCK is doing. assertEquals("" + "startTests()\n" + "startTest('Candidate A', 'Instantiator1')\n" + "result(false)\n" + "endTest()\n" + "startTest('Candidate A', 'Instantiator2')\n" + "result(false)\n" + "endTest()\n" + "startTest('Candidate B', 'Instantiator1')\n" + "result(false)\n" + "endTest()\n" + "startTest('Candidate B', 'Instantiator2')\n" + "result(false)\n" + "endTest()\n" + "startTest('Candidate C', 'Instantiator1')\n" + "result(false)\n" + "endTest()\n" + "startTest('Candidate C', 'Instantiator2')\n" + "result(false)\n" + "endTest()\n" + "endTests()\n", reporter.toString()); } @Test public void testReportsSuccessIfCandidateCanBeInstantiated() { // Given... a TCK with some candidate classes: A, B and C. TCK tck = new TCK(); tck.registerCandidate(CandidateA.class, "Candidate A"); tck.registerCandidate(CandidateB.class, "Candidate B"); // And... a single ObjectInsantiator registered that can instantiate // A but not B. tck.registerObjenesisInstance(new SelectiveInstantiator(), "instantiator"); // When... the TCK tests are run Reporter reporter = new RecordingReporter(); tck.runTests(reporter); // Expect... the reporter to be notified that A succeeded // but B failed. assertEquals("" + "startTests()\n" + "startTest('Candidate A', 'instantiator')\n" + // A "result(true)\n" + // true "endTest()\n" + "startTest('Candidate B', 'instantiator')\n" + // B "result(false)\n" + // false "endTest()\n" + "endTests()\n", reporter.toString()); } // Some sample classes used for testing. public static class SelectiveInstantiator implements Objenesis { public T newInstance(Class clazz) { return clazz.cast(clazz == CandidateA.class ? new CandidateA() : null); } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } public static class CandidateA { } public static class CandidateB { } public static class CandidateC { } /** * 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(); public void startTests(String platformDescription, Map allCandidates, Map allInstantiators) { log.append("startTests()\n"); } public void startTest(String candidateDescription, String objenesisDescription) { log.append("startTest('").append(candidateDescription).append("', '").append( objenesisDescription).append("')\n"); } public void result(boolean instantiatedObject) { log.append("result(").append(instantiatedObject).append(")\n"); } public void exception(Exception exception) { log.append("exception()\n"); } public void endTest() { log.append("endTest()\n"); } public void endTests() { log.append("endTests()\n"); } @Override public String toString() { return log.toString(); } } } objenesis-2.2/tck/src/test/java/org/objenesis/tck/TextReporterTest.java000066400000000000000000000107541255656413200263310ustar00rootroot00000000000000/** * Copyright 2006-2015 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.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.instantiator.basic.NullInstantiator; import org.objenesis.strategy.SingleInstantiatorStrategy; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.HashMap; import java.util.Map; 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() { Map candidates = new HashMap(); candidates.put("candidate A", "A"); candidates.put("candidate B", "B"); candidates.put("candidate C", "C"); Map instantiators = new HashMap(); Objenesis instantiator1 = new ObjenesisBase(new SingleInstantiatorStrategy( ConstructorInstantiator.class)); Objenesis instantiator2 = new ObjenesisBase(new SingleInstantiatorStrategy( FailingInstantiator.class)); Objenesis instantiator3 = new ObjenesisBase(new SingleInstantiatorStrategy( NullInstantiator.class)); instantiators.put("instantiator1", instantiator1); instantiators.put("instantiator2", instantiator2); instantiators.put("instantiator3", instantiator3); textReporter.startTests("Some platform", candidates, instantiators); textReporter.startTest("candidate A", "instantiator1"); textReporter.result(false); textReporter.startTest("candidate A", "instantiator2"); textReporter.result(false); textReporter.startTest("candidate A", "instantiator3"); textReporter.result(true); textReporter.startTest("candidate B", "instantiator1"); textReporter.result(true); textReporter.startTest("candidate B", "instantiator2"); textReporter.result(false); textReporter.startTest("candidate B", "instantiator3"); textReporter.result(true); textReporter.startTest("candidate C", "instantiator1"); textReporter.exception(new RuntimeException("Problem")); textReporter.startTest("candidate C", "instantiator2"); textReporter.result(false); textReporter.startTest("candidate C", "instantiator3"); textReporter.result(true); textReporter.endTests(); textReporter.printResult(true); 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(" instantiator1: ConstructorInstantiator"); out.println(" instantiator2: FailingInstantiator"); out.println(" instantiator3: NullInstantiator"); out.println(); out.println("Not serializable parent constructor called as expected: Y"); out.println(); out.println(" instantiator1 instantiator2 instantiator3 "); out.println("candidate A n n Y "); out.println("candidate B Y n Y "); out.println("candidate C n n Y "); out.println(); out.println("--- FAILED: 5 error(s) occured ---"); out.println(); assertEquals(expectedSummaryBuffer.toString(), summaryBuffer.toString()); } } objenesis-2.2/tck/src/test/resources/000077500000000000000000000000001255656413200177105ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/log4j.properties000066400000000000000000000016011255656413200230430ustar00rootroot00000000000000# # Copyright 2006-2015 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. # log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout.ConversionPattern=%p [%c] - %m%n log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.rootCategory=WARN, stdout # Uncomment to add logs #log4j.logger.org.easymock.itests.OsgiTest=TRACE, stdout objenesis-2.2/tck/src/test/resources/org/000077500000000000000000000000001255656413200204775ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/objenesis/000077500000000000000000000000001255656413200224605ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/objenesis/tck/000077500000000000000000000000001255656413200232415ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/objenesis/tck/CandidateLoaderTest-sample.properties000066400000000000000000000013471255656413200325060ustar00rootroot00000000000000# # Copyright 2006-2015 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.CandidateLoaderTest$A = A candidate org.objenesis.tck.CandidateLoaderTest$B = B candidateobjenesis-2.2/tck/src/test/resources/org/springframework/000077500000000000000000000000001255656413200237175ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/springframework/osgi/000077500000000000000000000000001255656413200246605ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/springframework/osgi/test/000077500000000000000000000000001255656413200256375ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/springframework/osgi/test/internal/000077500000000000000000000000001255656413200274535ustar00rootroot00000000000000objenesis-2.2/tck/src/test/resources/org/springframework/osgi/test/internal/boot-bundles.properties000066400000000000000000000075301255656413200341730ustar00rootroot00000000000000# # Copyright 2006-2015 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. # # START OF EDITION # This file is loaded by org.springframework.osgi.test.AbstractDependencyManagerTests. The # original file is located in spring-osgi-test-1.2.1.jar. Changes to the original are tagged # with "EDITED" # END OF EDITION # # Properties file indicating the boot (or mandatory) bundles that are loaded # by the testing framework. # # Normally, this file should not be edited since it is used by the testing infrastructure. # Users that want to install bundles before starting a test, should use #bundles() method. # # # format: =+/-15 # - the optional value is used to install/remove bundles if running on JDK >= 1.5 # - see Spring org.springframework.core.JdkVersion for jdk major version codes. # elements that have to be ignored should star with # ignore # Note: inner placeholders are not supported. # # common properties # # versioning ignore.backport.version=3.1.0 ignore.junit.version=3.8.2 # EDITED: Upgrade the version from 1.2.15-SNAPSHOT to ${log4j.version} ignore.log4j.version=${log4j.version} ignore.spring.version=2.5.6.SEC01 # EDITED: Filter the version to match the pom ignore.spring.osgi.version=${spring.osgi.version} # EDITED: Upgraded from 1.5.0 ignore.slf4j.version=${slf4j.version} ignore.asm.version=2.2.3 # groupIds ignore.spring.groupId=org.springframework ignore.spring.osgi.groupId=org.springframework.osgi ignore.slf4j.groupId=org.slf4j # EDITED: Switch from org.springframework.osgi to log4j ignore.log4j.groupId=log4j # # actual libraries # # listed in dependency order to ease deployment # dependencies # junit org.junit,com.springsource.junit,${ignore.junit.version}= # log4j # EDITED: Change the groupId for log4j ${ignore.log4j.groupId},log4j,${ignore.log4j.version}= # slf4j (commons-logging API) #${ignore.slf4j.groupId},slf4j-api,${ignore.slf4j.version}= #${ignore.slf4j.groupId},slf4j-log4j12,${ignore.slf4j.version}= #${ignore.slf4j.groupId},jcl104-over-slf4j,${ignore.slf4j.version}= # slf4j (BRITS) # EDITED: Change the groupId for and artifactId ${ignore.slf4j.groupId},slf4j-api,${ignore.slf4j.version}= ${ignore.slf4j.groupId},slf4j-log4j12,${ignore.slf4j.version}= ${ignore.slf4j.groupId},jcl-over-slf4j,${ignore.slf4j.version}= # aop alliance org.aopalliance,com.springsource.org.aopalliance,1.0.0= # asm org.objectweb.asm,com.springsource.org.objectweb.asm,${ignore.asm.version}= # backport concurrent edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,${ignore.backport.version}=-15 # spring libs ${ignore.spring.groupId},org.springframework.beans,${ignore.spring.version}= ${ignore.spring.groupId},org.springframework.core,${ignore.spring.version}= ${ignore.spring.groupId},org.springframework.context,${ignore.spring.version}= ${ignore.spring.groupId},org.springframework.aop,${ignore.spring.version}= ${ignore.spring.groupId},org.springframework.test,${ignore.spring.version}= # spring osgi libs ${ignore.spring.osgi.groupId},spring-osgi-io,${ignore.spring.osgi.version}= ${ignore.spring.osgi.groupId},spring-osgi-core,${ignore.spring.osgi.version}= ${ignore.spring.osgi.groupId},spring-osgi-annotation,${ignore.spring.osgi.version}=+15 ${ignore.spring.osgi.groupId},spring-osgi-extender,${ignore.spring.osgi.version}= ${ignore.spring.osgi.groupId},spring-osgi-test,${ignore.spring.osgi.version}= objenesis-2.2/website/000077500000000000000000000000001255656413200150115ustar00rootroot00000000000000objenesis-2.2/website/.project000066400000000000000000000017421255656413200164640ustar00rootroot00000000000000 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.2/website/.settings/000077500000000000000000000000001255656413200167275ustar00rootroot00000000000000objenesis-2.2/website/.settings/org.eclipse.core.resources.prefs000066400000000000000000000007571255656413200251530ustar00rootroot00000000000000eclipse.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.2/website/pom.xml000066400000000000000000000064631255656413200163370ustar00rootroot00000000000000 4.0.0 org.objenesis objenesis-parent 2.2 objenesis-website Objenesis website pom 2.2 apidocs org.objenesis objenesis ${project.version} 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.2/website/site/000077500000000000000000000000001255656413200157555ustar00rootroot00000000000000objenesis-2.2/website/site/content/000077500000000000000000000000001255656413200174275ustar00rootroot00000000000000objenesis-2.2/website/site/content/acknowledgements.html000066400000000000000000000053351255656413200236550ustar00rootroot00000000000000 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

  • Joe Walnes
  • Henri Tremblay
  • Leonardo Mesquita

To contact the developers, please use the discussion group.

Contributors

Supporting Services

objenesis-2.2/website/site/content/details.html000066400000000000000000000164331255656413200217510ustar00rootroot00000000000000 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 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 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 (for JVM 1.4 and more) the real exception. It is a RuntimeException so you don't have to catch it. Some reasons why it fails:

  • Using ObjenesisSerializer with a class that isn't Serializable.
  • Using ObjenesisSerializer, the constructor of the first parent class that isn't Serializable throws an exception.
  • Your SecurityManager prevents Objenesis from working normally.
  • Objenesis isn't able to work for some reason. Please tell us

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

  • You want to specialize for a given JVM. Default strategies are supporting all JVMs. This has a little performance cost so you might want to provide a strategy that is optimized for your JVM.
    public class Sun14Strategy implements InstantiatorStrategy {
        public ObjectInstantiator newInstantiatorOf(Class type) {
            // return sun dedicated instantiator
            return new SunReflectionFactoryInstantiator(type);
        }
    }
    
  • Objenesis doesn't support your environment by default. In that case, we would be really happy to add this support in our next version and meanwhile, you can use your own strategy and instantiator to fix this.

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:

  • Some instantiators are made to mimic the Java serialization. It means they will call the default constructor of the first non-serializable class
  • Some instantiators only works if the class is serialiable
  • Some instantiators will in fact call the default constructor
  • Depending on your security manager, classes coming from a low level class loader might not be instantiable

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);
objenesis-2.2/website/site/content/download.html000066400000000000000000000032321255656413200221240ustar00rootroot00000000000000 Download

Current version is ${project.version}

Older versions can be found here

objenesis-2.2/website/site/content/embedding.html000066400000000000000000000057271255656413200222460ustar00rootroot00000000000000 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.2/website/site/content/index.html000066400000000000000000000073561255656413200214370ustar00rootroot00000000000000 About

Objenesis is a small Java library that serves one purpose:

  • To instantiate a new object of a particular class.

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:

  • Constructors that require arguments.
  • Constructors that have side effects.
  • Constructors that throw exceptions.

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:

  • Serialization, Remoting and Persistence - Objects need to be instantiated and restored to a specific state, without invoking code.
  • Proxies, AOP Libraries and Mock Objects - Classes can be subclassed without needing to worry about the super() constructor.
  • Container Frameworks - Objects can be dynamically instantatiated in non-standard ways.

Getting Started

  1. Download objenesis-${project.version}.jar.
  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.2/website/site/content/license.html000066400000000000000000000042501255656413200217400ustar00rootroot00000000000000 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.2/website/site/content/notes.html000066400000000000000000000051001255656413200214410ustar00rootroot00000000000000 Release notes

Version 2.2 (2015-07-24)

  • New SearchWorkingInstantiator allowing to identify which instantiator can work on a platform (#34)
  • JVM_NAME is used instead of VENDOR (#32)
  • sun.misc missing from Import-Package header in manifest (#31)
  • New ProxyInstantiator extending a class to bypass the super constructor (#23)
  • New MagicInstantiator using MagicAccessorImpl (#35)
  • Partial Google App Engine support. See here (#15)

Version 2.1 (2013-10-10)

  • Support for Android API level 18 (#23)
  • Have the tck returning a value different from zero in case of failures (#24)
  • Make it easier to call the TCK programmatically (#25)
  • Show the actual instantiator implementation used by the TCK (#26)
  • Explicit support for OpenJDK (#27)

Version 2.0 (2013-08-21)

  • Upgrade to Java 5 (#21)
  • Remove synchronization requirement when retrieving an instantiator from cache (#22)

Version 1.4 (2013-08-16)

  • Android Gingerbread support (#18)
  • New instantiator using Unsafe.allocateInstance() (#19)
  • Optimisation when instantiator cache isn't used (#14)

Version 1.3 (2013-01-23)

  • Dalvik (Android) support (#13)
  • Android TCK (#13)
  • Allow to compile on any JVM (#13)

Version 1.2 (2010-03-15)

  • Now under Apache 2.0 license
  • objenesis.jar is an OSGi bundle

Version 1.1 (2007-12-09)

  • Standard support of Aonix PERC (no Serialization support)

Version 1.0 (2007-02-14)

  • Initial version, support for Sun Hotspot, GCJ and BEA JRockit JVMs
objenesis-2.2/website/site/content/sitemap.xml000066400000000000000000000022421255656413200216130ustar00rootroot00000000000000
Objenesis index.html license.html download.html
Documentation tutorial.html details.html embedding.html
Project Details support.html acknowledgements.html source.html notes.html
objenesis-2.2/website/site/content/source.html000066400000000000000000000015711255656413200216210ustar00rootroot00000000000000 Source Repository

The source repository for Objenesis is hosted by GitHub.

objenesis-2.2/website/site/content/support.html000066400000000000000000000017651255656413200220420ustar00rootroot00000000000000 Getting Support objenesis-2.2/website/site/content/tutorial.html000066400000000000000000000101461255656413200221620ustar00rootroot00000000000000 Twenty Second Tutorial

There are two main interfaces in Objenesis:

  • ObjectInstantiator - Instantiates multiple instances of a single class.
    interface ObjectInstantiator {
      Object newInstance();
    }
  • InstantiatorStrategy - A particular strategy for how to instantiate a class (as this differs for different types of classes).
    interface InstantiatorStrategy {
      ObjectInstantiator newInstantiatorOf(Class type);
    }

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:

  • Stardard - No constructor will be called
  • Serializable compliant - Acts like an object instantiated by java standard serialization. It means that the constructor of the first non-serializable parent class will be called. However, readResolve is not called and we never check if the object is serializable.

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.2/website/site/resources/000077500000000000000000000000001255656413200177675ustar00rootroot00000000000000objenesis-2.2/website/site/resources/.nojekyll000066400000000000000000000000001255656413200216050ustar00rootroot00000000000000objenesis-2.2/website/site/resources/CNAME000066400000000000000000000000171255656413200205330ustar00rootroot00000000000000objenesis.org objenesis-2.2/website/site/resources/googlefda9c590a38fa17b.html000066400000000000000000000012511255656413200244320ustar00rootroot00000000000000 google-site-verification: googlefda9c590a38fa17b.htmlobjenesis-2.2/website/site/resources/objenesis-logo.png000066400000000000000000000137511255656413200234230ustar00rootroot00000000000000PNG  IHDRHHUG pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F IDATx{pTǿnȋLdXZ`ci-3:B;(Έ"vJ;ꔶvDњV>R @(D=>D3sgwws~Z&!4h 1@_&!d!#4>@6f8`Pc͌]gΜٺnݺ $d,T('wu֭[W=!)q wgx`FqRUssww")5R9؊eje0 }(goj9sP,6;G1$oYdLP T2T3Oݣ@2h{W8'r'uEG;h0Pw*Yƀ B$+E[Czm$sL43 ,-{oIbf1|P۶# <|Z1cf+cǎɧOݻr9&nHl65?eeejfySܼA$>{>Ny@G=Rz"#xάh$(li(+#wzh/8>P + #{On + Ys0{;*RF!C FScIld R$VYHQTQIHc8u~ 7N:8rHA\\2 *F#8fiUd9)g-*ʵ[vN*R]^lVWIEET +*"a0E4JAU1 0$&?Z u-m۶Y/]Rz)gO.rFx"pgU_vJ/AI};sGASZ Ζ-[JV\Y-IVH &07:Ʉ\L)$3L&xzl<+L,oM0AN[[[[hѢY}c+։HAk^C ۈ%'_͓^3*f.5JqPR0_(Cx{l6j%{P (fCBLl! q{w8 ËXvLj>Zп#jD׀eO9TY`7}g ;7e@aշaBM<0Ο%P,#*e\Eތ}%@kxGy^ȂrX쩞N9gdv,y>|vхQ[xS@3YKPtDD5ս}Oxx)hGU); ߬JUWZ8sι٘9 ©M+ $Ɩ_z}3!t"Ik6jysϜ=ư۱g_҄H(u׼8 qR98E{.7}<~T`?4q@/ܤutf#&h2pe1UUU͛74w1'pc-))GCfO@b*sO"Rпv4,mӦME饥wJ$g}Q 4(I.]лtA_c>>%I?\~_{{^mmaÆx)#pCWϔ6m2̛7oO]]]QaGOX7O9czeee2}˜BoaPH51ǣɿEl-'w5k&M,Xʯ6v)9XjA5'j_RH|3ܴU5kC/W‚%FB@*Xai^u RIz $ˬдVN;i JISԩ=av+I*IRH`Zi7}H/I0کk񈟫#.xN9A%)޼ *I_z pSU 8Ѵ^jis!FGTMهP ҃ʶj 3|3yxNYF=dxp!tAQl"g'";?〤t",a9H5?!8i:e@} $ R1ժBbE 'M)'CŴkI[1ͭī#pR:e#d n vÓd&I 'uGL,YA.\t~aU $K,Ԁ*TNRV \PVYƿYAI&3դg:QruEтҚd>({6/jʲ[0ʦQF2'0Dp]Dp+Wk)@⢄V d ؉K'^ޙxh5P%u!Ȍh6L hdЭV@b!0MM{'2IfeJm(l'F ,>3{lI+蟳"#蠓9xRҳ6 J )&@@+Y: &H"HiK$+rPIENDB`objenesis-2.2/website/site/resources/objenesis.png000066400000000000000000000346461255656413200224730ustar00rootroot00000000000000PNG  IHDR1PrgAMA abKGDC oFFs(F pHYs  tIME 2 IDATx]w`n:, i"b!vEx`A"(MA)BQbB@B Bz6e1wv&!缷ݙs=\>a#վ@A_S+gIX7h1@_^(:vby (b؝/0%ê'&u'A BuE\ 2o ]E!L\\Ώ)!SCBy6[yk;c)s $ȲzbBv9t!IJ ɫ.ގbyP B (A(3R^w$%Q{f5P,rfofoš ! xyZ7eL?ȠBʰX,yv𕣔X,  󻉄PRX,K mub,Kltӏ,rHlᖛ< L]l&<:B\ Do]C<)pҶDE_ casiN2Esp#ƅ)F/QY$"%y{- y', cGN@p$H?SrF$~,SLAFxhF` ?Pr`|tbŪwp$i۳ čG~^@~()*OjН-IReUPbG [(U.eHX,wB32sbڴi?un8ZHJ(K%Ȑ by\]\N;}収GYK%y뷌i3[v|8TlJ䵷8v2F:>J@}dz:wp顿CupV] ~О_ 7<@2!?e i I P7P|C#l;/&jα Q':~e5]f+3#8MERJV~zO+?;W3}TJ~Px7 07zKh<|W;=/\LULH(([?R,ZXGwV/V `b6@7vRo6Ø<2lz0B ΖzSߑ)%.PJ@}Ke`gB\n9#JYVPE1l<V7_=wJRFyjc7'VQܴ}nMˬhNӨ"2Ve)g&tU ݡ}8]7$ҰEQ\i]rSX{ `5/UbKk.\ة/ڳaÆ6#U{ },Pa#H嶒\@no{E2˕?qĿ@n]Ѣe lٲP9 /9p3:B^G8l@('dš'Hg6syRNhLY&}`p4$[pN'XYfuFe ՐP 2Ƞ+ZuE1k $[,&j S@}1ZJ#ӥ%WH$N40: F=Ӗ7e9k7Gd2$GuL䖁1WE{eWvѽyENxws4lVÿEq܊(O]2/piWv)h46ޟsk\.Swcl9/R5֧:lڳGDQܨ7%>{Jil}%\KnwPCx<{(漶սB?f| պy(&͘%>\ M\J]C OV̢Ao־#u6]KˇȲ djځ^[4>ac?Z")T$@@V8Ͽt#wTKg0Ez/SMϐj2S?|?8O{LO]N(S~|^ɖ$i멛{>ܓ J-Vݹe?rsAA@&85wl`uEQܩisAOVVH}2~#R^Ӎs%A bg0=Byb-xҞM{0@Odn|#;cbyY[?w0.PYdឞP,xG e*|Aց?#t<-7Μܓ3 ~GB|73n3Coh!?%?=CyZhެyiwgLt隩A1u~"zAgZʃRL~&w?>uιğv6wsSJ쿇ʟ~JoN.-s$$n 9rdӺu#nٲ)ℱ_L,11Ѧ9C{1FuWGy:a;^vZPP;]$׉P Jz2k \CAǂ啅ꓡw\}us% 'sllAO3OMyM%=r.(&eQ<;BW-nQW*X,ubYpAg)kPBT޽;~z'T>N\wCs.Z-j9'#9"#=QI wΏnsM 8($bU3ط7=bcc sҩY!}2A8@V, YBe&(n$ՙ%&gEcn7UrЅ3qY@Nz[Q{p&f<Xt9YVv:&xf&0pn?7ULt$򋛉{pejөiyV]ݮxAdA7U#Q"ؼJjz@h1 )0?NA|yZ1 J(ΤV8dP4?,vz~ B<3D#P3KAEưQmbRSAw1YzG)(>lF<-OX.MBqT&?1n9k:^Ð Z&7+ҒO|@^{9ՠDQDnY{ sH!BL($&"s_ŏ,Y_<`uJaq9\9-橯B.qʐDQ7/}﯀ɔeg'7OEqޜYX*!0\sڌ5!^Q}BI;vKݻ-iyMiD9E(-㟜n\rB]`1i,q_'/+V}LjaX:Yi7aĝ}A{A٨,΁*˙o@繋!/|w7#o(Ӗ/(D4ީ.}(Y! RTT[̡C'jz!.(nk"sV6c漧6*i2VͯEsmTRk^eBt(EYda_w<*ƥC9dU N}'ჺքO'"nery:Zˁ^ @q8 cˎvcwdPj@q'܌D@~A .Ћg?(lLKWyE{ @R 0Vڨz^̤]?iԠOǂX-.V cx,@c QW-Jmzȱ2F1r҆POVNF,p>QJ2藹A#  ⯟,EwB&b7_yls~f¿ߢO4)r"Wu *f;zNkVP(\\ By$eU>:BuGT3LHBU=3s˙1 |\TdddHO>SDQj>e Lf䅅x x1|/sVk^(fwM  QSI;PAE ٰaC ].c2(G. sq\eee 'M^wVKr4\fMTe0Hx3Ȥ"*+ B#)hs^$݆yMyyIPz=fϬ\3kO7|^婃N)ŬYBLO۶0oDnTe_>c~]zvX&2&]bjIDbo(~n me7é,[UE.:Y:҄F';5BUF; 2 2 2 2 ѷ7D-E)=;6B`vB9XZ+v^Æ; :9uO)lS0E^9G!8P[MEN9`b:VPY3 39XX{Nx6C!0eA.%@Vc_[iЕ`KoY3MxS!Phxiun?xN$M7rW"K}#f!U,E?۔ڠI8f@w(~VC4/jIu+4jFa_-˙g{։hЀbуx^DX"眐NHLݝͷH_}>?0 4Rcfqߟ3IZ%,Y)቟ٲ*w9yIyV`nZ{dq,u =4$G@yrJ=vc>?^`]3ĉB Qaӯ_'N+B ˬ_4իW̙3GEQf"S^uQaa~E_HD>r,ΗHѲ˟:<q`̅I&54h;vl2B|^^hxjAWLLLRs<(</Vb>pN73ȶ{n ~c4LLr;-W& Pn1L{w6.!qn 9 7j#$> w7eNVeyHIRPgitZ]sHv&%C̞:stJEeYIct VJr:*+BkR%=lǠ zӣ?o4>;/BLp\̶ĆajJ;E{?EqˮU}\`KW|Dȱ;:kKvWfIoQU_PJ߄}i/ͮ}_&C9 ^OE/#{T &*@iڬj lB22KA%:͠d{ ,URu _yx|q@ Y%糒R'+ PX/Ƅ2:-xaDqʲ\__ ԥx^ N2G>fh6`gD;&e}AAgՠ'xbzyB97bU bKILN{8/`;D9b^܅B<0FE-XX FY?jj&ZX(.DZyYɿΘ) yѱc637 z yfAcLfY(%]@(~ vt͘2J;T?[5^.-hܛ69#?4$Q\\G@ cMB!'rYz>(n[)pб\M*C&dxnK7~*sq19 ;0UĬW.7`hVLNY֎sOo.bK([@ٷ,h|$KW)%˴vjZ[aM-sJ X,s!6^u~<;A Vزa.Of s]X}\/Ew?GxzKWOd%|#A9']/٣+wCOF*D3K5/C+93(=tdLM;0JH>PyE>tW3.-pz~Q bhz#ЩwA[]@l ^췦\k)ZS«1 PG-EFFVJHTw֭vm-TÇӸqQP^^$IY<5Ad"5 ^5b0^:a53P#pF#i|5YϞ=o^`Su) QC` +#;?o=z&T/Y$''̛7yۛxd6v :@W/<BiiV\RJ)9e%e ⤎Md2O}h5=U^Ռ"sQ@x_y&Nx/:eXRt{{wD*a<)5Y+[4 ^ւzW%\Vkyl̿iC}cp3Xll >jg1ZU0WI:)U٢"O@/9mVfˀFcSjXAPKW^em-";AjEza w_TP;G=$jnK]8m[ke[b}S~+<; [纈^_gY&+5[Uȟ;[O>mjFg_ɸq㾳>[eYvvmk!4{. %{iXhԅ@N@MJޞӿ3sX@-i:gDhz*m*:'@p0U&fŽJLa~5B %loe, @ v8qW՘jS>pXY; +3B hŶr; NVGu P.)cj*X2Y.L@w1[Nتu*Bf k *gh?j#de|RCut]L6Zmrf+e>8u-Є]Q4~^}͘h$p[t62F˘*=+zyVw"~QM` Uo`AQeV@F_jj>Z6t<ѝ64VW5pmfu j.E͢mVoL!j!/H9z\}O"-/C[&__A^ 68jAdAdAdAdAdAdAdIQ'7dB(FN!Xz{O=I5Pd br~zW}3'Nx6 "\d]מ=73͡ A'e Z7=0*,$APA93|iHcted\ (!BUϔ3P+ 2Jj.ڢ$nݺԾ}{Ә1cW-^}BBٰaCvIII]((!& =cA E(A'BA @ 6#~QNm\0oT6A=??d2U" @3Ƞ?.'H.T$QE%s(EX8!a&P]d锩.^)…HOPv]7l1S/+ٽT 2@C2q²‹e%ܬsYI9?v_.B&nsnapeHNN'E@dR&l6!4T@X{v*9<ܹsv]FZri]͓/AØ.!d:R7 CvQhѲD , rMX|Vzb LrB[٪uM@ѫW/wzLV B(hU]/TcdAALū|`/YK5CQftvIHL**$fU";'8_~10w S k` ٫We)h Zo;(zz%GfA7E1ʭ.).p`5o KpM}`-q"i)V$آU),y0jh ʢ_~[$+X4lcz^*&(viJݱ(f0Z-Q]NuEۢš~k//?pОp}ȄxȞ:7j]Wχ uRM4%1Bc&inOv-ͽ.\PxFQ;CnN()v *(7iJm `D#搩#}o|F6SQUBr":_Cg6x_f0iwo[ S0T`]_;-[w~%7|rpIȄpZ;o| JwavC_W_-oe(++,uF4W˛2-Ȳi`V5JJfֹqp7֪8V_?wa1 sVRbcc7όumeas` }m C&J_G?}K 96d .ݮngҊ}L=e%]pr59f ,M]i+«\%K&)W7Ag Pb[L&M>ybL x)0@e; P@ 0KYרG*cIA2OI5dS-$ytJIap+:Q51l!0;•6*p:-UA[>m}z ׯАy98. S EJTQhX+ gd.z I'D&3kH`.$v[RR|Sl ;0d$ΧPƁ3*) Nɡ3r \RVӡkV xngT S@_w8ĭd&'AJae]G7^Bgj6[머M-e&-Mxv+v+w[,}5@K@@ \~Q=sR4bi& ϭvG7G7΅)hQ߼L6b*0V],dMcajGPh0GQgf϶.R0(wRw:iAv (((%P\EUYBCBBfi6fY2L.DFxb<҄,t2fYͫZG=z<Ǘ4L  !&TC%+ DASOd"{極qԉBM)qeT& FBd"_TBbx,l ھ/x#` 6s RIay ?j-/pQO Fgm U(SLE Dtk{hOW@ ֳeNKͷui?}`Ϛ.Z#E6泮QY+ l{A]WAMYHSڷϘ~h"d7С?LYoBc;ie?j=bj H HG|0KhGZsCr9Z,3jVmUxiʏ;*ǢzU3u;[}rH-؇ǔkвv: üDScĕt̰\Pg<zu`Вxnayrڜj (. B(֮Ƭf# nMp덣NU%H>"}kvVq Ȼ) 4l֑71UWϵ =UM1]Bˤ:ejLNAncOdMnb_6 r.hJ=x%XDHNIJAdAdAdAW;&2IENDB`objenesis-2.2/website/site/resources/robots.txt000066400000000000000000000000161255656413200220350ustar00rootroot00000000000000User-agent: * objenesis-2.2/website/site/resources/style.css000066400000000000000000000146421255656413200216500ustar00rootroot00000000000000/** * Copyright 2006-2015 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.2/website/site/templates/000077500000000000000000000000001255656413200177535ustar00rootroot00000000000000objenesis-2.2/website/site/templates/skin.html000066400000000000000000000050301255656413200216030ustar00rootroot00000000000000 Objenesis : \${title} \${head}

\${title}

\${body}

<#list sitemap.sections as section>