From 40e35d6f79f456fb868c95d764f5d0c9869ea6e4 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 12 Jun 2009 08:38:24 +0200 Subject: After spending 3 hours chasing down a NullPointerException inside the native method that handles method.invoke... figured out that I accidentally added a second transform() method and that one was being found, and that somehow causes the problem. The locating of the right transform method now also checks params. A 'method not found' is faaaaaaaaaaaaaaar easier to debug than picking the wrong one out of the lineup. --- src_eclipseagent/java/lombok/ClassLoaderWorkaround.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src_eclipseagent') diff --git a/src_eclipseagent/java/lombok/ClassLoaderWorkaround.java b/src_eclipseagent/java/lombok/ClassLoaderWorkaround.java index a3fc1521..4c851a0e 100644 --- a/src_eclipseagent/java/lombok/ClassLoaderWorkaround.java +++ b/src_eclipseagent/java/lombok/ClassLoaderWorkaround.java @@ -86,7 +86,12 @@ public class ClassLoaderWorkaround { Class c = loader.loadClass("lombok.eclipse.TransformEclipseAST"); for ( Method m : c.getMethods() ) { if ( m.getName().equals("transform") ) { + Class[] types = m.getParameterTypes(); + if ( types.length != 2 ) continue; + if ( !types[0].getName().equals("org.eclipse.jdt.internal.compiler.parser.Parser") ) continue; + if ( !types[1].getName().equals("org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration") ) continue; transform = m; + break; } } } catch ( ClassNotFoundException ignore ) {} -- cgit