From dcb2473da044211101743c8dd1fa8f21d55e29cd Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 22 Jan 2003 01:25:44 +0000 Subject: [PATCH] fix for failing test case that aspects must be constructed after their clinit has run --- .../internal/compiler/ast/AspectClinit.java | 27 +++++++++++++++-- .../compiler/ast/AspectDeclaration.java | 8 ++--- tests/new/options11/aspectlib1.jar | Bin 1198 -> 1201 bytes tests/new/options11/aspectlib2.jar | Bin 966 -> 966 bytes tests/new/options11/injar.jar | Bin 363 -> 363 bytes .../org/aspectj/weaver/AjcMemberMaker.java | 13 ++++++-- .../src/org/aspectj/weaver/NameMangler.java | 4 ++- .../weaver/bcel/BcelCflowStackFieldAdder.java | 2 +- .../org/aspectj/weaver/bcel/BcelShadow.java | 28 +++++++++++++----- .../org/aspectj/weaver/bcel/LazyClassGen.java | 6 ++-- weaver/testdata/dummyAspect.jar | Bin 589 -> 589 bytes weaver/testdata/megatrace.jar | Bin 3555 -> 3558 bytes weaver/testdata/megatraceNoweave.jar | Bin 2709 -> 2712 bytes weaver/testdata/tracing.jar | Bin 2291 -> 2293 bytes 14 files changed, 67 insertions(+), 21 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java index d82e00cf0..4c929b91c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java @@ -21,28 +21,49 @@ import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.lookup.ClassScope; public class AspectClinit extends Clinit { - public AspectClinit(Clinit old, CompilationResult compilationResult) { + private boolean hasPre, hasPost; + + public AspectClinit(Clinit old, CompilationResult compilationResult, boolean hasPre, boolean hasPost) { super(compilationResult); this.needFreeReturn = old.needFreeReturn; this.sourceEnd = old.sourceEnd; this.sourceStart = old.sourceStart; this.declarationSourceEnd = old.declarationSourceEnd; this.declarationSourceStart = old.declarationSourceStart; + + this.hasPre = hasPre; + this.hasPost = hasPost; } protected void generateSyntheticCode( ClassScope classScope, CodeStream codeStream) { - if (!classScope.referenceContext.binding.isAbstract()) { + if (hasPre) { final EclipseWorld world = EclipseWorld.fromScopeLookupEnvironment(classScope); codeStream.invokestatic(world.makeMethodBindingForCall( - AjcMemberMaker.ajcClinitMethod( + AjcMemberMaker.ajcPreClinitMethod( world.fromBinding(classScope.referenceContext.binding) ))); } super.generateSyntheticCode(classScope, codeStream); } + + protected void generatePostSyntheticCode( + ClassScope classScope, + CodeStream codeStream) + { + super.generatePostSyntheticCode(classScope, codeStream); + if (hasPost) { + final EclipseWorld world = EclipseWorld.fromScopeLookupEnvironment(classScope); + + codeStream.invokestatic(world.makeMethodBindingForCall( + AjcMemberMaker.ajcPostClinitMethod( + world.fromBinding(classScope.referenceContext.binding) + ))); + } + + } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index 1ce398ea4..2ea980df5 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -169,13 +169,13 @@ public class AspectDeclaration extends MemberTypeDeclaration { } else if (perClause.getKind() == PerClause.SINGLETON) { binding.addField(world.makeFieldBinding(AjcMemberMaker.perSingletonField( typeX))); - methods[0] = new AspectClinit((Clinit)methods[0], compilationResult); + methods[0] = new AspectClinit((Clinit)methods[0], compilationResult, false, true); } else if (perClause.getKind() == PerClause.PERCFLOW) { binding.addField( world.makeFieldBinding( AjcMemberMaker.perCflowField( typeX))); - methods[0] = new AspectClinit((Clinit)methods[0], compilationResult); + methods[0] = new AspectClinit((Clinit)methods[0], compilationResult, true, false); } else if (perClause.getKind() == PerClause.PEROBJECT) { // binding.addField( // world.makeFieldBinding( @@ -367,7 +367,7 @@ public class AspectDeclaration extends MemberTypeDeclaration { ClassFile classFile) { final EclipseWorld world = EclipseWorld.fromScopeLookupEnvironment(this.scope); - generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcClinitMethod( + generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcPreClinitMethod( world.fromBinding(binding))), new BodyGenerator() { public void generate(CodeStream codeStream) { @@ -549,7 +549,7 @@ public class AspectDeclaration extends MemberTypeDeclaration { ClassFile classFile) { final EclipseWorld world = EclipseWorld.fromScopeLookupEnvironment(this.scope); - generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcClinitMethod( + generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcPostClinitMethod( world.fromBinding(binding))), new BodyGenerator() { public void generate(CodeStream codeStream) { diff --git a/tests/new/options11/aspectlib1.jar b/tests/new/options11/aspectlib1.jar index fe2883cb42e9a5d022cca131bd182c06e84c11ac..4028b829cd7bb378241bb0090126ae41e2cb00da 100644 GIT binary patch delta 1111 zcmV-d1gQJ239$(cP)h>@6aWYS2mqmtHIWT8e{v$fonRaXj3e8L#v+h_?EroS9E5F9 z%3u~iYt)uU$TO;$mhDi*o?l=AUywx}Rd#}_V3!3y5O%r{?yio``2{49CmG5w)#_fu+TB-_DCJ<#9dNp72hp{LN|Xoev1$CC?sIgJ#O zDMZl0aJpdGVx_TN67Ef2s*!Pb!7+Jlox7GA2a|2H+HV@C)y^0)a+8T@ss) zD@KnveR{-cG@rlBa4uVL+={`yI%QV%f786-SoRu0&M2N|XgwFK=XM3(5pHg-ykn_U z`;WCLN|&UVZ)|P~H-UbJgdcb$i9v?GY~g8Ba;_+!O<@4fkv^`l%fekQGfX|3Q>&*m zp2x5f?HsAW>vi(Pa4{@o%al);Je6nipUf)905lw13jP4`*0GEzg^i$j3WRW6#pb2;C zQA9HvA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z`hPiLIiwi^U55yf#~b(Y?p-|*MNU(F4{Ox!2L7jcoZ3ZaVJ$!ie{54({7(2IipUPP zY_Q02NrHO#jrOZU{tLBHtSg?ZwY)*YeSEYuYtZepYIR}kI_~H78aIXU=C{p{6zSf@GEJMGa_6iEaQFUIrKMBO9u#lwQQpf1ONbV2mk<3O928D02BZS00;m` ak1j5MwQQpf1ONbVlWzn(22%t800000Yz+he diff --git a/tests/new/options11/aspectlib2.jar b/tests/new/options11/aspectlib2.jar index 816803da4017ab18e638c837324ed036bcecee9e..698acc6381b3d26d739a0a0810317cb4f14d8aa5 100644 GIT binary patch delta 30 icmX@cevF+rz?+#xgnYl{@!+e9#~C{!AXngu749ov|%`c4lw! z`+q-we-__V(Zbpm9aX5f_o}m|*;y_2GRAc$+58Xa9KK*$kk-38c4bk4q+5menUW=| zemXAJEv=W>!=-eVSy9sKYPPve@{3rZT>B4SjhxHs61xwsY$<*8Epn#8CDGlnE`qI0 zMmszeL;pIgEB{`$qb+pULIVA=Tw|2dBFH!He3VLx} zUXty(cu>dZrd)m zF5-LT4c=F)+nvg`$g^4Yh#KTIoiMKyG0r*le$52WT!o1`R}QTc`m{8E(~I35tM5Ge zJtxsjbzAQR{w*(Fi3e@j`RJKl+eVQjABCG2xA06}uq^1?qX}Ax3!X0Yt6#9aY*pqu z)n%H(>>_C~>5T3%kv2`K+4(%d%7 z(Z1J}n`!&nA5RZg-Z?0+vF&YLP2{z8zx@q%)$%>REqQFazv0K*iz@FNeIoiVU{S2a z!M(*h&INwc_~t7fm&i9c{d)R|36HLn`^ZNxVE>-Gg5SXT^Y1D5wwrukpgFaE$(PM$ zp4VBUS&ILu%1_vKh}~%Z8{SB6{>++53nyQ(z52!ea@@C>Z%(U=*R^2{WH;+q-=E^6%g7 z{rvp>x&D)n9G`i%Z+YbOYjt~2&a68h&)uNxbk4C7R-kSp5Z z`7op@U|spQvL&~kSnDc%3s*WA9Ua4Z%>Upz*VU0u^DSR4m|s$=-0{**Zu`;;>+Owr z&YVqWF%eu@WvOU-ntjrH@6fosF#FbBilqu(8Vh!N9ON;sKO=P2e`Q^FduhFG)V6n@ zR|sDV<8RG*t-!@C@zo%$NyDsSjzP|@_iHA2uC<@~WmTX%=T9Sp$S*NRLi0Y=o->#% zc-u{+C932Lw`NpKVX^$-3^qf>32!{Y+A;$sOICY&Xa}x%y6{}xg6(Civev0C(-3A4 zVcsP8If@}hs`~@S&U(jt7L(5ZY@C-oYvmdfDZ3ToGc}`5eaSRivAdv)(fRDc>BlCq zHr@{V^XZ||yMzf5&SmyHb@H$8RhPJF*Z%n}Px9^M6902AD!og3#8q!_^_yS8dzp2` zQ|!HJF1LoyaDH<0t7Op~r~#-QxGUXKgb)R5kzZsrS89dQj}Z zocfpSDQiD8>L^q@UpwL~HUG&Al~RAz-|M$buT}e9*-@9{XVPllMuvPgnZy z721;gQr;!YJWu-O>CoqAXX$l&c*dWOxW40A-I^oG|D$GY%YIv};`&NCTIsfO_T<{5 zb5_>9vk&lQ=Qz%h8kWbzz|hLVz!1QLoF+FPWD?|L1}4tUSGmm@d4UW)xZ=r@yk-g@ z5pgzG=ZhQ+3~xml7=Q=~Y-E~zfk|9Dz?+dtgaMw=^`4&6z5foVYziX-gA9^#28N@P NH}dMU{pA4(0s!M`Qvv`0 diff --git a/weaver/testdata/megatraceNoweave.jar b/weaver/testdata/megatraceNoweave.jar index 8a62739958f60833c968af3908fdcbdf7990f1a9..dba8efbff861bd7ae49f6b1e677e26061971471a 100644 GIT binary patch delta 697 zcmbO#IzyB()I`!DI z;{n%~^0_ctetEibhGAP}(=W~|`SqVRJj-{{zE&%?_3*1#6DR1(x+L-m%c=Pa{kTtbZ`CIDdM|s$Hn9s9*kuS zF4ps|B?et7ITg2jiI+%L zZMXNYxl-S@Q17s;Pi&&b&DsOjNAGg)I9K>>hx&EzB3t7L;YH#?U;h=Sc$EHhZ zhiClhi13}y>ed`l-oM<}`qH;aiTb-ew)t%Hzozv26Muj=JIDS46@vmM28Q`83=Hs; z!2(Je8+kR^n1S?UOSTgMj7%a7@I<4BtVxss9h4L$Ca3DVR-`6}fLMCTIf=!^0p2J^ rOy0*S&9s?m@@-CKupNwC(oFX`Cd+Xth_JGO3}gnv3qX1kCx{0Cn;sYa delta 709 zcmbOsI#rZ6z?+#xgnKjip&!e0;bj z2H7#boj6gyUfY(-U-H*97h?|Qy=Nxq>gE_*tPY&IVcx=*Iidj#&lQ_rhxn;-JawzC z4_~Fb@3zW=0#%_sJI{tD{86dMJy|3cU^0`htuy?3^NcSQcP2UQ|8>A1D9S@KLn~-& z5&IPld9ON!(8{G7e;QsXUCA8iz*k$TmDZCuZ$TZ?*V#5}e%4E0>?)n_`gX&vGL;l> z_P`m3TiQK?UG|-O%y($p?`uLcueAw#u$`8eadG4fTvh<>)yVmfbMN| zdajeT^S(%^1vSVrTXof22Ui|RX*U#sq%CwW49 zCwFJne@mk!R)2Yo)ooAy_1x55z3t%dZ*%S~{Ub8%r0p7S)lQ}C{$r&F#SYG?-+z*M zN$o@1NQZB2YZ}?N*qsYd>kU)=JAG@?{1bNZNrA_X&v|(z@$L_spVblZwT~_e0Z6as1n~fP C3K@3* diff --git a/weaver/testdata/tracing.jar b/weaver/testdata/tracing.jar index 99744a6bc99d9432ef45e864439096a6775f5d1b..18bf1b7597bd5dcaa44302e5bfab23e216cb432d 100644 GIT binary patch delta 1001 zcmV@6aWYS2mqjsHIWSTKj`a(Bl-02CU;;-Yx zfABaG4CO`^v&2wZj(Red<~D;jJNJaaud5be&bV-un7TU-P(i7J5sWdMZOB;MA8c(1 z{g`j`2t3hH5$`?WT3SEb99?#K1Dv&yKE^4x*^~*xw9U=iM(9Vv40KEkXEH`JH!1S^ zY@^G!dD!D|Cw#Ec6_Hswy<^EtAlo1=prsL1Y%d3#cFj&n$2nn zmnq*c;}lQ)Z0pqurg4?j;QhXcTMY9#&CQ*PPOA~4_b_8KyiYe}RC>m6ZuWEpe_^j< z)?()v-pXmOh!1F5`gWri2Q)lHZ5}lSrtA%#B1Kw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