objenesis-1.2/0000755000175000017500000000000011635442734013304 5ustar twernertwernerobjenesis-1.2/website/0000755000175000017500000000000011635442734014746 5ustar twernertwernerobjenesis-1.2/website/site/0000755000175000017500000000000011635442734015712 5ustar twernertwernerobjenesis-1.2/website/site/templates/0000755000175000017500000000000011635442734017710 5ustar twernertwernerobjenesis-1.2/website/site/templates/skin.html0000644000175000017500000000267611217536326021552 0ustar twernertwerner Objenesis : \${title} \${head}

\${title}

\${body}

<#list sitemap.sections as section>
objenesis-1.2/website/site/content/0000755000175000017500000000000011635442733017363 5ustar twernertwernerobjenesis-1.2/website/site/content/support.html0000644000175000017500000000060310525401301021743 0ustar twernertwerner Getting Support objenesis-1.2/website/site/content/tutorial.html0000644000175000017500000000676211217536326022125 0ustar twernertwerner Twenty Second Tutorial

There are two main interfaces in Objenesis:

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

Step By Step

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

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

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

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

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

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

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

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

Performance and Threading

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

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

That Code Again

(For the impatient)

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

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

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

MyThingy thingy2 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy3 = (MyThingy)thingyInstantiator.newInstance();
MyThingy thingy4 = (MyThingy)thingyInstantiator.newInstance();
objenesis-1.2/website/site/content/index.html0000644000175000017500000000540711217536326021364 0ustar twernertwerner About

Objenesis is a small Java library that serves one purpose:

When would you want this?

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

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

Typical uses

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

