FELIX-3568 : java.lang.VerifyError from bundles compiled with maven-scr-plugin (java 7)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1415579 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
index 205a0fd..2d9c718 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
@@ -65,9 +65,11 @@
final ClassReader reader = new ClassReader(new FileInputStream(fileName));
reader.accept(cn, 0);
- // TODO: ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES
- final ClassWriter writer = new ClassWriter(0) {
+ // For target Java7 and above use: ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES
+ final int mask = (cn.version > 50 ? ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES : 0);
+ final ClassWriter writer = new ClassWriter(mask) {
+ @Override
protected String getCommonSuperClass(final String type1, final String type2) {
Class<?> c, d;
try {