- Always - Sunset on Third Street
-
Several nostalgic episodes (based on a popular
comic book series) about the residents of Third Street,
set in Tokyo in the late fifties (recreated with lots of impressive computer generated
images).
7 points - True Romance
- Christian Slater, Patricia Arquette, Michael Rapaport, Val Kilmer
(just a little), Dennis Hopper, Gary Oldman, Brad Pitt, Christopher Walken,
Samuel L. Jackson. Directed by Tony Scott, written by Quentin Tarantino.
9 points
Sun, 09 Jul 2006
The thousand and one things I want to see fixed in Java: [1] Method meta data without reflection
The main merit of Java being a compiled and statically typed language is that a lot of useful information is available to the compiler. In Eclipse, for example, you can click on any method to get a call hierarchy that lists all calls to that method within your workspace. This is extremely useful (almost essential actually, given the great complexity that Java projects always seem to reach very quickly) to assess the impact of bugs, code changes or refactoring. Unfortunately, the call hierarchy does not include calls using the reflection API. In most cases (such as access from Javascript or Velocity templates), that is just something we have to live with (and resort to full-text search to try to find the callers), but I would like to have better support here when using reflection from inside of Java.
Consider how you access class meta data: If you do not know the class name at compile-time, you have to do
Class c = Class.forName(unknownClassName);and that obviously leaves compiler and IDE in the dark. But if you do know the name, you can write
Class c = my.package.MyClass.class;which can easily be tracked down later.
For methods, however, you only have the first option:
Method m = clazz.getMethod(methodName, parameterTypes);There is just no syntax to do the Java equivalent of
my $m = \&Clazz::methodName;as a result of which I find myself writing silly wrappers.
/*
to get the Java version of
my @names = map { $_->name() } @objects;
*/
// instead of (works, but has poor IDE support because of reflection)
FilteringIterator<SomeClass, String> it =
new ReflectionFilteringIterator<SomeClass, String>( "getName");
// make a wrapper that does not use reflection
FilteringIterator<SomeClass, String> it =
new FilteringIterator<SomeClass, String> {
public String filter(SomeClass in){
return in.getName();
}
}
// so that I can write
List<String> names = it.map( (List<SomeClass>) objects);