Getting Started

  1. Download objenesis-${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.

objenesis-1.2/website/site/content/embedding.html0000644000175000017500000000455211217541406022166 0ustar twernertwerner 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-1.2/website/site/content/sitemap.xml0000644000175000017500000000105610727053542021546 0ustar twernertwerner
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-1.2/website/site/content/source.html0000644000175000017500000000043410525401301021531 0ustar twernertwerner Source Repository

The source repository for Objenesis is hosted by Google Code Project Hosting.

objenesis-1.2/website/site/content/acknowledgements.html0000644000175000017500000000336010551310660023572 0ustar twernertwerner Acknowledgements

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

Code from Objenesis was adapted from code from these projects:

Development Team

To contact the developers, please use the discussion group.

Contributors

Supporting Services

objenesis-1.2/website/site/content/license.html0000644000175000017500000000306411217526140021665 0ustar twernertwerner 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-2009, 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-1.2/website/site/content/details.html0000644000175000017500000001266611217536326021707 0ustar twernertwerner 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 you 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 in 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.

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:

ObjectInstantiator caching

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

However, you can always disable the cache if needed.

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

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

Use you own strategy

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

From there, you can use this new strategy.

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

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

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-1.2/website/site/content/notes.html0000644000175000017500000000063011244351230021363 0ustar twernertwerner Release notes

Version 1.2

Version 1.1

Version 1.0

objenesis-1.2/website/site/content/download.html0000644000175000017500000000132111245333205022043 0ustar twernertwerner Download

Current version is ${project.version}

Older versions can be found here

objenesis-1.2/website/site/resources/0000755000175000017500000000000011635442734017724 5ustar twernertwernerobjenesis-1.2/website/site/resources/objenesis.png0000644000175000017500000003464610525401301022406 0ustar twernertwernerPNG  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-1.2/website/site/resources/style.css0000644000175000017500000001344610525401301021564 0ustar twernertwerner/*--------------------------------------------------------------------------- * 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-1.2/website/pom.xml0000644000175000017500000000755411245322440016262 0ustar twernertwerner 4.0.0 org.objenesis objenesis-parent 1.2 .. objenesis-website Objenesis website pom apidocs org.objenesis objenesis ${project.version} maven-resources-plugin copy-resources prepare-package copy-resources ${project.build.directory}/site \ ISO-8859-1 ${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.0 ${project.build.directory}/site content/sitemap.xml templates/skin.html resources ${project.build.directory}/xsite package run maven-deploy-plugin true objenesis-1.2/website/.settings/0000755000175000017500000000000011635442734016664 5ustar twernertwernerobjenesis-1.2/website/.settings/org.eclipse.core.resources.prefs0000644000175000017500000000116011217536326025072 0ustar twernertwerner#Mon Jun 22 00:42:45 CEST 2009 eclipse.preferences.version=1 encoding//site/content/acknowledgements.html=ISO-8859-1 encoding//site/content/details.html=ISO-8859-1 encoding//site/content/download.html=ISO-8859-1 encoding//site/content/embedding.html=ISO-8859-1 encoding//site/content/index.html=ISO-8859-1 encoding//site/content/license.html=ISO-8859-1 encoding//site/content/notes.html=ISO-8859-1 encoding//site/content/sitemap.xml=ISO-8859-1 encoding//site/content/source.html=ISO-8859-1 encoding//site/content/support.html=ISO-8859-1 encoding//site/content/tutorial.html=ISO-8859-1 encoding/site=ISO-8859-1 objenesis-1.2/website/.project0000644000175000017500000000146211217536326016415 0ustar twernertwerner objenesis-website org.eclipse.wst.jsdt.core.javascriptValidator org.eclipse.wst.common.project.facet.core.builder org.eclipse.wst.validation.validationbuilder org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.wst.jsdt.core.jsNature objenesis-1.2/header.txt0000644000175000017500000000113511216277155015273 0ustar twernertwernerCopyright ${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-1.2/pom.xml0000644000175000017500000002416011245322440014610 0ustar twernertwerner 4.0.0 Objenesis parent project org.objenesis objenesis-parent 1.2 pom 2006 main tck Apache 2 http://www.apache.org/licenses/LICENSE-2.0.txt repo Joe Walnes, Henri Tremblay, Leonardo Mesquita scm:svn:http://objenesis.googlecode.com/svn/trunk scm:svn:https://objenesis.googlecode.com/svn/trunk http://objenesis.googlecode.com/svn/trunk joe Joe Walnes 0 henri Henri Tremblay Ossia Conseil http://www.ossia-conseil.com +1 leonardo Leonardo Mesquita -5 junit junit 3.8.2 test ${basedir}/src ${basedir}/src **/*.java ${basedir}/test ${basedir}/test **/*.java maven-compiler-plugin 1.3 1.3 org.apache.maven.plugins maven-source-plugin attach-sources jar maven-jar-plugin true true false true true org.apache.maven.plugins maven-javadoc-plugin attach-javadocs jar maven-site-plugin false ${basedir}/website maven-eclipse-plugin 2.7 true org.apache.maven.wagon wagon-ssh-external 1.0-beta-5 org.apache.felix maven-bundle-plugin 2.0.0 bundle-manifest prepare-package manifest com.keyboardsamurais.maven maven-timestamp-plugin 1.0 year create year yyyy com.google.code.maven-license-plugin maven-license-plugin 1.4.0
${basedir}/../header.txt
target/** src/org/objenesis/instantiator/jrockit/*.java dependency-reduced-pom.xml eclipse_config/** ${project.inceptionYear} ${year}
check check
org.apache.maven.plugins maven-remote-resources-plugin 1.0 process org.apache:apache-jar-resource-bundle:1.3
org.codehaus.mojo findbugs-maven-plugin 2.1 org.apache.maven.plugins maven-pmd-plugin 2.4 1.3 easymock-release EasyMock Repository scpexe://shell.sf.net/home/groups/e/ea/easymock/htdocs/maven/repository easymock-snapshot EasyMock Snapshot Repository scpexe://shell.sf.net/home/groups/e/ea/easymock/htdocs/maven/repository-snapshot license com.google.code.maven-license-plugin maven-license-plugin format generate-sources format website website
objenesis-1.2/update_license.bat0000644000175000017500000000005111216277155016752 0ustar twernertwerner%M2_HOME%\bin\mvn.bat install -Plicense objenesis-1.2/build_eclipse.bat0000644000175000017500000000007610563646537016610 0ustar twernertwerner%M2_HOME%\bin\mvn.bat eclipse:eclipse -DdownloadSources=true objenesis-1.2/build_release.bat0000644000175000017500000000007411220252432016554 0ustar twernertwerner%M2_HOME%\bin\mvn.bat clean install -Pwebsite,release %* objenesis-1.2/LICENSE.txt0000644000175000017500000002613611216277155015135 0ustar twernertwerner 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-1.2/tck/0000755000175000017500000000000011635442733014064 5ustar twernertwernerobjenesis-1.2/tck/test/0000755000175000017500000000000011635442733015043 5ustar twernertwernerobjenesis-1.2/tck/test/org/0000755000175000017500000000000011635442733015632 5ustar twernertwernerobjenesis-1.2/tck/test/org/objenesis/0000755000175000017500000000000011635442733017613 5ustar twernertwernerobjenesis-1.2/tck/test/org/objenesis/tck/0000755000175000017500000000000011635442733020374 5ustar twernertwernerobjenesis-1.2/tck/test/org/objenesis/tck/TextReporterTest.java0000644000175000017500000000636011216277155024552 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.Arrays; import junit.framework.TestCase; /** * @author Joe Walnes * @author Henri Tremblay */ public class TextReporterTest extends TestCase { private TextReporter textReporter; private ByteArrayOutputStream summaryBuffer; protected void setUp() throws Exception { super.setUp(); summaryBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream logBuffer = new ByteArrayOutputStream(); textReporter = new TextReporter(new PrintStream(summaryBuffer), new PrintStream(logBuffer)); } public void testReportsSuccessesInTabularFormat() { textReporter.startTests("Some platform", Arrays.asList(new String[] {"candidate A", "candidate B", "candidate C"}), Arrays.asList(new String[] {"instantiator1", "instantiator2", "instantiator3"})); 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("Not serializable parent constructor called: 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-1.2/tck/test/org/objenesis/tck/OsgiTest.java0000644000175000017500000000416011244346715023000 0ustar twernertwerner/** * Copyright 2006-2009 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.Serializable; import org.objenesis.Objenesis; import org.objenesis.ObjenesisHelper; import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests; /** * @author Henri Tremblay */ public class OsgiTest extends AbstractConfigurableBundleCreatorTests implements Serializable { private static final long serialVersionUID = 1L; protected String[] getTestBundlesNames() { final String version = Objenesis.class.getPackage() .getImplementationVersion(); return new String[] {"org.objenesis, objenesis, " + version}; } // protected Manifest getManifest() { // Manifest mf = super.getManifest(); // // String imports = mf.getMainAttributes().getValue( // Constants.IMPORT_PACKAGE); // imports = imports.replace("org.easymock.internal,", // "org.easymock.internal;poweruser=true,"); // imports = imports.replace("org.easymock.internal.matchers,", // "org.easymock.internal.matchers;poweruser=true,"); // // mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, imports); // // return mf; // } public void testCanInstantiate() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newInstance(getClass()).getClass()); } public void testCanInstantiateSerialize() throws IOException { assertSame(OsgiTest.class, ObjenesisHelper.newSerializableInstance(getClass()).getClass()); } } objenesis-1.2/tck/test/org/objenesis/tck/ObjenesisTest.java0000644000175000017500000001072411216277155024023 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.Serializable; import java.util.Collection; import junit.framework.TestCase; 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 extends TestCase { public static class ErrorHandler implements CandidateLoader.ErrorHandler { public void classNotFound(String name) { fail("Class not found : " + name); } } public static class JUnitReporter implements Reporter { private String currentObjenesis; private String currentCandidate; public void startTests(String platformDescription, Collection allCandidates, Collection 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() { } } static class MockSuperClass { private final boolean superConstructorCalled; public MockSuperClass() { superConstructorCalled = true; } public boolean isSuperConstructorCalled() { return superConstructorCalled; } } static class MockClass extends MockSuperClass implements Serializable { private static final long serialVersionUID = 1L; private final boolean constructorCalled; public MockClass() { super(); constructorCalled = true; } public boolean isConstructorCalled() { return constructorCalled; } } private TCK tck = null; private CandidateLoader candidateLoader = null; protected void setUp() throws Exception { super.setUp(); tck = new TCK(); candidateLoader = new CandidateLoader(tck, getClass().getClassLoader(), new ErrorHandler()); } protected void tearDown() throws Exception { candidateLoader = null; tck = null; super.tearDown(); } public void testObjenesisStd() throws Exception { candidateLoader.loadFromResource(getClass(), "candidates/candidates.properties"); tck.registerObjenesisInstance(new ObjenesisStd(), "Objenesis standard"); tck.runTests(new JUnitReporter()); } public void testObjenesisSerializer() throws Exception { candidateLoader.loadFromResource(getClass(), "candidates/serializable-candidates.properties"); tck.registerObjenesisInstance(new ObjenesisSerializer(), "Objenesis serializer"); tck.runTests(new JUnitReporter()); } public void testObjenesisSerializerParentConstructorCalled() throws Exception { Object result = new ObjenesisSerializer().newInstance(MockClass.class); assertEquals(MockClass.class, result.getClass()); MockClass mockObject = (MockClass) result; assertTrue(mockObject.isSuperConstructorCalled()); assertFalse(mockObject.isConstructorCalled()); } } objenesis-1.2/tck/test/org/objenesis/tck/CandidateLoaderTest.java0000644000175000017500000000777211216277155025116 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck; import java.io.ByteArrayInputStream; import java.io.IOException; import junit.framework.TestCase; /** * @author Joe Walnes */ public class CandidateLoaderTest extends TestCase { private StringBuffer recordedEvents; private CandidateLoader candidateLoader; protected void setUp() throws Exception { super.setUp(); recordedEvents = new StringBuffer(); TCK tck = new TCK() { 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); } 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()); } 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()); } 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()); } 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-1.2/tck/test/org/objenesis/tck/CandidateLoaderTest-sample.properties0000644000175000017500000000134711216277155027640 0ustar twernertwerner# # Copyright 2006-2009 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-1.2/tck/test/org/objenesis/tck/TCKTest.java0000644000175000017500000001310611216277155022520 0ustar twernertwerner/** * Copyright 2006-2009 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.Collection; import junit.framework.TestCase; import org.objenesis.Objenesis; import org.objenesis.instantiator.ObjectInstantiator; /** * @author Joe Walnes * @author Henri Tremblay */ public class TCKTest extends TestCase { public static class StubbedInstantiator1 implements Objenesis { public Object newInstance(Class clazz) { return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } public static class StubbedInstantiator2 implements Objenesis { public Object newInstance(Class clazz) { return null; } public ObjectInstantiator getInstantiatorOf(Class clazz) { return null; } } 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()); } 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 Object newInstance(Class clazz) { return 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 StringBuffer log = new StringBuffer(); public void startTests(String platformDescription, Collection allCandidates, Collection 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"); } public String toString() { return log.toString(); } } } objenesis-1.2/tck/pom.xml0000644000175000017500000002134511245324270015376 0ustar twernertwerner 4.0.0 org.objenesis objenesis-parent 1.2 .. objenesis-tck Objenesis TCK org.objenesis objenesis ${project.version} org.springframework.osgi spring-osgi-test 1.2.0 test org.springframework.osgi spring-osgi-annotation 1.2.0 test org.springframework.osgi spring-osgi-extender 1.2.0 test org.slf4j com.springsource.slf4j.org.apache.commons.logging 1.5.0 test org.slf4j com.springsource.slf4j.api 1.5.0 test org.slf4j com.springsource.slf4j.log4j 1.5.0 test log4j log4j com.springsource.org.apache.log4j org.apache.log4j org.springframework.osgi log4j.osgi 1.2.15-SNAPSHOT test org.eclipse.osgi org.eclipse.osgi 3.2.2 test com.keyboardsamurais.maven maven-timestamp-plugin com.google.code.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 1.2.1 package shade org.apache.maven.plugins maven-javadoc-plugin http://objenesis.googlecode.com/svn/docs/apidocs/ jvm-test maven-surefire-plugin Sun 1.3 test test ${sun_jdk1_3.jvm} Sun 1.4 test test ${sun_jdk1_4.jvm} Sun 1.5 test test ${sun_jdk1_5.jvm} Sun 1.6 test test ${sun_jdk1_6.jvm} JRockit for Java 1.3 test test ${jrockit1_3.jvm} JRockit for Java 1.4 test test ${jrockit1_4.jvm} JRockit for Java 1.5 test test ${jrockit1_5.jvm} JRockit for Java 1.6 test test ${jrockit1_6.jvm} release org.codehaus.mojo exec-maven-plugin false java -jar ${project.build.directory}\${project.build.finalName}.jar test-release integration-test exec objenesis-1.2/tck/src/0000755000175000017500000000000011635442733014653 5ustar twernertwernerobjenesis-1.2/tck/src/org/0000755000175000017500000000000011635442733015442 5ustar twernertwernerobjenesis-1.2/tck/src/org/objenesis/0000755000175000017500000000000011635442733017423 5ustar twernertwernerobjenesis-1.2/tck/src/org/objenesis/tck/0000755000175000017500000000000011635442733020204 5ustar twernertwernerobjenesis-1.2/tck/src/org/objenesis/tck/CandidateLoader.java0000644000175000017500000000774311216277155024064 0ustar twernertwerner/** * Copyright 2006-2009 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 static 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; 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-1.2/tck/src/org/objenesis/tck/Main.java0000644000175000017500000000627111216277155021740 0ustar twernertwerner/** * Copyright 2006-2009 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.Serializable; import org.objenesis.Objenesis; import org.objenesis.ObjenesisSerializer; import org.objenesis.ObjenesisStd; /** * 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; 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); runTest(new ObjenesisStd(), reporter, "Objenesis std", "candidates/candidates.properties"); runTest(new ObjenesisSerializer(), reporter, "Objenesis serializer", "candidates/serializable-candidates.properties"); boolean result = runParentConstructorTest(); reporter.printResult(result); } private static boolean runParentConstructorTest() { try { Object result = new ObjenesisSerializer().newInstance(MockClass.class); MockClass mockObject = (MockClass) result; return mockObject.isSuperConstructorCalled() && !mockObject.isConstructorCalled(); } catch(Exception e) { System.err.println("--- Not serializable parent constructor called ---"); e.printStackTrace(System.err); return false; } } private static void runTest(Objenesis objenesis, Reporter reporter, String description, String candidates) throws IOException { TCK tck = new TCK(); tck.registerObjenesisInstance(objenesis, description); CandidateLoader candidateLoader = new CandidateLoader(tck, Main.class.getClassLoader(), new CandidateLoader.LoggingErrorHandler(System.err)); candidateLoader.loadFromResource(Main.class, candidates); tck.runTests(reporter); } } objenesis-1.2/tck/src/org/objenesis/tck/Reporter.java0000644000175000017500000000504511216277155022654 0ustar twernertwerner/** * Copyright 2006-2009 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.Collection; /** * 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 being used in tests. * @param allObjenesisInstances Descriptions of all Objenesis instances being used in tests. */ void startTests(String platformDescription, Collection allCandidates, Collection 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-1.2/tck/src/org/objenesis/tck/TCK.java0000644000175000017500000001161311245324270021462 0ustar twernertwerner/** * Copyright 2006-2009 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.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.objenesis.Objenesis; /** * 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(Iterator i = candidates.iterator(); i.hasNext();) { Class candidateClass = (Class) i.next(); String candidateDescription = (String) descriptions.get(candidateClass); for(Iterator j = objenesisInstances.iterator(); j.hasNext();) { Objenesis objenesis = (Objenesis) j.next(); String objenesisDescription = (String) descriptions.get(objenesis); reporter.startTest(candidateDescription, objenesisDescription); runTest(reporter, candidateClass, objenesis, candidateDescription); reporter.endTest(); } } reporter.endTests(); } private void runTest(Reporter reporter, Class candidate, Objenesis objenesis, String candidateDescription) { try { Object instance = objenesis.newInstance(candidate); boolean success = instance != null && instance.getClass() == candidate; reporter.result(success); } catch(Exception e) { reporter.exception(e); } } private Collection findAllDescriptions(List keys, Map descriptions) { List results = new ArrayList(keys.size()); for(int i = 0; i < keys.size(); i++) { results.add(descriptions.get(keys.get(i))); } 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 "Java " + System.getProperty("java.specification.version") + " (" + System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version") + " " + System.getProperty("java.runtime.version") + ")"; } } objenesis-1.2/tck/src/org/objenesis/tck/TextReporter.java0000644000175000017500000001620611216277155023522 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; /** * Reports results from TCK as tabulated text, suitable for dumping to the console or a file and * being read by a human. If 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 SortedSet allCandidates = new TreeSet(); private SortedSet allInstantiators = new TreeSet(); 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, Collection allCandidates, Collection 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.addAll(allCandidates); this.allInstantiators.addAll(allInstantiators); for(Iterator it = allInstantiators.iterator(); it.hasNext();) { objenesisResults.put(it.next(), new HashMap()); } startTime = System.currentTimeMillis(); } public void startTest(String candidateDescription, String objenesisDescription) { currentCandidate = candidateDescription; currentObjenesis = objenesisDescription; } public void result(boolean instantiatedObject) { if(!instantiatedObject) { errorCount++; } ((Map) objenesisResults.get(currentObjenesis)).put(currentCandidate, new Result( currentObjenesis, currentCandidate, instantiatedObject, null)); } public void exception(Exception exception) { errorCount++; ((Map) 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 */ public void printResult(boolean parentConstructorTest) { // Platform summary.println("Running TCK on platform: " + platformDescription); summary.println(); summary.println("Not serializable parent constructor called: " + (parentConstructorTest ? 'Y' : 'N')); summary.println(); if(!parentConstructorTest) { errorCount++; } int maxObjenesisWidth = lengthOfLongestStringIn(allInstantiators); int maxCandidateWidth = lengthOfLongestStringIn(allCandidates); // Header summary.print(pad("", maxCandidateWidth) + ' '); for(Iterator it = allInstantiators.iterator(); it.hasNext();) { String desc = (String) it.next(); summary.print(pad(desc, maxObjenesisWidth) + ' '); } summary.println(); List exceptions = new ArrayList(); // Candidates (and keep the exceptions meanwhile) for(Iterator it = allCandidates.iterator(); it.hasNext();) { String candidateDesc = (String) it.next(); summary.print(pad(candidateDesc, maxCandidateWidth) + ' '); for(Iterator itInst = allInstantiators.iterator(); itInst.hasNext();) { String instDesc = (String) itInst.next(); Result result = (Result) ((Map) 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(Iterator it = exceptions.iterator(); it.hasNext();) { Result element = (Result) it.next(); 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(); } private String pad(String text, int width) { if(text.length() == width) { return text; } else if(text.length() > width) { return text.substring(0, width); } else { StringBuffer padded = new StringBuffer(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, ((String) it.next()).length()); } return result; } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/0000755000175000017500000000000011635442733022303 5ustar twernertwernerobjenesis-1.2/tck/src/org/objenesis/tck/candidates/DefaultPackageConstructor.java0000644000175000017500000000140511216277155030253 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.java0000644000175000017500000000161311216277155032603 0ustar twernertwerner/** * Copyright 2006-2009 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() { } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/SerializableResolver.java0000644000175000017500000000167211216277155027303 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableResolver implements Serializable { private static final long serialVersionUID = 1L; protected Object readResolve() { return new SerializableReplacer(); } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/DefaultPrivateConstructor.java0000644000175000017500000000141511216277155030333 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableConstructorThrowingException.java0000644000175000017500000000174711216277155033433 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorThrowingException implements Serializable { private static final long serialVersionUID = 1L; public SerializableConstructorThrowingException() { throw new IllegalArgumentException("Constructor throwing an exception"); } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.java0000644000175000017500000000170211216277155033507 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/ConstructorWithArguments.java0000644000175000017500000000175611216277155030225 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableConstructorWithArguments.java0000644000175000017500000000216411216277155032546 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorWithArguments implements Serializable { private static final long serialVersionUID = 1L; private final String something; private final int another; public SerializableConstructorWithArguments(String something, int another) { this.something = something; this.another = another; } public String toString() { return something + another; } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/DefaultProtectedConstructor.java0000644000175000017500000000142311216277155030651 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/ConstructorThrowingException.java0000644000175000017500000000154111216277155031074 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableNoConstructor.java0000644000175000017500000000150711216277155030321 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.java0000644000175000017500000000162011216277155032464 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.java0000644000175000017500000000163111216277155033201 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultProtectedConstructor implements Serializable { private static final long serialVersionUID = 1L; protected SerializableDefaultProtectedConstructor() { } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/serializable-candidates.properties0000644000175000017500000000366611216277155031176 0ustar twernertwerner# # Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/NoConstructor.java0000644000175000017500000000132111216277155025764 0ustar twernertwerner/** * Copyright 2006-2009 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 { } objenesis-1.2/tck/src/org/objenesis/tck/candidates/candidates.properties0000644000175000017500000000563611216277155026531 0ustar twernertwerner# # Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java0000644000175000017500000000162011216277155032072 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.java0000644000175000017500000000162311216277155032663 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableDefaultPrivateConstructor implements Serializable { private static final long serialVersionUID = 1L; private SerializableDefaultPrivateConstructor() { } } objenesis-1.2/tck/src/org/objenesis/tck/candidates/SerializableReplacer.java0000644000175000017500000000167311216277155027240 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/tck/src/org/objenesis/tck/candidates/DefaultPublicConstructor.java0000644000175000017500000000141211216277155030134 0ustar twernertwerner/** * Copyright 2006-2009 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() { } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootobjenesis-1.2/tck/src/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.javaobjenesis-1.2/tck/src/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.jav0000644000175000017500000000202611216277155034261 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.tck.candidates; import java.io.Serializable; /** * @author Joe Walnes */ public class SerializableConstructorWithMandatoryArguments implements Serializable { private static final long serialVersionUID = 1L; public SerializableConstructorWithMandatoryArguments(String something) { if(something == null) { throw new IllegalArgumentException("Need arguments"); } } } objenesis-1.2/tck/.settings/0000755000175000017500000000000011635442733016002 5ustar twernertwernerobjenesis-1.2/tck/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000066610563721703022455 0ustar twernertwerner#Sun Feb 11 23:43:16 CET 2007 eclipse.preferences.version=1 formatter_profile=_Objenesis formatter_settings_version=10 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= objenesis-1.2/tck/.settings/org.eclipse.core.resources.prefs0000644000175000017500000000013510563721703024210 0ustar twernertwerner#Mon Feb 12 00:06:57 CET 2007 eclipse.preferences.version=1 encoding/=ISO-8859-1 objenesis-1.2/tck/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005253710563721703022774 0ustar twernertwerner#Sun Feb 11 23:43:02 CET 2007 eclipse.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.3 org.eclipse.jdt.core.compiler.compliance=1.3 org.eclipse.jdt.core.compiler.source=1.3 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_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_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_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.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_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.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_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.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.format_guardian_clause_on_one_line=false 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_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_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_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_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_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_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_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.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.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_tabs_only_for_leading_indentations=false objenesis-1.2/settings-example.xml0000644000175000017500000000175311217543242017315 0ustar twernertwerner test true c:\jdk1.3.1_19\bin\java.exe c:\j2sdk1.4.2_12\bin\java.exe c:\Arquivos de Programas\Java\jre1.5.0_10\bin\java.exe c:\Arquivos de Programas\Java\jre1.6.0_13\bin\java.exe c:\Arquivos de programas\JRockit\7.0SP6\1.3.1\bin\java.exe c:\jrockit-j2sdk1.4.2_08\bin\java.exe c:\jrrt-3.1.0-1.5.0\bin\java.exe c:\jrrt-3.1.0-1.6.0\bin\java.exe objenesis-1.2/objenesis-formatting.xml0000644000175000017500000006522010563721703020157 0ustar twernertwerner objenesis-1.2/main/0000755000175000017500000000000011635442734014230 5ustar twernertwernerobjenesis-1.2/main/test/0000755000175000017500000000000011635442734015207 5ustar twernertwernerobjenesis-1.2/main/test/org/0000755000175000017500000000000011635442734015776 5ustar twernertwernerobjenesis-1.2/main/test/org/objenesis/0000755000175000017500000000000011635442734017757 5ustar twernertwernerobjenesis-1.2/main/test/org/objenesis/ObjenesisTest.java0000644000175000017500000000456011216277155023406 0ustar twernertwerner/** * Copyright 2006-2009 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 junit.framework.TestCase; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.strategy.InstantiatorStrategy; /** * @author Henri Tremblay */ public class ObjenesisTest extends TestCase { public final void testObjenesis() { Objenesis o = new ObjenesisStd(); assertEquals( "org.objenesis.ObjenesisStd using org.objenesis.strategy.StdInstantiatorStrategy with caching", o.toString()); } 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()); } public final void testNewInstance() { Objenesis o = new ObjenesisStd(); assertEquals(getClass(), o.newInstance(getClass()).getClass()); } 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); } 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-1.2/main/test/org/objenesis/SerializingInstantiatorTest.java0000644000175000017500000000251311216277155026341 0ustar twernertwerner/** * Copyright 2006-2009 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.NotSerializableException; import junit.framework.TestCase; /** * @author Henri Tremblay * @author Leonardo Mesquita */ public class SerializingInstantiatorTest extends TestCase { protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } 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-1.2/main/test/org/objenesis/ObjenesisExceptionTest.java0000644000175000017500000000341711216277155025265 0ustar twernertwerner/** * Copyright 2006-2009 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 junit.framework.TestCase; /** * @author Henri Tremblay */ public class ObjenesisExceptionTest extends TestCase { public final void testObjenesisExceptionString() { Exception e = new ObjenesisException("test"); assertEquals("test", e.getMessage()); } 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()); } 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-1.2/main/pom.xml0000644000175000017500000000570011245331761015541 0ustar twernertwerner 4.0.0 org.objenesis objenesis-parent 1.2 .. objenesis Objenesis A library for instantiating Java objects http://objenesis.googlecode.com/svn/docs/index.html com.keyboardsamurais.maven maven-timestamp-plugin com.google.code.maven-license-plugin maven-license-plugin org.apache.maven.plugins maven-remote-resources-plugin org.apache.felix maven-bundle-plugin org.objenesis.* org.objenesis.* release org.apache.maven.plugins maven-assembly-plugin assembly.xml make-assembly package single objenesis-1.2/main/assembly.xml0000644000175000017500000000231011245331761016557 0ustar twernertwerner bin zip ${project.build.outputDirectory}/META-INF / NOTICE LICENSE ${project.build.directory} / *.jar objenesis-1.2/main/src/0000755000175000017500000000000011635442734015017 5ustar twernertwernerobjenesis-1.2/main/src/org/0000755000175000017500000000000011635442734015606 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/0000755000175000017500000000000011635442734017567 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/strategy/0000755000175000017500000000000011635442734021431 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/strategy/InstantiatorStrategy.java0000644000175000017500000000213011216277155026470 0ustar twernertwerner/** * Copyright 2006-2009 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 Class that will be instantiate * @return Dedicated instantiator */ ObjectInstantiator newInstantiatorOf(Class type); } objenesis-1.2/main/src/org/objenesis/strategy/StdInstantiatorStrategy.java0000644000175000017500000000634411216277155027156 0ustar twernertwerner/** * Copyright 2006-2009 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.gcj.GCJInstantiator; import org.objenesis.instantiator.jrockit.JRockit131Instantiator; import org.objenesis.instantiator.jrockit.JRockitLegacyInstantiator; import org.objenesis.instantiator.perc.PercInstantiator; import org.objenesis.instantiator.sun.Sun13Instantiator; import org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator; /** * 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(JVM_NAME.startsWith(SUN)) { if(VM_VERSION.startsWith("1.3")) { return new Sun13Instantiator(type); } } else if(JVM_NAME.startsWith(JROCKIT)) { if(VM_VERSION.startsWith("1.3")) { return new JRockit131Instantiator(type); } else 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); } } } } else if(JVM_NAME.startsWith(GNU)) { return new GCJInstantiator(type); } else if(JVM_NAME.startsWith(PERC)) { return new PercInstantiator(type); } // Fallback instantiator, should work with: // - Java Hotspot version 1.4 and higher // - JRockit 1.4-R26 and higher // - IBM and Hitachi JVMs // ... might works for others so we just give it a try return new SunReflectionFactoryInstantiator(type); } } objenesis-1.2/main/src/org/objenesis/strategy/SerializingInstantiatorStrategy.java0000644000175000017500000000521511216277155030700 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.strategy; import java.io.NotSerializableException; import java.io.Serializable; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.basic.ObjectStreamClassInstantiator; import org.objenesis.instantiator.gcj.GCJSerializationInstantiator; import org.objenesis.instantiator.perc.PercSerializationInstantiator; import org.objenesis.instantiator.sun.Sun13SerializationInstantiator; /** * 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(SUN)) { if(VM_VERSION.startsWith("1.3")) { return new Sun13SerializationInstantiator(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-1.2/main/src/org/objenesis/strategy/BaseInstantiatorStrategy.java0000644000175000017500000000344711216277155027277 0ustar twernertwerner/** * Copyright 2006-2009 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 containing helpful constant to sort out JVMs. * * @author Henri Tremblay */ public abstract class BaseInstantiatorStrategy implements InstantiatorStrategy { /** JVM_NAME prefix for JRockit */ protected static final String JROCKIT = "BEA"; /** JVM_NAME prefix for GCJ */ protected static final String GNU = "GNU libgcj"; /** JVM_NAME prefix for Sun Java HotSpot */ protected static final String SUN = "Java HotSpot"; /** JVM_NAME prefix for Aonix PERC */ protected static final String PERC = "PERC"; /** JVM version */ protected static final String VM_VERSION = System.getProperty("java.runtime.version"); /** JVM version */ protected static final String VM_INFO = System.getProperty("java.vm.info"); /** Vendor version */ protected static final String VENDOR_VERSION = System.getProperty("java.vm.version"); /** Vendor name */ protected static final String VENDOR = System.getProperty("java.vm.vendor"); /** JVM name */ protected static final String JVM_NAME = System.getProperty("java.vm.name"); } objenesis-1.2/main/src/org/objenesis/ObjenesisBase.java0000644000175000017500000000631511216277155023151 0ustar twernertwerner/** * Copyright 2006-2009 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.HashMap; import java.util.Map; 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 Map 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 HashMap() : null; } 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 Object 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 */ public synchronized ObjectInstantiator getInstantiatorOf(Class clazz) { if(cache == null) { return strategy.newInstantiatorOf(clazz); } ObjectInstantiator instantiator = (ObjectInstantiator) cache.get(clazz.getName()); if(instantiator == null) { instantiator = strategy.newInstantiatorOf(clazz); cache.put(clazz.getName(), instantiator); } return instantiator; } } objenesis-1.2/main/src/org/objenesis/ObjenesisStd.java0000644000175000017500000000273011216277155023026 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/main/src/org/objenesis/instantiator/0000755000175000017500000000000011635442734022306 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/gcj/0000755000175000017500000000000011635442734023051 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/gcj/GCJInstantiator.java0000644000175000017500000000310711217544706026716 0ustar twernertwerner/** * Copyright 2006-2009 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); } public Object newInstance() { try { return newObjectMethod.invoke(dummyStream, new Object[] {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-1.2/main/src/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java0000644000175000017500000000320711216277155031455 0ustar twernertwerner/** * Copyright 2006-2009 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); } public Object newInstance() { try { return newObjectMethod.invoke(dummyStream, new Object[] {type, superType}); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java0000644000175000017500000000435211217544706027514 0ustar twernertwerner/** * Copyright 2006-2009 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 { protected static Method newObjectMethod = null; protected 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 Object newInstance(); } objenesis-1.2/main/src/org/objenesis/instantiator/perc/0000755000175000017500000000000011635442734023237 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/perc/PercInstantiator.java0000644000175000017500000000365011217544706027375 0ustar twernertwerner/** * Copyright 2006-2009 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", new Class[] { Class.class, Boolean.TYPE }); newInstanceMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } public Object newInstance() { try { return newInstanceMethod.invoke(null, typeArgs); } catch (Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/perc/PercSerializationInstantiator.java0000644000175000017500000000677511216277155032146 0ustar twernertwerner/** * Copyright 2006-2009 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 java.lang.reflect.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", new Class[] {Class.class}); Object someObject = getPercClassMethod.invoke(null, new Object[] {unserializableType}); Method findMethodMethod = someObject.getClass().getDeclaredMethod("findMethod", new Class[] {String.class}); Object percMethod = findMethodMethod.invoke(someObject, new Object[] {"()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); } } public Object newInstance() { try { return newInstanceMethod.invoke(null, typeArgs); } catch(IllegalAccessException e) { throw new ObjenesisException(e); } catch(InvocationTargetException e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/basic/0000755000175000017500000000000011635442734023367 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/basic/NewInstanceInstantiator.java0000644000175000017500000000244411216277155031052 0ustar twernertwerner/** * Copyright 2006-2009 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 Object newInstance() { try { return type.newInstance(); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java0000644000175000017500000001351711216277155032241 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.instantiator.basic; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.io.ObjectStreamConstants; import java.io.Serializable; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; /** * 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]; } public int read() throws IOException { int result = data[pointer++]; if(pointer >= data.length) { advanceBuffer(); } return result; } public int available() throws IOException { return Integer.MAX_VALUE; } 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")); } } public Object newInstance() { try { return inputStream.readObject(); } catch(ClassNotFoundException e) { throw new Error("ClassNotFoundException: " + e.getMessage()); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/basic/ConstructorInstantiator.java0000644000175000017500000000302411216277155031154 0ustar twernertwerner/** * Copyright 2006-2009 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 * @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 Object newInstance() { try { return constructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java0000644000175000017500000000441511217544706032204 0ustar twernertwerner/** * Copyright 2006-2009 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", new Class[] {}); 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); } public Object newInstance() { try { return newInstanceMethod.invoke(objStreamClass, new Object[] {}); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/basic/AccessibleInstantiator.java0000644000175000017500000000232111216277155030663 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/main/src/org/objenesis/instantiator/SerializationInstantiatorHelper.java0000644000175000017500000000345611216277155031534 0ustar twernertwerner/** * Copyright 2006-2009 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 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-1.2/main/src/org/objenesis/instantiator/ObjectInstantiator.java0000644000175000017500000000171311216277155026757 0ustar twernertwerner/** * Copyright 2006-2009 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. */ Object newInstance(); } objenesis-1.2/main/src/org/objenesis/instantiator/sun/0000755000175000017500000000000011635442734023113 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java0000644000175000017500000000415311216277155032467 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.instantiator.sun; import java.lang.reflect.Constructor; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import sun.reflect.ReflectionFactory; /** * 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) { ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory(); Constructor javaLangObjectConstructor; try { javaLangObjectConstructor = Object.class.getConstructor((Class[]) null); } catch(NoSuchMethodException e) { throw new Error("Cannot find constructor for java.lang.Object!"); } mungedConstructor = reflectionFactory.newConstructorForSerialization(type, javaLangObjectConstructor); mungedConstructor.setAccessible(true); } public Object newInstance() { try { return mungedConstructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootobjenesis-1.2/main/src/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.javaobjenesis-1.2/main/src/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.0000644000175000017500000000563511216277155034371 0ustar twernertwerner/** * Copyright 2006-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.objenesis.instantiator.sun; import java.io.NotSerializableException; import java.lang.reflect.Constructor; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.SerializationInstantiatorHelper; import sun.reflect.ReflectionFactory; /** * 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); ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory(); Constructor nonSerializableAncestorConstructor; try { nonSerializableAncestorConstructor = nonSerializableAncestor .getConstructor((Class[]) null); } catch(NoSuchMethodException e) { /** * @todo (Henri) I think we should throw a NotSerializableException just to put the same * message a ObjectInputStream. Otherwise, the user won't know if the null returned * if a "Not serializable", a "No default constructor on ancestor" or a "Exception in * constructor" */ throw new ObjenesisException(new NotSerializableException(type+" has no suitable superclass constructor")); } mungedConstructor = reflectionFactory.newConstructorForSerialization(type, nonSerializableAncestorConstructor); mungedConstructor.setAccessible(true); } public Object newInstance() { try { return mungedConstructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/sun/Sun13SerializationInstantiator.java0000644000175000017500000000323711216277155032030 0ustar twernertwerner/** * Copyright 2006-2009 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.SerializationInstantiatorHelper; /** * Instantiates a class by making a call to internal Sun private methods. It is only supposed to * work on Sun HotSpot 1.3 JVM. 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 Sun13SerializationInstantiator extends Sun13InstantiatorBase { private final Class superType; public Sun13SerializationInstantiator(Class type) { super(type); this.superType = SerializationInstantiatorHelper.getNonSerializableSuperClass(type); } public Object newInstance() { try { return allocateNewObjectMethod.invoke(null, new Object[] {type, superType}); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/sun/Sun13InstantiatorBase.java0000644000175000017500000000355211217544706030065 0ustar twernertwerner/** * Copyright 2006-2009 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.ObjectInputStream; import java.lang.reflect.Method; import org.objenesis.ObjenesisException; import org.objenesis.instantiator.ObjectInstantiator; /** * Base class for Sun 1.3 based instantiators. It initializes reflection access to static method * ObjectInputStream.allocateNewObject. * * @author Leonardo Mesquita */ public abstract class Sun13InstantiatorBase implements ObjectInstantiator { protected static Method allocateNewObjectMethod = null; private static void initialize() { if(allocateNewObjectMethod == null) { try { allocateNewObjectMethod = ObjectInputStream.class.getDeclaredMethod( "allocateNewObject", new Class[] {Class.class, Class.class}); allocateNewObjectMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } protected final Class type; public Sun13InstantiatorBase(Class type) { this.type = type; initialize(); } public abstract Object newInstance(); } objenesis-1.2/main/src/org/objenesis/instantiator/sun/Sun13Instantiator.java0000644000175000017500000000313311217544706027265 0ustar twernertwerner/** * Copyright 2006-2009 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.InvocationTargetException; import org.objenesis.ObjenesisException; /** * Instantiates a class by making a call to internal Sun private methods. It is only supposed to * work on Sun HotSpot 1.3 JVM. This instantiator will not call any constructors. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator */ public class Sun13Instantiator extends Sun13InstantiatorBase { public Sun13Instantiator(Class type) { super(type); } public Object newInstance() { try { return allocateNewObjectMethod.invoke(null, new Object[] {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-1.2/main/src/org/objenesis/instantiator/NullInstantiator.java0000644000175000017500000000166011216277155026464 0ustar twernertwerner/** * Copyright 2006-2009 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; /** * The instantiator that always return a null instance * * @author Henri Tremblay */ public class NullInstantiator implements ObjectInstantiator { /** * @return Always null */ public Object newInstance() { return null; } } objenesis-1.2/main/src/org/objenesis/instantiator/jrockit/0000755000175000017500000000000011635442734023753 5ustar twernertwernerobjenesis-1.2/main/src/org/objenesis/instantiator/jrockit/JRockit131Instantiator.java0000644000175000017500000000575211217544706031017 0ustar twernertwerner/** * 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 Sthl, BEA JRockit Product Manager. * */ package org.objenesis.instantiator.jrockit; import java.lang.reflect.Constructor; 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 7.0 JVMs, which are compatible with Java API 1.3.1. This instantiator will not * call any constructors. * * @author Leonardo Mesquita * @see org.objenesis.instantiator.ObjectInstantiator */ public class JRockit131Instantiator implements ObjectInstantiator { private Constructor mungedConstructor; private static Method newConstructorForSerializationMethod; private static void initialize() { if(newConstructorForSerializationMethod == null) { Class cl; try { cl = Class.forName("COM.jrockit.reflect.MemberAccess"); newConstructorForSerializationMethod = cl.getDeclaredMethod( "newConstructorForSerialization", new Class[] {Constructor.class, Class.class}); newConstructorForSerializationMethod.setAccessible(true); } catch(RuntimeException e) { throw new ObjenesisException(e); } catch(ClassNotFoundException e) { throw new ObjenesisException(e); } catch(NoSuchMethodException e) { throw new ObjenesisException(e); } } } public JRockit131Instantiator(Class type) { initialize(); if(newConstructorForSerializationMethod != null) { Constructor javaLangObjectConstructor; try { javaLangObjectConstructor = Object.class.getConstructor((Class[]) null); } catch(NoSuchMethodException e) { throw new Error("Cannot find constructor for java.lang.Object!"); } try { mungedConstructor = (Constructor) newConstructorForSerializationMethod.invoke(null, new Object[] {javaLangObjectConstructor, type}); } catch(Exception e) { throw new ObjenesisException(e); } } } public Object newInstance() { try { return mungedConstructor.newInstance((Object[]) null); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/instantiator/jrockit/JRockitLegacyInstantiator.java0000644000175000017500000000465611217544706031721 0ustar twernertwerner/** * 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 Sthl, 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 Object newInstance() { try { return safeAllocObjectMethod.invoke(null, new Object[] {type}); } catch(Exception e) { throw new ObjenesisException(e); } } } objenesis-1.2/main/src/org/objenesis/ObjenesisHelper.java0000644000175000017500000000534011217544532023510 0ustar twernertwerner/** * Copyright 2006-2009 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 clazz Class to instantiate * @return New instance of clazz */ public static Object 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 clazz Class to instantiate * @return New instance of clazz */ public static Serializable newSerializableInstance(Class clazz) { return (Serializable) 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 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 clazz Class to instantiate * @return Instantiator dedicated to the class */ public static ObjectInstantiator getSerializableObjectInstantiatorOf(Class clazz) { return OBJENESIS_SERIALIZER.getInstantiatorOf(clazz); } } objenesis-1.2/main/src/org/objenesis/ObjenesisSerializer.java0000644000175000017500000000300611216277155024402 0ustar twernertwerner/** * Copyright 2006-2009 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-1.2/main/src/org/objenesis/Objenesis.java0000644000175000017500000000271511216277155022356 0ustar twernertwerner/** * Copyright 2006-2009 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 clazz Class to instantiate * @return New instance of clazz */ Object 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 clazz Class to instantiate * @return Instantiator dedicated to the class */ ObjectInstantiator getInstantiatorOf(Class clazz); } objenesis-1.2/main/src/org/objenesis/ObjenesisException.java0000644000175000017500000000345211216277155024234 0ustar twernertwerner/** * Copyright 2006-2009 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. It will do normal exception wrapping for JDK 1.4 and more * and basic message wrapping for JDK 1.3. * * @author Henri Tremblay */ public class ObjenesisException extends RuntimeException { private static final long serialVersionUID = -2677230016262426968L; private static final boolean jdk14 = (Double.parseDouble(System .getProperty("java.specification.version")) > 1.3); /** * @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 == null ? null : cause.toString()); if(jdk14) { initCause(cause); } } /** * @param msg Error message * @param cause Wrapped exception */ public ObjenesisException(String msg, Throwable cause) { super(msg); if(jdk14) { initCause(cause); } } } objenesis-1.2/main/.settings/0000755000175000017500000000000011635442734016146 5ustar twernertwernerobjenesis-1.2/main/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000073010563721703022610 0ustar twernertwerner#Sun Feb 11 23:44:28 CET 2007 eclipse.preferences.version=1 formatter_profile=_Objenesis formatter_settings_version=10 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= objenesis-1.2/main/.settings/org.eclipse.core.resources.prefs0000644000175000017500000000013510563721703024353 0ustar twernertwerner#Sun Feb 11 23:44:27 CET 2007 eclipse.preferences.version=1 encoding/=ISO-8859-1 objenesis-1.2/main/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005253710563721703023137 0ustar twernertwerner#Sun Feb 11 23:42:08 CET 2007 eclipse.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.3 org.eclipse.jdt.core.compiler.compliance=1.3 org.eclipse.jdt.core.compiler.source=1.3 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_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_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_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.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_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.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_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.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.format_guardian_clause_on_one_line=false 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_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_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_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_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_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_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_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.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.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_tabs_only_for_leading_indentations=false