[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MutableClassInfo?

stale.pedersen@jboss.org do-not-reply at jboss.com
Wed Jan 14 08:40:58 EST 2009


"adrian at jboss.org" wrote : 
  | This just lets you create a ClassInfo from the bytecode.
  | But for this to work properly it needs to have a understanding as to which
  | classloader the class/bytecode should be assigned.
  | 
yes, well yes and no. when creating a CtClass object yes, when creating a ClassFile object then no. as mentioned ClassFile is a impl detail, but we need the functionality it brings. - but if we can implement what we currently need from ClassFile to *ClassInfo* then no.
eg, atm we can:ClassFile cf = new ClassFile( new DataInputStream(new FileInputStream(file)));

"adrian at jboss.org" wrote : 
  | "stale.pedersen at jboss.org" wrote : 
  |   | - do finegrained operations/checks ala annotation visibility (which is only possible with javassist and not java.lang.reflect afaik)
  |   | 
  | 
  | Not sure why you need this. I assume you mean being able to look
  | at annotations that are not Runtime visible? Is that really a good idea?
  | 
we use it a lot in aop so yes, we need it. 

"adrian at jboss.org" wrote : 
  | Unless you mean being able to get the resulting byte code from the manipulation
  | so you can defineClass() on it I don't think it is a good idea.
  | 
  | Allowing access to implementation details is not a good idea,
  | e.g. the deprecated TypeInfo.getClass() should not be there.
  | 
  | Instead we need to extend the abstraction to make this unnecessary.
  | This could include some helper methods to defineClass() from a ClassInfo.
  | 
i was not thinking of getting the .class. i was thinking of something like CtClass.getClassFile() since atm that is the only way we can get info like annotation visibility, but if we can implement to get that from TypeInfo/etc its not needed.

for now we havent added any methods to add/change methods/fields/etc to ClassInfo, we just changed the factory to not use the .class representation when creating the ClassInfo object to use the CtClass instead. - which i guess it was meant to anyway if im understanding adrian correct.

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

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



More information about the jboss-dev-forums mailing list