When protected isn’t protected

Monday, November 3rd, 2008

For all those spec believers out there: what would you think if I told you that all of the JVM implementations consistently violate the spec for at least one particular instance?
Our story begins on a cold and lonely evening when I discover a bug in JavaRebel in conjunction with Xerces XMLEntityManager. The problem was [...]



Return-Type-Based Method Overloading in Java

Friday, August 1st, 2008

Return-Type-Based Method Overloading in Java — wow! Next you’ll discover that in Java bytecode you can throw/catch any object, not just Throwable subclasses and use that knowledge to implement more weird bytecode hacks! And BTW return-type overloading is used in Java 5 to implement bridge methods that allow overriding super methods with a different return [...]



Typesafe ASM — problems solved?

Wednesday, March 26th, 2008

OK, I think I managed to solve both the primitive and the double slot problem introduced in the previous post. Basically I introduced another parametrized class — InvokeBuilder, which builds method invocations. The example now looks like this:
PLAIN TEXT
JAVA:

ClassWriter cw = new ClassWriter(COMPUTE_MAXS);

 

  new ClassBuilder(cw, V1_4, ACC_PUBLIC, “HelloWorld”, “java/lang/Object”, null)   

  .beginMethod(ACC_PUBLIC, “<init>”, [...]



Typesafe DSLs in Java: Part 1 — Typesafe Bytecode

Monday, March 24th, 2008

Domain Specific Languages (DSLs) have been brought to Java under the name of Fluent Interface. However most of them utilize a lot of strings and untyped behavior to make the interface fluent enough. It turns out that using Java 5 and a bag of tricks we can have the compiler to check a lot more. In this post we'll check out how to write Java bytecode using ASM in a typesafe way.



QCon London 2008: TerraCotta

Friday, March 14th, 2008

The best talk I’ve been to so far is TerraCotta’s introduction and patterns. Ari is a good speaker with passion, intensity and speed that I admire (though some others might find the talk a bit too informative).
I’ve heard about TerraCotta before, but this was the first time I got to know the details. The basic [...]