src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/SimpleVerifier.java

Print this page

        

@@ -106,52 +106,45 @@
 
     /**
      * Constructs a new {@link SimpleVerifier} to verify a specific class. This
      * class will not be loaded into the JVM since it may be incorrect.
      *
-     * @param currentClass the class that is verified.
-     * @param currentSuperClass the super class of the class that is verified.
-     * @param isInterface if the class that is verified is an interface.
+     * @param currentClass
+     *            the class that is verified.
+     * @param currentSuperClass
+     *            the super class of the class that is verified.
+     * @param isInterface
+     *            if the class that is verified is an interface.
      */
-    public SimpleVerifier(
-        final Type currentClass,
-        final Type currentSuperClass,
-        final boolean isInterface)
-    {
+    public SimpleVerifier(final Type currentClass,
+            final Type currentSuperClass, final boolean isInterface) {
         this(currentClass, currentSuperClass, null, isInterface);
     }
 
     /**
      * Constructs a new {@link SimpleVerifier} to verify a specific class. This
      * class will not be loaded into the JVM since it may be incorrect.
      *
-     * @param currentClass the class that is verified.
-     * @param currentSuperClass the super class of the class that is verified.
-     * @param currentClassInterfaces the interfaces implemented by the class
-     *        that is verified.
-     * @param isInterface if the class that is verified is an interface.
+     * @param currentClass
+     *            the class that is verified.
+     * @param currentSuperClass
+     *            the super class of the class that is verified.
+     * @param currentClassInterfaces
+     *            the interfaces implemented by the class that is verified.
+     * @param isInterface
+     *            if the class that is verified is an interface.
      */
-    public SimpleVerifier(
-        final Type currentClass,
+    public SimpleVerifier(final Type currentClass,
         final Type currentSuperClass,
-        final List<Type> currentClassInterfaces,
-        final boolean isInterface)
-    {
-        this(ASM4,
-                currentClass,
-                currentSuperClass,
-                currentClassInterfaces,
+            final List<Type> currentClassInterfaces, final boolean isInterface) {
+        this(ASM5, currentClass, currentSuperClass, currentClassInterfaces,
                 isInterface);
     }
 
-    protected SimpleVerifier(
-        final int api,
-        final Type currentClass,
+    protected SimpleVerifier(final int api, final Type currentClass,
         final Type currentSuperClass,
-        final List<Type> currentClassInterfaces,
-        final boolean isInterface)
-    {
+            final List<Type> currentClassInterfaces, final boolean isInterface) {
         super(api);
         this.currentClass = currentClass;
         this.currentSuperClass = currentSuperClass;
         this.currentClassInterfaces = currentClassInterfaces;
         this.isInterface = isInterface;

@@ -160,11 +153,12 @@
     /**
      * Set the <code>ClassLoader</code> which will be used to load referenced
      * classes. This is useful if you are verifying multiple interdependent
      * classes.
      *
-     * @param loader a <code>ClassLoader</code> to use
+     * @param loader
+     *            a <code>ClassLoader</code> to use
      */
     public void setClassLoader(final ClassLoader loader) {
         this.loader = loader;
     }
 

@@ -208,12 +202,11 @@
                 && ("Lnull;".equals(t.getDescriptor()) || t.getSort() == Type.ARRAY);
     }
 
     @Override
     protected BasicValue getElementValue(final BasicValue objectArrayValue)
-            throws AnalyzerException
-    {
+            throws AnalyzerException {
         Type arrayType = objectArrayValue.getType();
         if (arrayType != null) {
             if (arrayType.getSort() == Type.ARRAY) {
                 return newValue(Type.getType(arrayType.getDescriptor()
                         .substring(1)));

@@ -223,11 +216,12 @@
         }
         throw new Error("Internal error");
     }
 
     @Override
-    protected boolean isSubTypeOf(final BasicValue value, final BasicValue expected) {
+    protected boolean isSubTypeOf(final BasicValue value,
+            final BasicValue expected) {
         Type expectedType = expected.getType();
         Type type = value.getType();
         switch (expectedType.getSort()) {
             case Type.INT:
             case Type.FLOAT:

@@ -237,12 +231,11 @@
             case Type.ARRAY:
             case Type.OBJECT:
                 if ("Lnull;".equals(type.getDescriptor())) {
                     return true;
                 } else if (type.getSort() == Type.OBJECT
-                        || type.getSort() == Type.ARRAY)
-                {
+                    || type.getSort() == Type.ARRAY) {
                     return isAssignableFrom(expectedType, type);
                 } else {
                     return false;
                 }
             default:

@@ -254,15 +247,13 @@
     public BasicValue merge(final BasicValue v, final BasicValue w) {
         if (!v.equals(w)) {
             Type t = v.getType();
             Type u = w.getType();
             if (t != null
-                    && (t.getSort() == Type.OBJECT || t.getSort() == Type.ARRAY))
-            {
+                    && (t.getSort() == Type.OBJECT || t.getSort() == Type.ARRAY)) {
                 if (u != null
-                        && (u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY))
-                {
+                        && (u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY)) {
                     if ("Lnull;".equals(t.getDescriptor())) {
                         return w;
                     }
                     if ("Lnull;".equals(u.getDescriptor())) {
                         return v;

@@ -315,11 +306,12 @@
         if (currentClass != null && t.equals(currentClass)) {
             if (getSuperClass(u) == null) {
                 return false;
             } else {
                 if (isInterface) {
-                    return u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY;
+                    return u.getSort() == Type.OBJECT
+                            || u.getSort() == Type.ARRAY;
                 }
                 return isAssignableFrom(t, getSuperClass(u));
             }
         }
         if (currentClass != null && u.equals(currentClass)) {

@@ -345,12 +337,11 @@
 
     protected Class<?> getClass(final Type t) {
         try {
             if (t.getSort() == Type.ARRAY) {
                 return Class.forName(t.getDescriptor().replace('/', '.'),
-                        false,
-                        loader);
+                        false, loader);
             }
             return Class.forName(t.getClassName(), false, loader);
         } catch (ClassNotFoundException e) {
             throw new RuntimeException(e.toString());
         }