From 0c541f6694765385f516f6d79034b492b982c362 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 8 Aug 2011 20:21:33 +0000 Subject: [PATCH] asm3.3.1/jarjar'd and activated auto stackmap creation for major version 51 classfiles (java7) --- weaver/.classpath | 2 +- weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java | 6 +++--- weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java | 4 ++-- weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/weaver/.classpath b/weaver/.classpath index 204cf1e26..803dcce59 100644 --- a/weaver/.classpath +++ b/weaver/.classpath @@ -12,7 +12,7 @@ - + diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index fcebfc2a5..53f585651 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -678,12 +678,12 @@ public final class LazyClassGen { writeBack(world); byte[] wovenClassFileData = myGen.getJavaClass().getBytes(); // if is java 6 class file - if (myGen.getMajor() >= Constants.MAJOR_1_6 && world.shouldGenerateStackMaps() && AsmDetector.isAsmAround) { + if (((myGen.getMajor() == Constants.MAJOR_1_6 && world.shouldGenerateStackMaps()) || myGen.getMajor() > Constants.MAJOR_1_6) + && AsmDetector.isAsmAround) { wovenClassFileData = StackMapAdder.addStackMaps(world, wovenClassFileData); } - WeaverStateInfo wsi = myType.getWeaverState();// getOrCreateWeaverStateInfo - // (); + WeaverStateInfo wsi = myType.getWeaverState();// getOrCreateWeaverStateInfo(); if (wsi != null && wsi.isReweavable()) { // && !reweavableDataInserted // reweavableDataInserted = true; return wsi.replaceKeyWithDiff(wovenClassFileData); diff --git a/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java b/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java index a2cc74355..5d5bb6990 100644 --- a/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java +++ b/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java @@ -24,8 +24,8 @@ public class AsmDetector { static { try { - Class reader = Class.forName("org.objectweb.asm.ClassReader"); - Class visitor = Class.forName("org.objectweb.asm.ClassVisitor"); + Class reader = Class.forName("aj.org.objectweb.asm.ClassReader"); + Class visitor = Class.forName("aj.org.objectweb.asm.ClassVisitor"); Method m = reader.getMethod("accept", new Class[] { visitor, Integer.TYPE }); isAsmAround = m != null; } catch (Exception e) { diff --git a/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java b/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java index 7bdc61dd9..87b0f6b95 100644 --- a/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java +++ b/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java @@ -14,8 +14,9 @@ package org.aspectj.weaver.bcel.asm; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; + +import aj.org.objectweb.asm.ClassReader; +import aj.org.objectweb.asm.ClassWriter; /** * Uses asm to add the stack map attribute to methods in a class. The class is passed in as pure byte data and then a reader/writer -- 2.39.5