[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Weird bytecode generated by AspectJ 1.2
|
That would be a bad bug. If/since this is reproducible, please submit it as a bug report; that way it gets the fastest response from a developer.
Thanks -
Wes
> ------------Original Message------------
> From: Hristo Stoyanov <hr_stoyanov@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Jul-14-2004 11:57 PM
> Subject: [aspectj-users] Weird bytecode generated by AspectJ 1.2
>
> Hi all-,
> Can anyone explain why would AspectJ would generate
> bad bytecode, so the JVM would reject it:
> -----------------------------------------
> [java] There was 1 error:
> [java] 1)
> testWriteRead(exceedsoft.test.StoreJTSObjectsTestCase)java.lang.V
> erifyError: (class:
> org/garret/perst/aspectj/PersistenceAspect, method:
> <clinit>
> signature: ()V) Stack size too large
> [java] at
> com.vividsolutions.jts.geom.Coordinate.<init>(Unknown
> Source)
>
> [java] at
> com.vividsolutions.jts.geom.Coordinate.<init>(Unknown
> Source)
> -----------------------------------------
> I get this after binary aspect weaving with AspectJ
> 1.2 and running J2SE 1.4.2_05 undex XP. See
> attachemnts for the problem (the attached JARS are not
> woven into)
>
> Thanks,
> Hristo
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail/*
> * Created on Jan 24, 2004
> */
> package org.garret.perst.aspectj;
>
> /**
> * Base interface for all classes automatically treated as persistent
> capable.
> * Programmer should either explicitly add this interface to all
> classes which he want to be persistent
> * capable or add this interface using AspectJ <code>declare
> parents:</code> construction.
> * This interface doesn't allow to access fields of external (non-this)
> object,
> * you should use getter/setter methods instead.
> * If you want to provide access to external fields you should use
> StrictAutoPersist interface.
>
> * @author Patrick Morris-Suzuki
> *
> */
> public interface AutoPersist {
>
> }
>
> /*
> * Created on Jan 24, 2004
> *
> * To change the template for this generated file go to
> * Window>Preferences>Java>Code Generation>Code and
> Comments
> */
> package org.garret.perst.aspectj;
>
> /**
> * @author Patrick Morris-Suzuki
> *
> */
>
> import org.garret.perst.*;
>
> privileged public aspect PersistenceAspect {
> declare parents: AutoPersist extends IPersistent;
>
> pointcut notPerstCode(): !within(org.garret.perst.*) &&
> !within(org.garret.perst.impl.*) && !within(org.garret.perst.aspectj.*);
>
> pointcut persistentMethod():
> execution(!static * ((Persistent+ && !Persistent) ||
> (AutoPersist+ && !(StrictAutoPersist+) && !AutoPersist)).*(..))
> && !execution(void *.recursiveLoading());
>
> /*
> * Load object at the beginning of each instance mehtod of
> persistent capable object
> */
> before(IPersistent t) : persistentMethod() && this(t) {
> t.load();
> }
>
> /*
> * Read access to fields of persistent object
> */
> before(StrictAutoPersist t): get(!transient !static *
> StrictAutoPersist+.*) && notPerstCode() && target(t)
> {
> t.load();
> }
>
> /*
> * Read access to fields of persistent object
> */
> before(StrictAutoPersist t): set(!transient !static *
> StrictAutoPersist+.*) && notPerstCode() && target(t)
> {
> t.loadAndModify();
> }
>
> /*
> * Automatically notice modifications to any fields.
> */
> before(AutoPersist t): set(!transient !static * (AutoPersist+ &&
> !(StrictAutoPersist+)).*)
> && notPerstCode() && !withincode(*.new(..)) && target(t)
> {
> t.modify();
> }
>
> public void AutoPersist.assignOid(Storage s, int o, boolean r) {
> oid = o;
> storage = s;
> state = r? RAW : 0;
> }
>
> boolean around(AutoPersist me, Object other):
> execution(boolean AutoPersist+.equals(Object)) &&
> args(other) && target(me){
> if(other==null) return false;
>
> boolean isEqual;
> try{
> isEqual=proceed(me, other);
> } catch(ClassCastException excep){
> if(!other.getClass().equals(me.getClass()))
> return false;
> else
> throw excep;
> }
> if(!isEqual){
> if(other!=null && other instanceof IPersistent){
> if(((IPersistent)other).getOid()==me.oid) isEqual=true;
> }
> }
> return isEqual;
> }
>
> int around(AutoPersist me):
> execution(int AutoPersist+.hashCode()) && target(me){
> return me.oid;
> }
>
> public void AutoPersist.commit() {
> if (storage !=null)
> storage.commit();
> }
>
> public void AutoPersist.load() {
> if (storage != null && (state & RAW) != 0) {
> storage.loadObject(this);
> }
> }
>
> public void AutoPersist.loadAndModify() {
> load();
> modify();
> }
>
> public final boolean AutoPersist.isRaw() {
> return (state & RAW) != 0;
> }
>
> public final boolean AutoPersist.isModified() {
> return (state & DIRTY) != 0;
> }
>
> public final boolean AutoPersist.isPersistent() {
> return oid != 0;
> }
>
> public void AutoPersist.makePersistent(Storage storage) {
> if (oid == 0) {
> storage.storeObject(this);
> }
> }
>
> public void AutoPersist.store() {
> if ((state & RAW) != 0) {
> throw new StorageError(StorageError.ACCESS_TO_STUB);
> }
> if (storage != null) {
> storage.storeObject(this);
> state &= ~DIRTY;
> }
> }
>
> public void AutoPersist.modify() {
> if ((state & DIRTY) == 0 && storage != null) {
> if ((state & RAW) != 0) {
> throw new StorageError(StorageError.ACCESS_TO_STUB);
> }
> storage.modifyObject(this);
> state |= DIRTY;
> }
> }
>
> public final int AutoPersist.getOid() {
> return oid;
> }
>
> public void AutoPersist.deallocate() {
> if (storage != null) {
> storage.deallocateObject(this);
> state = 0;
> storage = null;
> }
> }
>
> public boolean AutoPersist.recursiveLoading() {
> return false;
> }
>
> public final Storage AutoPersist.getStorage() {
> return storage;
> }
>
> public void AutoPersist.onLoad() {
> }
>
> public void AutoPersist.invalidate() {
> state |= RAW;
> }
>
> public void AutoPersist.finalize() {
> if ((state & DIRTY) != 0 && storage != null) {
> storage.storeFinalizedObject(this);
> state &= ~DIRTY;
> }
> }
>
> public void AutoPersist.readExternal(java.io.ObjectInput s) throws
> java.io.IOException, ClassNotFoundException
> {
> oid = s.readInt();
> }
>
> public void AutoPersist.writeExternal(java.io.ObjectOutput s)
> throws java.io.IOException
> {
> s.writeInt(oid);
> }
>
> private transient Storage AutoPersist.storage;
> private transient int AutoPersist.oid;
> private transient int AutoPersist.state;
>
> private static final int RAW = 1;
> private static final int DIRTY = 2;
> }
>
> /*
> * Created on Jan 25, 2004
> *
> * To change the template for this generated file go to
> * Window>Preferences>Java>Code Generation>Code and
> Comments
> */
> package org.garret.perst.aspectj;
>
> /**
> * @author Patrick Morris-Suzuki
> *
> */
>
> public aspect SafeHashAspect {
>
> declare precedence: PersistenceAspect+, SafeHashAspect;
>
> int around(SafeHashCode me):
> execution(int SafeHashCode+.hashCode()) &&
> target(me){
> return me.safeHashCode();
> }
> }
>
> /*
> * Created on Jan 25, 2004
> *
> * To change the template for this generated file go to
> * Window>Preferences>Java>Code Generation>Code and
> Comments
> */
> package org.garret.perst.aspectj;
>
> /**
> * @author Patrick Morris-Suzuki
> *
> */
> public interface SafeHashCode {
> public int safeHashCode();
> }
>
> /*
> * Created on Feb 08, 2004
> */
> package org.garret.perst.aspectj;
>
> /**
> * Base interface for all classes automatically treated as persistent
> capable which needs
> * to provide external access to their fields. Using this interface
> will significantly decrease
> * efficiency of result code, because any access to instance fields of
> this class (doesn't matter access
> * to self or foreign field) will be prepended by invocation of load()
> method. As far as
> * OOP design rules recommend to made all fields private or protected
> and access them only through methods,
> * I highly recommend you to avoid access to foreign fields and do not
> use this code.
> * Access fields through getter methods will be in any case much
> efficient.
> */
> public interface StrictAutoPersist extends AutoPersist {
>
> }
>
>
> import org.garret.perst.*;
> import org.garret.perst.aspectj.*;
>
> import com.vividsolutions.jts.geom.*;
>
> privileged public aspect PerstGeometry
> {
> declare parents: com.vividsolutions.jts.. implements AutoPersist;
> declare parents: org.geotools.. implements AutoPersist;
> }
>
>