From fd1888b49c109ad97d539060b61dd38ceb8d7151 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 25 Nov 2015 12:19:12 -0800 Subject: [PATCH] Fix 482990: throw exception if asm missing at > 1.6 java --- weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index bc465a2ea..933402248 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -696,9 +696,12 @@ public final class LazyClassGen { public byte[] getJavaClassBytesIncludingReweavable(BcelWorld world) { writeBack(world); byte[] wovenClassFileData = myGen.getJavaClass().getBytes(); - // if is java 6 class file - if (((myGen.getMajor() == Constants.MAJOR_1_6 && world.shouldGenerateStackMaps()) || myGen.getMajor() > Constants.MAJOR_1_6) - && AsmDetector.isAsmAround) { + // At 1.6 stackmaps are optional + // At 1.7 or later stackmaps are required (if not turning off the verifier) + if ((myGen.getMajor() == Constants.MAJOR_1_6 && world.shouldGenerateStackMaps()) || myGen.getMajor() > Constants.MAJOR_1_6) { + if (!AsmDetector.isAsmAround) { + throw new BCException("Unable to find Asm for stackmap generation (Looking for 'aj.org.objectweb.asm.ClassReader'). Stackmap generation for woven code is required to avoid verify errors on a Java 1.7 or higher runtime"); + }; wovenClassFileData = StackMapAdder.addStackMaps(world, wovenClassFileData); } -- 2.39.5