1 2 3 4 Previous Next 51 Replies Latest reply on Mar 17, 2009 6:10 AM by kabirkhan Go to original post
      • 30. Re: MutableClassInfo?
        alesj

        Fine by me.

        • 31. Re: MutableClassInfo?
          stalep

           

          "alesj" wrote:
          Fine by me.

          cool. - another suggestion...
          is it ok if i change ModifierInfo to a enum?
          atm its just a interface with integers, so methods like:
          MutableFieldInfo createMutableField/Method/Constructor(ModifierInfo modifier, String type, String name);
          wont make make any sense since its impossible to send a ModifierInfo object to the method. instead we have to change the signature of the method to something like:
          MutableFieldInfo createMutableField/Method/Constructor(int modifier, String type, String name);

          the enum version of ModifierInfo would look something like:
          public enum ModifierInfo
          {
           PUBLIC(Modifier.PUBLIC), PRIVATE(Modifier.PRIVATE),....
           private final int modifier;
           ModifierInfo(int modifier) {this.modifier = modifier; }
           public int getValue() { return modifier; }
           public boolean isPublic/isStatic/isVolatile/etc;
          }

          - and we need to remove ModifierInfo as a interface on ClassInfo etc, but i feel this is a better solution..?

          • 32. Re: MutableClassInfo?
            alesj

            Sure.

            But can you do then a quick check on how much of
            other MC things break with this change?

            • 33. Re: MutableClassInfo?
              stalep

              yup, ill take a look. do you have any overview of which modules that use it?

              • 34. Re: MutableClassInfo?
                alesj

                 

                "stale.pedersen@jboss.org" wrote:
                do you have any overview of which modules that use it?

                Apart from VFS, it could be any other MC sub-project.

                • 35. Re: MutableClassInfo?
                  stalep

                  i checked all the mc modules and couldnt find any occurrences of ModifierInfo so it seems we're in the clear.

                  ive finished most of the implementation except the usage of ExprEditor. from what i can see now, this is the last thing aop uses that i havent implemented in reflect.
                  take a look at CtBehaviour.instrument(ExprEditor) and for a example of how aop uses it: org.jboss.aop.instrument.CallerTransformer$CallerExprEditor.
                  the only way i can see we support this is to add something similar to whats in javassist.expr.* to jboss-reflect spi. imo this is something very javassist specific and not something we really should have in the spi.
                  one solution could be that we add the interfaces to the javassist package (org.jboss.reflect.plugins.javassist) and just add the method to the Javassist* implementation classes.

                  • 36. Re: MutableClassInfo?
                    alesj

                     

                    "stale.pedersen@jboss.org" wrote:

                    one solution could be that we add the interfaces to the javassist package (org.jboss.reflect.plugins.javassist) and just add the method to the Javassist* implementation classes.

                    What about extracting ExprEditor's api in some our interface
                    and than having the only impl based on Javassist.
                    (just thinking outloud)

                    Or this doesn't make sense as you need too much Javassist specific
                    things from this ExprEditor?



                    • 37. Re: MutableClassInfo?
                      stalep

                       

                      "alesj" wrote:

                      What about extracting ExprEditor's api in some our interface
                      and than having the only impl based on Javassist.
                      (just thinking outloud)

                      Or this doesn't make sense as you need too much Javassist specific
                      things from this ExprEditor?

                      from what i can see this is very javassist specific and i cant see how it might fit in for a different bytecode library (mostly thinking of cglib (not that i know that much cglib :)).
                      another problem is that we cant make this as generic as we want since we're limited to make the implementation we have work directly with javassist (since the user of the spi will extend and create its own expreditor). our implementation must look something like:
                      public class BodyTranslatorImpl extends ExprEditor implements BodyTranslator { ... }
                      where BodyTranslator have the same methods as ExprEditor and BodyTranslatorImpl is just an empty "delegator" that convert jboss-reflect object to javassist. not even sure this might work, but thats the only solution i can see now that will solve the problem.

                      any better ideas that might solve it are highly appreciated.

                      • 38. Re: MutableClassInfo?
                        alesj

                        Why does it have to be on a MutableX in the first place?

                        I guess having a custom interface is OK,
                        but then you need to separate your AOP code as well,
                        to have this part in configurable (depending on the actuall Reflect impl) class.

                        e.g.
                        org.jboss.aop.bodyt.BodyTranslator
                        org.jboss.aop.bodyt.javassist.JavassistBodyTranslator
                        org.jboss.aop.bodyt.cglib.CGLibBodyTranslator

                        • 39. Re: MutableClassInfo?
                          stalep

                           

                          "alesj" wrote:
                          Why does it have to be on a MutableX in the first place?
                          because this is basically an advanced method/field/constructor editor so it only makes sense that its on a Mutable object imo.
                          "alesj" wrote:

                          I guess having a custom interface is OK,
                          but then you need to separate your AOP code as well,
                          to have this part in configurable (depending on the actuall Reflect impl) class.

                          yes this is true, but as i mentioned i felt that this was very javassist specific. but i can add it to the spi package if you want.

                          atm ive added it to org.jboss.reflect.plugins.javassist.expr and yes this means we need to have javassist specific code in aop, but this is something we think we'll have anyway since aop uses a lot of methods we have decided to keep out of the org.jboss.reflect.spi package.
                          eg methods like: CtNewMethod.getter/abstract/etc are all methods that aop uses, but after discussing it with kabir we felt that this would clutter up the api. so we decided that we would rather make some sort of util classes that support this.

                          The very best thing(tm) imo, would be that we dont implement anything too javassist specific in jboss-reflect, but aop is an advanced user of javassist so this would require a lot of rewrites to aop.
                          - do you have any input on this kabir?


                          • 40. Re: MutableClassInfo?
                            stalep

                            after the conf call with luc i guess that we dont need to implement the expression editor at all since i cant see us changing aop to use jboss-reflect anyway. - i guess we'll be teammates alesj :)

                            so i guess i have to ask if the work ive done on jboss-reflect is something you still want in the module?
                            if so im almost done, the only thing that remains is the classloader issue, but that might not be any issue if aop wont use it anyway (support of scoped classloading/the new classloader integration kabir has been working on).
                            if its not something that we need for jboss-reflect i think ill be ready to migrate the changes ive done to jboss-reflect/trunk by the beginning of next week.

                            • 41. Re: MutableClassInfo?
                              alesj

                               

                              "stale.pedersen@jboss.org" wrote:

                              so i guess i have to ask if the work ive done on jboss-reflect is something you still want in the module?

                              Sure, I don't see why your work would go to waste.

                              "stale.pedersen@jboss.org" wrote:

                              if so im almost done, the only thing that remains is the classloader issue, but that might not be any issue if aop wont use it anyway (support of scoped classloading/the new classloader integration kabir has been working on).
                              if its not something that we need for jboss-reflect i think ill be ready to migrate the changes ive done to jboss-reflect/trunk by the beginning of next week.

                              Classloader issue where? In jboss-reflect?
                              The scoped pool per classloader?



                              • 42. Re: MutableClassInfo?
                                stalep

                                 

                                "alesj" wrote:

                                Classloader issue where? In jboss-reflect?
                                The scoped pool per classloader?

                                its mentioned earlier in this thread that the way jboss-reflect works with just using javassist.ClassPool.getDefault() wouldnt work with aop (scoped, etc). what kabir is/was working on was to extract the classloading logic out of aop to a separate module that could be used by jboss-reflect to support whatever aop needed. im not sure if kabir will finish this at all anymore and even more if jboss-reflect need it since aop wont be changed to use it anyway.


                                • 43. Re: MutableClassInfo?
                                  alesj

                                   

                                  "stale.pedersen@jboss.org" wrote:
                                  im not sure if kabir will finish this at all anymore and even more if jboss-reflect need it since aop wont be changed to use it anyway.

                                  If there was already some work being done,
                                  to make this more flexible, I think we should finish that.
                                  But it definitely depends no how much work still needs to be done.
                                  As this is not high priority.

                                  • 44. Re: MutableClassInfo?
                                    kabirkhan

                                     

                                    "stale.pedersen@jboss.org" wrote:
                                    im not sure if kabir will finish this at all anymore and even more if jboss-reflect need it since aop wont be changed to use it anyway.


                                    I think this will need doing, it should be trivial.

                                    (The cl stuff Ståle was talking about is http://www.jboss.org/index.html?module=bb&op=viewtopic&t=150699. The ideas I have there so far are crap, I'll think more about these over the weekend and come up with some better suggestions.)