Branch: refs/heads/master Home: https://github.com/jenkinsci/bytecode-compatibility-transformer Commit: 2c07234bfba72220207d99a1fdca3025f9e99a22 https://github.com/jenkinsci/bytecode-compatibility-transformer/commit/2c07234bfba72220207d99a1fdca3025f9e99a22 Author: Kohsuke Kawaguchi <k...@kohsuke.org> Date: 2013-08-02 (Fri, 02 Aug 2013)
Changed paths: M pom.xml Log Message: ----------- add debug info Commit: b5d4585528fea12b2a0d2a97abee5914f4a2f365 https://github.com/jenkinsci/bytecode-compatibility-transformer/commit/b5d4585528fea12b2a0d2a97abee5914f4a2f365 Author: Kohsuke Kawaguchi <k...@kohsuke.org> Date: 2013-08-02 (Fri, 02 Aug 2013) Changed paths: M src/main/java/org/jenkinsci/bytecode/AdaptField.java M src/main/java/org/jenkinsci/bytecode/ClassRewriteSpec.java M src/main/java/org/jenkinsci/bytecode/MemberRewriteSpec.java M src/main/java/org/jenkinsci/bytecode/TransformationSpec.java M src/main/java/org/jenkinsci/bytecode/Transformer.java M src/test/client/Main.java M src/test/java/CompatibilityTest.java M src/test/v1/Foo.java M src/test/v2/Foo.java Log Message: ----------- Revisited the transformation. The byte code for a reference from a subype to a field in a super type is generated as if the field is available on the subtype. The actual field in the super-type is discovered at runtime. Because of this, matching both the owner and the field name doesn't rewrite all the possible references to a field that might be gone now. Unless we go build the type hierarchy of entire Java classes in the classloader (which makes the transformer require context beyond just the current class file image), this means we can only find out whether the field require rewriting at runtime. So now if A.i is adaopted to A.i(), anywhere else where a field "i" is referenced would have to be rewritten for a precaution: For example, given B b = ...; b.i = 4; It'd have to be transformed as follows: B b = ...; if (A.class.isAssignableFrom(B.class)) { b.i(4); } else { b.i = 4; } Fortunately, Class.isAssignableFrom is one of the HotSpot intrinsic function, meaning when both sides are constants like above, it gets inlined, and turns into: B b = ...; b.i = 4; or B b = ...; b.i(4); depending on whether B is actually a subtype of A. The other issue is that the target of rewrite is quite extensive, given that it just relies on name. In the next commit, I'll improve AdaptField to specify the former types of the field. Compare: https://github.com/jenkinsci/bytecode-compatibility-transformer/compare/e4cb1220c367...b5d4585528fe -- You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.