Community
Participate
Working Groups
I tried to use aspectj to weave JACK generated java files. JACK is an agent- oriented extention to Java; JACK files will first be compiled with JACK compiler and corresponding java files will be generated; then I compiled those java files with aspects together. However, ajc gave the error messages below though JACK compiler, which use javac to compile java files, can compile the same files with no problem. can't find type aos.jack.jak.agent.Agent$oB can't find type aos.jack.jak.agent.Agent$NmPw Followed are the 3 files that can reproduce the error. You need the Jack JAR file to compile them. I could send it to you if you want. /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* This code is generated by JAC version 4.0 by Agent Oriented Software. http://www.agent-software.com.au DO NOT ALTER THIS CODE AND DO NOT REMOVE THIS COMMENT *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ import aos.jack.jak.agent.DataCreator; import aos.jack.jak.agent.Agent; class Wilson extends Agent { public Test left; void go() { } Wilson(String name) { super(name); boolean __b = getAgentType() == Wilson.class; if (__b) { __init1(); __init2(); } if (__b) startAgent(); } public static void main(String[] args) { args = aos.jack.Kernel.init(args); new Wilson("wilson").go(); } public Class getAgentType() { return Wilson.class; } public void __init1() { super.__init1(); setNamedCreator("left","Test",new DataCreator(true){public Object create() { return __named_data_left(); } },true); } public void __init2() { super.__init2(); getNamedObject("left","Test"); } synchronized private void __init_desc() { addNamedObject("left","Test",Agent.WRITEABLE); } public void init_desc() { newAgentDesc("Wilson"); super.init_desc(); __init_desc(); } synchronized public void __bindNames() { super.__bindNames(); } private Test __named_data_left() { if (left != null) return left; left = new Test(); if (!left.attach(this)) left = null; setNamedObject("left","Test",left); return left; } } /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* This code is generated by JAC version 4.0 by Agent Oriented Software. http://www.agent-software.com.au DO NOT ALTER THIS CODE AND DO NOT REMOVE THIS COMMENT *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ import aos.jack.jak.beliefset.Tuple; public class Test__Tuple extends Tuple implements aos.apib.Base, java.io.Serializable { public static final __SS streamer = new __SS(); public aos.apib.StreamerSupport getStreamer() { return streamer; } public int hashCode() { streamer.setup(); return aos.apib.Util.hashCode(this); } public boolean equals(Object o) { if (!(o instanceof aos.apib.Base)) return false; return aos.apib.Util.equals(this, (aos.apib.Base)o); } public String tag; public String value; public Test__Tuple(boolean v) { super(); isFree = v; } public String name() { return "Test__Tuple"; } public String toString() { StringBuffer __s = new StringBuffer(); __s.append(tag); __s.append(":"); __s.append(value); return __s.toString(); } public int hash(int __i) { int __r = 0; switch (__i) { case 0: { __r ^= (tag.hashCode() & (~(1 << 31))); return __r; } case 1: { __r ^= (value.hashCode() & (~(1 << 31))); __r ^= (tag.hashCode() & (~(1 << 31))); return __r; } case 2: { __r ^= (value.hashCode() & (~(1 << 31))); return __r; } } return 0; } public Test__Tuple() { streamer.setup(); if (!getStreamer().initialized) return; __init__Test__Tuple(); } void __init__Test__Tuple() { tag = "null"; value = "null"; } static class __SS extends aos.apib.StreamerSupport { Test__Tuple __def = null; public aos.apib.Base getDefaultInstance() { return __def; } private String[] fn = { ":tag", ":value", }; private String[] dn = { ":tag", ":value", }; private boolean[] ftr = { false, false, }; private boolean[] fst = { false, false, }; private boolean[] fhd = { false, false, }; private int[] ft = { 10, 10, }; private aos.apib.EnumInfo[] fe = { null, null, }; private String[] cm = { null, null, }; private aos.apib.StreamerSupport[][] al = { null, null, }; private String[] fsubt = { null, null, }; public __SS() { __type = "Test__Tuple"; __icon = null; __comment = "Auto generated by JAC - The JAC Java Agents Compiler"; __field_names = fn; __display_names = dn; __field_types = ft; __field_static = fst; __field_hidden = fhd; __field_transient = ftr; __field_subtypes = fsubt; __field_comments = cm; __enuminfos = fe; __allowed = al; register(__type, this); } private boolean setup_done = false; protected void setup() { if ( setup_done ) return; setup_done = true; __def = (Test__Tuple)newInstance(); setStreamedType(__def.getClass()); baseclasses = findBaseStreamer(__def.getClass()); } protected void init() { setup(); __def.__init__Test__Tuple(); } public boolean isDummy() { return false; } public aos.apib.Base new_instance() { return new Test__Tuple(); } public aos.apib.Base[] new_array(int n) { return new Test__Tuple[n]; } public boolean read(aos.apib.InStream in, aos.apib.Base o) { int i = -1; while ((i = in.nextField(i, this)) >= 0) if ( !readField( in, o, i ) ) return false; return true; } public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) { if ( i > __field_names.length ) return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 ); Test__Tuple v = (Test__Tuple)o; switch (i) { case 0: v.tag = in.getString(true); break; case 1: v.value = in.getString(true); break; case 2: in.readBaseClasses(o, this, 0); break; default: if (i >= 0 && i <= 2) break; in.error("Reader for Test__Tuple: illegal field number:"+i); return false; } return true; } public boolean write(aos.apib.OutStream out, aos.apib.Base o) { Test__Tuple v = (Test__Tuple)o; int i = -1; while ((i = out.nextField(i, this)) >= 0) { switch (i) { case 0: out.putString(v.tag, i, __def.tag, this); break; case 1: out.putString(v.value, i, __def.value, this); break; case 2: out.writeBaseClasses(o, this); break; default: if (i >= 0 && i <= 2) break; out.error("Writer for Test__Tuple: illegal field number:"+i); return false; } } return true; } public boolean isDefault(aos.apib.Base o) { Test__Tuple v = (Test__Tuple)o; if (v.tag != __def.tag) { if (v.tag == null) return false; if (__def.tag == null) return false; if (!v.tag.equals(__def.tag)) return false; } if (v.value != __def.value) { if (v.value == null) return false; if (__def.value == null) return false; if (!v.value.equals(__def.value)) return false; } if (baseclasses != null && baseclasses.length == 1) return baseclasses[0].isDefault(o); return true; } public void findNonApib(aos.apib.OutStream out, aos.apib.Base o) { Test__Tuple v = (Test__Tuple)o; if (baseclasses != null && baseclasses.length == 1) baseclasses[0].findNonApib(out, o); } } }; /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* This code is generated by JAC version 4.0 by Agent Oriented Software. http://www.agent-software.com.au DO NOT ALTER THIS CODE AND DO NOT REMOVE THIS COMMENT *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ import aos.jack.jak.core.Jak; import aos.jack.jak.event.EventRecipient; import aos.jack.jak.beliefset.ClosedWorld; import aos.jack.jak.beliefset.ClosedWorldCursor; import aos.jack.jak.beliefset.BeliefSetCursor; import aos.jack.jak.beliefset.BeliefSetException; import aos.jack.jak.beliefset.Tuple; import aos.jack.jak.beliefset.BeliefSet; import aos.jack.jak.logic.Variable; import aos.jack.jak.logic.ChoicePoint; import aos.jack.jak.cursor.BeliefState; import aos.jack.jak.cursor.Cursor; class Test extends ClosedWorld { static public Test__Tuple __hole = new Test__Tuple(true); public Test__Tuple[][] __tables; public boolean attach(EventRecipient __h) { Object __o = __h; if (!super.attach(__h)) return false; return true; } public BeliefSetCursor get(String __v0, String __v1) throws aos.jack.jak.beliefset.BeliefSetException { Test__Tuple __t = new Test__Tuple(); __Cursor __c = new __Cursor(__t); __t.tag = __v0; __t.value = __v1; __c.init(1,this); return __c; } public BeliefSetCursor get(String __v0, Variable __v1) throws aos.jack.jak.beliefset.BeliefSetException { Test__Tuple __t = new Test__Tuple(); __Cursor __c = new __Cursor(__t); __t.tag = __v0; if (!__v1.check_unifiable(StringType)) throw new BeliefSetException("Test:get:IO: arg 1 value Incorrect Variable type"); if (__v1.isGround()) { try { __t.value = __v1.as_string(); } catch (Exception e) { throw new BeliefSetException("Test:get:IO: got " + e.toString()); } } else __c.value = __v1; __c.init(0,this); return __c; } public BeliefSetCursor get(Variable __v0, String __v1) throws aos.jack.jak.beliefset.BeliefSetException { Test__Tuple __t = new Test__Tuple(); __Cursor __c = new __Cursor(__t); if (!__v0.check_unifiable(StringType)) throw new BeliefSetException("Test:get:OI: arg 0 tag Incorrect Variable type"); if (__v0.isGround()) { try { __t.tag = __v0.as_string(); } catch (Exception e) { throw new BeliefSetException("Test:get:OI: got " + e.toString()); } } else __c.tag = __v0; __t.value = __v1; __c.init(2,this); return __c; } public int keyIndex() { return 0; } public int fullIndex() { return 1; } public int nIndexes() { return 3; } public Tuple newTuple() { return new Test__Tuple(); } public Tuple getTuple(int t, int l) { return __tables[t][l]; } public Tuple[] newTable(int t) { return new Test__Tuple[t]; } public Tuple[][] newTables(int t) { return new Test__Tuple[t][]; } public Tuple[] getTable(int t) { return __tables[t]; } public Tuple[][] getTables() { return __tables; } public void setTables(Tuple[][] t) { __tables = (Test__Tuple[][]) t; } public BeliefSetCursor newCursor(Tuple __t) { if (__t instanceof Test__Tuple) return new __Cursor((Test__Tuple) __t); return null; } public void add(String __v0, String __v1) throws aos.jack.jak.beliefset.BeliefSetException { add(__v0,__v1,Cursor.TRUE); } public void add(String __v0, String __v1, BeliefState __d) throws aos.jack.jak.beliefset.BeliefSetException { Test__Tuple __t = new Test__Tuple(); __t.tag = __v0; __t.value = __v1; super.assertTuple(__t,__d); } public void remove(String __v0, String __v1) throws aos.jack.jak.beliefset.BeliefSetException { remove(__v0,__v1,Cursor.TRUE); } public void remove(String __v0, String __v1, BeliefState __d) throws aos.jack.jak.beliefset.BeliefSetException { Test__Tuple __t = new Test__Tuple(); __t.tag = __v0; __t.value = __v1; super.retractTuple(__t,__d); } public Test() { } public Test(String n) { super(); read(n); } class __Cursor extends ClosedWorldCursor { public Test__Tuple __tuple = null; public Variable tag; public Variable value; public __Cursor() { __tuple = __hole; } public __Cursor(Test__Tuple __t) { super(); __tuple = __t; } public int match(int __ti, int __st, int __c, boolean __k, int __ind) { Test__Tuple[] __tab = __tables[__ti]; Test__Tuple __t; int __sz = __tab.length; int __i; if ((Jak.debugging & Jak.LOG_DB) != 0) { Jak.log.log("Test__Tuple:match:" + __ti + ":" + __st + ":" + __c + ":" + __k + ":" + __ind); Jak.log.log("Tuple=" + __tuple); Jak.log.log("Outputs are"); Jak.log.log(" tag:" + tag); Jak.log.log(" value:" + value); } for (__i = __st; __c > 0; __i = (__i + 1) % __sz, __c-- ) { __t = __tab[__i]; if (__t == null) { if (__ind < 0) continue; return -1; } if (__t == __hole) continue; if (__t.isFree) { __tab[__i] = __hole; continue; } if ((Jak.debugging & Jak.LOG_DB) != 0) Jak.log.log("t" + __i + ":" + __t); try { if (cp != null) cp.backtrack(); if (tag == null) { if (!__tuple.tag.equals(__t.tag)) continue; } else { if (!tag.unify(__t.tag)) continue; } if (__k) return __i; if (value == null) { if (!__tuple.value.equals(__t.value)) continue; } else { if (!value.unify(__t.value)) continue; } } catch (Exception e) { continue; } return __i; } return -1; } public int hash(int __i) { return (__tuple == null?0:__tuple.hash(__i)); } public ChoicePoint getChoicePoint() { if (tag != null) return tag.env.newChoicePoint(); if (value != null) return value.env.newChoicePoint(); return null; } public boolean isKeyGround() { if (tag != null) return false; return true; } } }
As I told professor Voles on the phone, I'd be happy to look into this bug if you can provide me with a complete .zip file and simple instructions for reproducing your error using that .zip file. This probably means that you need to include the JACK jar file as well.
Thanks to the code submitted by Feilong Chen this was easy to track down and fix in the current tree. The cause of the bug is that the .jar file for JACK contains .class files that appear to violate section 4.7.5 "The InnerClasses Attribute" of the JVM Spec v2. The compiler was assuming that class files would obey that section. The fix was to relax that assumption. There is currently no test in the test suite for this bug because of the difficulty in constructing class files that violate the spec and our inability to include the proprietary jack code in our test suite. I've changed the status of this bug to enhancement to keep the not that we need a test case for this situation.
*** Bug 35066 has been marked as a duplicate of this bug. ***
LATER/REMIND bugs are being automatically reopened as P5 because the LATER and REMIND resolutions are deprecated.