Hi!

I made a Precondition annotation like this

@PreCondition(condition="i > 1")
public int check(int i) {
  System.err.println("check");
  return ++i;
}

a program finds this annotation an compiles an if-check into the method with 
CtMethod.insertBefore(...). Theoretically the result is:

public int check(int i) {
        if(!(i > 1)) throw new RuntimeException("PreCondition failed.....");
        System.err.println("check");
        return ++i;
}


it works okay when i use it like above.

following is not working:

@PreCondition(condition="(i != null) && (i > 1)")
public int check(Integer i) {   // !!! changed from int to Integer
        System.err.println("check");
        return ++i;
}

it says: javassist.CannotCompileException: [source error] invalid types for >

so the compiler of javassist is not able to do the auto-boxing that java 5.0 
does.

for me this feature is not absolutely necessary yet but its an interesting 
effect




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3925361#3925361

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3925361


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to