Rocket Java: A project to test Java 8’s More Strict Verifier

Java recently added a more strict verifier to the class loading mechanism. This isn't really a bad thing, necessarily, because it conforms to what Java was always supposed to do - except a lot of projects now rely on the verifier doing what it's always done. For all intents and purposes, the Java 8u11 (and… Continue reading Rocket Java: A project to test Java 8’s More Strict Verifier

Rocket Java: Using different test resources in a single build

What happens when you have tests that need different resources with similar names? Confusion, that’s what. Let’s map out a project so we can see what happens: Parent Project Test Resources 1 Test Resources 2 Library Code (depends on both test resources projects) Now, in our problem code, the resources for the test data use… Continue reading Rocket Java: Using different test resources in a single build

Rocket Java: Shadowing private variables in subclasses

This morning, a user on ##java asked if private variables could be shadowed in subclasses. Upon being asked to try it and see, the user said that they didn't have the time, which was ironic (and wrong), but errr... what the heck, I'll write a test case to demonstrate that no, shadowing private variables (and… Continue reading Rocket Java: Shadowing private variables in subclasses

Repost: Rocket Java: What is Map/Reduce?

Map/Reduce is a strategy by which one uses a divide-and-conquer approach to handling data. The division is normally provided along natural lines, and it can provide some really impressive performance gains. The way it does this is by limiting the selection of data for which processing applies. Here's a good way to think of it,… Continue reading Repost: Rocket Java: What is Map/Reduce?

Repost: Rocket Java: That stupid classpath thing you should understand.

By far, the most common questions in Freenode ##java center around the concept of classpath. It's funny, too, because the questions are often asked by people who - upon questioning - insist that they understand classpath, they really do... and then, upon having it explained to them in excruciating detail, manage to solve their problem.… Continue reading Repost: Rocket Java: That stupid classpath thing you should understand.

Repost: Rocket Java: how to swap(int, int) and have it work… sort of

So it's a known fact that Java passes references by value. That means that if I pass an Object of some kind into a method, I can change the values in the object, but not the object reference itself. Likewise, if I pass an int into a method, I can change the value of that… Continue reading Repost: Rocket Java: how to swap(int, int) and have it work… sort of

Repost: Rocket Java: Spring Injection of Other Beans’ Properties

Woot, IRC FTW! Someone today asked a question about Spring that was actually relevant for once. The problem was that he wanted to inject not a bean, but a bean's referenced property into another bean. Put more succintly: He had a bean A, with a property B, and didn't want to inject A into bean… Continue reading Repost: Rocket Java: Spring Injection of Other Beans’ Properties

Repost: Rocket Java: Initializing arrays of arrays

From IRC, from whence many "interesting" questions come: "If I have a 4 dimensional integer array in Java, is there a way to initialise every element in it to a particular value?" Well. First off, you don't have a four-dimensional array. You have a one-dimensional array of one dimensional arrays of one dimensional arrays of… Continue reading Repost: Rocket Java: Initializing arrays of arrays