diff options
Diffstat (limited to 'org.jacoco.core/src/org/jacoco/core/internal/instr')
-rw-r--r-- | org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java | 16 | ||||
-rw-r--r-- | org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java index b6632c62..c7b7cf84 100644 --- a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java +++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java @@ -158,6 +158,18 @@ public final class InstrSupport { static final int CLINIT_ACC = Opcodes.ACC_SYNTHETIC | Opcodes.ACC_STATIC; /** + * Determines whether the given class file version requires stackmap frames. + * + * @param version + * class file version + * @return <code>true</code> if frames are required + */ + public static boolean needsFrames(final int version) { + // consider major version only (due to 1.1 anomaly) + return (version & 0xff) >= Opcodes.V1_6; + } + + /** * Ensures that the given member does not correspond to a internal member * created by the instrumentation process. This would mean that the class is * already instrumented. @@ -173,8 +185,8 @@ public final class InstrSupport { public static void assertNotInstrumented(final String member, final String owner) throws IllegalStateException { if (member.equals(DATAFIELD_NAME) || member.equals(INITMETHOD_NAME)) { - throw new IllegalStateException(format( - "Class %s is already instrumented.", owner)); + throw new IllegalStateException( + format("Class %s is already instrumented.", owner)); } } diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java index 38d572af..a4fb82b0 100644 --- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java +++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java @@ -45,7 +45,6 @@ public final class ProbeArrayStrategyFactory { final String className = reader.getClassName(); final int version = BytecodeVersion.get(reader.b); - final boolean withFrames = version >= Opcodes.V1_6; if (isInterfaceOrModule(reader)) { final ProbeCounter counter = getProbeCounter(reader); @@ -61,7 +60,7 @@ public final class ProbeArrayStrategyFactory { } } else { return new ClassFieldProbeArrayStrategy(className, classId, - withFrames, accessorGenerator); + InstrSupport.needsFrames(version), accessorGenerator); } } |