From 21717cec11d5a8abdc3eba280290a65103bbeaf7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 23 Sep 2009 07:44:13 +0200 Subject: BIIG change to the eclipse agent: Now all patcher classes represent themselves via SPI. LinkedNOdeFinderTransformer is broken. --- .../agent/EclipseASTConverterTransformer.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src_eclipseagent/lombok/eclipse/agent/EclipseASTConverterTransformer.java') diff --git a/src_eclipseagent/lombok/eclipse/agent/EclipseASTConverterTransformer.java b/src_eclipseagent/lombok/eclipse/agent/EclipseASTConverterTransformer.java index 1402138b..4245e246 100644 --- a/src_eclipseagent/lombok/eclipse/agent/EclipseASTConverterTransformer.java +++ b/src_eclipseagent/lombok/eclipse/agent/EclipseASTConverterTransformer.java @@ -21,6 +21,7 @@ */ package lombok.eclipse.agent; +import org.mangosdk.spi.ProviderFor; import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; @@ -41,8 +42,9 @@ import org.objectweb.asm.Opcodes; *
  • The retrieveStartingCatchPosition(int, int) method is instrumented to return its first parameter * instead of the constant -1.
  • */ -class EclipseASTConverterTransformer { - byte[] transform(byte[] classfileBuffer) { +@ProviderFor(EclipseTransformer.class) +public class EclipseASTConverterTransformer implements EclipseTransformer { + public byte[] transform(byte[] classfileBuffer) { ClassReader reader = new ClassReader(classfileBuffer); ClassWriter writer = new ClassWriter(reader, 0); @@ -51,17 +53,6 @@ class EclipseASTConverterTransformer { return writer.toByteArray(); } - static RuntimeException sneakyThrow(Throwable t) { - if ( t == null ) throw new NullPointerException("t"); - EclipseASTConverterTransformer.sneakyThrow0(t); - return null; - } - - @SuppressWarnings("unchecked") - private static void sneakyThrow0(Throwable t) throws T { - throw (T)t; - } - private static class ASTConverterPatcherAdapter extends ClassAdapter { public ASTConverterPatcherAdapter(ClassVisitor cv) { super(cv); @@ -97,4 +88,8 @@ class EclipseASTConverterTransformer { } } } + + @Override public String getTargetClassName() { + return "org/eclipse/jdt/core/dom/ASTConverter"; + } } -- cgit