tag:blogger.com,1999:blog-3237092529299307504.comments2024-03-19T05:58:41.543+01:00My daily JavaRafaelhttp://www.blogger.com/profile/06973690867431113468noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-3237092529299307504.post-87349290949523336412017-12-23T00:00:33.438+01:002017-12-23T00:00:33.438+01:00Very nice article and explanation; thanks for writ...Very nice article and explanation; thanks for writing it!Michael Eichberghttps://www.blogger.com/profile/05388069398082429530noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-38803675388981132082017-11-17T16:11:51.800+01:002017-11-17T16:11:51.800+01:00This seems like expected behaviour to me.
Why shou...This seems like expected behaviour to me.<br />Why should the class objects be that same size as an instance of the class?Mikahttps://www.blogger.com/profile/17783205128658850667noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-73355767231642522962017-05-23T13:23:48.244+02:002017-05-23T13:23:48.244+02:00I am very happy for such good solution for convert...I am very happy for such good solution for converting the docx file to pdf. I am serching for this code on internet from last 2 months, I got many codes on internate but code can't work properly. Thank you so much for providing such good code.Nickhttps://www.blogger.com/profile/03291389800927288303noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-2738273070059694942017-05-12T01:06:09.740+02:002017-05-12T01:06:09.740+02:00I reviewed a lot of Jigsaw posts and mails in the ...I reviewed a lot of Jigsaw posts and mails in the mailing list, still haven't found a single good argument against module isolation.<br /><br />Arguments I saw:<br />It is hard<br />We don't have time<br />It won't work for 100% cases<br />Classloaders will be different <br /><br />So far, only second argument looks like a true one. But having it wrong just to be on time is worse.relgameshttps://www.blogger.com/profile/06250226161958756231noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-19734292747596308272017-05-11T16:18:10.249+02:002017-05-11T16:18:10.249+02:00This blog posting was written to explain why I dis...This blog posting was written to explain why I disagree. There are few arguments that do not relate to integration with existing module systems and I do not think this should be the priority, given the wide range of Java usages and how this integration could interfere with this usage.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-15556881213921252632017-05-11T10:11:01.828+02:002017-05-11T10:11:01.828+02:00Good article! I just shared it in Linked-InGood article! I just shared it in Linked-InAnonymoushttps://www.blogger.com/profile/11888273500400365707noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-62930702805655488552017-05-10T11:47:11.562+02:002017-05-10T11:47:11.562+02:00As a member of the EG, I would point out that we d...As a member of the EG, I would point out that we do not have a vote, or any actual power. That lies with the Spec Lead and the Executive Committee.<br /><br />Rest assured though, I am using my voice in the EG to further the needs of the entire Java community rather than any narrow constituency -- I believe the same is true of Red Hat and IBM. However I don't agree that pushing forward with the JSR in its current state actually serves the needs of the Java community.Neil Bartletthttps://www.blogger.com/profile/08588098030811273044noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-8860937214883453032017-05-08T15:39:59.828+02:002017-05-08T15:39:59.828+02:00Thanks, But I find there is an error:
sizeOf(Cont...Thanks, But I find there is an error:<br /><br />sizeOf(Container.class) // 96<br />sizeOf(new Container(1,2L)) //24<br /><br />zhugwhttps://www.blogger.com/profile/05068208678566577969noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-60557869082326876862017-03-19T13:58:48.079+01:002017-03-19T13:58:48.079+01:00This is the most clear invokedynamic explanation.
...This is the most clear invokedynamic explanation.<br />I'd like to hear more about how VM chooses call site strategies. It'd be also good to show invokedynamic in action, in byte code, on an example of some dynamic language (Groovy).Anonymoushttps://www.blogger.com/profile/00829979452562785078noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-52489727063575284652016-09-30T05:43:26.600+02:002016-09-30T05:43:26.600+02:00Wonderful Blog. Very informative and helpful.Wonderful Blog. Very informative and helpful.Indrajeethttps://www.blogger.com/profile/00664273913150143297noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-83793610743523254592016-05-02T23:20:58.210+02:002016-05-02T23:20:58.210+02:00I think I remembered that I benchmarked it and it ...I think I remembered that I benchmarked it and it turned out to be equally fast. As they both generate code, they should require similar space but I this will probably change over time. And with Jigsaw, the whole Fastclass engine will stop working anyways.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-57379934595654371512016-05-01T15:55:39.704+02:002016-05-01T15:55:39.704+02:00Hi Rafael. Thanks for an interesting article! I st...Hi Rafael. Thanks for an interesting article! I stumbled upon it reading about FastMethod.<br /><br />You write that on never JVMs one should stick to Reflection, since reflection inflation kicks in. <br />I did not fully understand this section - is FastClass not worth the bother, since reflection inflation is just as fast, or is reflection actually faster? <br />Also, I have read that reflection inflation uses a lot of memory, and similarly you write in you last section about the memory usage of CGLiB (the perm space) - do you know how the two frameworks compare with respect to memory?Hervianhttps://www.blogger.com/profile/11073249119582411645noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-1442859204649174262016-03-03T19:06:10.346+01:002016-03-03T19:06:10.346+01:00This is perfectly possible. Simply specify the inp...This is perfectly possible. Simply specify the input file to be a PDF and require a DOCX output. I added a code example to the issue you opened on GitHub.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-28193619510065199862016-03-01T21:30:19.100+01:002016-03-01T21:30:19.100+01:00Is there a way to go from PDF to DOCX with a PDF w...Is there a way to go from PDF to DOCX with a PDF whose original format is DOCX? I tried to swap the VBA code but doesn't work...Anonymoushttps://www.blogger.com/profile/08140484849507916122noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-44550719390341955042016-01-21T09:17:34.958+01:002016-01-21T09:17:34.958+01:00You mean because the checked exceptions of core re...You mean because the checked exceptions of core reflection? I do not think that is too much of a problem. You have to catch the NoSuchMethodException in any case and the invocation errors are not much more of a problem to handle, especially using Java 7+ multi-typed catch statements.<br /><br />It is more that using FastMethod etc will rather slow you down on modern VMs.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-56526456639998120322016-01-21T07:19:28.447+01:002016-01-21T07:19:28.447+01:00Hi Rafael,
You mentioned:
```
I would therefore ...Hi Rafael,<br /><br />You mentioned:<br /><br />```<br />I would therefore recommend to not use FastClass on modern JVMs<br />```<br /><br />I think the FastClass version has a more friendly API than the boiler plate code to do Java reflection, right?Anonymoushttps://www.blogger.com/profile/11093129700200856628noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-19802482446842917472015-12-08T13:30:34.897+01:002015-12-08T13:30:34.897+01:00I am with you, rather delay Java 9 than rush with ...I am with you, rather delay Java 9 than rush with Jigsaw. It may be the biggest step on Java's evolution and maybe the most beneficial too, so even if they had to delay it for a year to ensure rock solid stability and backwards compatibility, I can survive with Java 8 for another year.Anonymoushttps://www.blogger.com/profile/01434659951068178760noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-63597218142113354112015-11-30T19:36:46.069+01:002015-11-30T19:36:46.069+01:00Thank you for the useful articleThank you for the useful articleArtemhttps://www.blogger.com/profile/09102100890324428517noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-29877952687806381942015-11-18T18:26:47.755+01:002015-11-18T18:26:47.755+01:00nice example also visit guava example
http://www....nice example also visit guava example <br />http://www.javaproficiency.com/2015/05/guava-cache-memory-example.htmlShivam Kumarhttps://www.blogger.com/profile/12633731033655211922noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-69111740192339985082015-06-25T08:02:17.289+02:002015-06-25T08:02:17.289+02:00You are welcome. Have a look at documents4j which ...You are welcome. Have a look at documents4j which implements the above solution.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-25809620748172241102015-06-25T04:42:27.001+02:002015-06-25T04:42:27.001+02:00I was desperately looking for such a solution sinc...I was desperately looking for such a solution since some time. All the other options I found on the internet were generating non-formatted PDF, totally different from my docx file.<br />Thank you so much. You cannot imagine how happy I felt when finding this article. GG ! Nice blog ;)Rihab Ben Rhouma رحاب بن رحومةhttps://www.blogger.com/profile/03723966079114882132noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-71815282375158371512015-05-06T14:07:14.159+02:002015-05-06T14:07:14.159+02:00Thank you, I appreciate the feedback.
Yes, you ca...Thank you, I appreciate the feedback.<br /><br />Yes, you can intercept constructor calls just the same way as method calls. However, make sure to invoke the super constructor every time BEFORE you intercept the call. You can also do this afterwards, but then you cannot access the "this" instance in your interceptor.Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-32007476187421496842015-05-06T13:57:13.996+02:002015-05-06T13:57:13.996+02:00Awesome article! I really enjoyed reading it.
Do ...Awesome article! I really enjoyed reading it.<br /><br />Do you know if it is possible to use the same concept (ByteBuddyAgent.installOnOpenJDK) to intercept all new object creations. This way, I could do dependency injection in beans which are not managed by Spring.<br /><br />I know this can also be done using Spring and AOP but then you always have to declare an agent which makes development, unit testing e.d. much harder. (I know you can by default specify an agent in Intellij but still...). I really like the ByteBuddyAgent where you just say: ByteBuddyAgent.installOnOpenJDK<br /><br />Congrats and keep up the good work!<br />RonaldAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-61387167878421261512015-04-16T20:22:31.420+02:002015-04-16T20:22:31.420+02:00Thanks!
Byte Buddy renames the original method an...Thanks!<br /><br />Byte Buddy renames the original method and also copies the debugging information. The user does therefore not notice the instrumentation when setting breakpoint. The only trace is left by an additional synthetic method frame.<br /><br />By this approach it is possible to invoke the original method conditionally or multiple times.<br /><br />For using an agent in a unit test, Byte Buddy ships with a programmatic attacher, simply call ByteBuddyAgent.installOnOpenJDK().Rafaelhttps://www.blogger.com/profile/06973690867431113468noreply@blogger.comtag:blogger.com,1999:blog-3237092529299307504.post-87943202953890098022015-04-16T17:52:12.235+02:002015-04-16T17:52:12.235+02:00Great topic. I'm just getting into writing so...Great topic. I'm just getting into writing some class manipulation code. I have a few questions:<br /><br />1) When using AgentBuilder, is Byte-Buddy replacing the Service class bytecode with proxy class bytecode, or is injecting the logger code directly into the method?<br /><br />2) How does this effect debugging? I could see manipulation of bytecode interfering with the bytecode->source line mappings.<br /><br />3) How do you register the Agents when running unit tests? Do you hook into a specific Maven lifecycle? I could see this being tricky when running JUnit tests directly from eclipse. You'd have to register the agent jar in the Run Configurations > Arguments, but if you're modifying agent code you'd have to rebuild the jar.<br /><br />I'll poke around the Byte-Buddy code base, and maybe I can answer some of these questions myself.<br /><br />Overall great post. I initially was steering away from using Agents in my current project, but now I may take another look.Andy Glassmanhttps://www.blogger.com/profile/05455189906401279688noreply@blogger.com