XBEAN-323 upgrading asm to 7.3.1 + ensure experimental features can be enabled with a system property (to match --enable-preview compilation flag) for testing purposes

git-svn-id: https://svn.apache.org/repos/asf/geronimo/xbean/trunk@1873286 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 00fad24..a3d899c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
         -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 
-        <asm.version>7.2</asm.version>
+        <asm.version>7.3.1</asm.version>
 
         <xbean.automatic.module.name>${project.groupId}</xbean.automatic.module.name>
     </properties>
diff --git a/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/AsmConstants.java b/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/AsmConstants.java
new file mode 100644
index 0000000..0d4e6f3
--- /dev/null
+++ b/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/AsmConstants.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.xbean.asm7.original.commons;
+
+import org.objectweb.asm.Opcodes;
+
+public interface AsmConstants {
+    int ASM_VERSION = Integer.getInteger(AsmConstants.class.getName() + ".ASM_VERSION", Opcodes.ASM7);
+}
diff --git a/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/EmptyVisitor.java b/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/EmptyVisitor.java
index 6b24889..b0fda0e 100644
--- a/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/EmptyVisitor.java
+++ b/xbean-asm-util/src/main/java/org/apache/xbean/asm7/original/commons/EmptyVisitor.java
@@ -16,6 +16,8 @@
  */
 package org.apache.xbean.asm7.original.commons;
 
+import static org.apache.xbean.asm7.original.commons.AsmConstants.ASM_VERSION;
+
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.Attribute;
 import org.objectweb.asm.ClassVisitor;
@@ -23,11 +25,10 @@
 import org.objectweb.asm.Handle;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.TypePath;
 
 public class EmptyVisitor extends ClassVisitor {
-    protected final AnnotationVisitor av = new AnnotationVisitor(Opcodes.ASM7) {
+    protected final AnnotationVisitor av = new AnnotationVisitor(ASM_VERSION) {
         @Override
         public void visit(String name, Object value) {
             EmptyVisitor.this.visit(name, value);
@@ -54,7 +55,7 @@
         }
     };
 
-    protected final FieldVisitor fv = new FieldVisitor(Opcodes.ASM7) {
+    protected final FieldVisitor fv = new FieldVisitor(ASM_VERSION) {
         @Override
         public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
             return EmptyVisitor.this.visitAnnotation(desc, visible);
@@ -70,7 +71,7 @@
             EmptyVisitor.this.visitEnd();
         }
     };
-    protected final MethodVisitor mv = new MethodVisitor(Opcodes.ASM7) {
+    protected final MethodVisitor mv = new MethodVisitor(ASM_VERSION) {
         @Override
         public AnnotationVisitor visitAnnotationDefault() {
             return EmptyVisitor.this.visitAnnotationDefault();
@@ -203,7 +204,7 @@
     };
 
     public EmptyVisitor() {
-        super(Opcodes.ASM7);
+        super(ASM_VERSION);
     }
 
     protected AnnotationVisitor visitAnnotationDefault() {
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
index ba0b3b3..bb02ec8 100644
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
@@ -17,6 +17,8 @@
  */
 package org.apache.xbean.recipe;
 
+import static org.apache.xbean.asm7.original.commons.AsmConstants.ASM_VERSION;
+
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.Label;
@@ -220,7 +222,7 @@
         private final Map<String,Constructor> constructorMap = new HashMap<String,Constructor>();
 
         public AllParameterNamesDiscoveringVisitor(Class type, String methodName) {
-            super(Opcodes.ASM7);
+            super(ASM_VERSION);
             this.methodName = methodName;
 
             List<Method> methods = new ArrayList<Method>(Arrays.asList(type.getMethods()));
@@ -233,7 +235,7 @@
         }
 
         public AllParameterNamesDiscoveringVisitor(Class type) {
-            super(Opcodes.ASM7);
+            super(ASM_VERSION);
             this.methodName = "<init>";
 
             List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors()));
@@ -288,7 +290,7 @@
                     isStaticMethod = Modifier.isStatic(method.getModifiers());
                 }
 
-                return new MethodVisitor(Opcodes.ASM7) {
+                return new MethodVisitor(ASM_VERSION) {
                     // assume static method until we get a first parameter name
                     public void visitLocalVariable(String name, String description, String signature, Label start, Label end, int index) {
                         if (isStaticMethod) {
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
index 7ced265..f7aa019 100644
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
@@ -17,6 +17,8 @@
  */
 package org.apache.xbean.recipe;
 
+import static org.apache.xbean.asm7.original.commons.AsmConstants.ASM_VERSION;
+
 import org.apache.xbean.asm7.ClassReader;
 import org.apache.xbean.asm7.ClassVisitor;
 import org.apache.xbean.asm7.Label;
@@ -220,7 +222,7 @@
         private final Map<String,Constructor> constructorMap = new HashMap<String,Constructor>();
 
         public AllParameterNamesDiscoveringVisitor(Class type, String methodName) {
-            super(Opcodes.ASM7);
+            super(ASM_VERSION);
             this.methodName = methodName;
 
             List<Method> methods = new ArrayList<Method>(Arrays.asList(type.getMethods()));
@@ -233,7 +235,7 @@
         }
 
         public AllParameterNamesDiscoveringVisitor(Class type) {
-            super(Opcodes.ASM7);
+            super(ASM_VERSION);
             this.methodName = "<init>";
 
             List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors()));
@@ -293,7 +295,7 @@
                     isStaticMethod = Modifier.isStatic(method.getModifiers());
                 }
 
-                return new MethodVisitor(Opcodes.ASM7) {
+                return new MethodVisitor(ASM_VERSION) {
                     // assume static method until we get a first parameter name
                     public void visitLocalVariable(String name, String description, String signature, Label start, Label end, int index) {
                         if (isStaticMethod) {