jdk.internal.org.objectweb.asm.tree.analysis.BasicVerifier Java Examples

The following examples show how to use jdk.internal.org.objectweb.asm.tree.analysis.BasicVerifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CheckMethodAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #2
Source File: CheckMethodAdapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #3
Source File: CheckMethodAdapter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #4
Source File: CheckMethodAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #5
Source File: CheckMethodAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #6
Source File: CheckMethodAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #7
Source File: CheckMethodAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #8
Source File: CheckMethodAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #9
Source File: CheckMethodAdapter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #10
Source File: CheckMethodAdapter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #11
Source File: CheckMethodAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #12
Source File: CheckMethodAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #13
Source File: CheckMethodAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access
 *            the method's access flags.
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param cmv
 *            the method visitor to which this adapter must delegate calls.
 * @param labels
 *            a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(final int access, final String name,
        final String desc, final MethodVisitor cmv,
        final Map<Label, Integer> labels) {
    this(new MethodNode(Opcodes.ASM5, access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                    new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0) {
                    throw new RuntimeException(
                            "Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    }, labels);
    this.access = access;
}
 
Example #14
Source File: CheckMethodAdapter.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@link CheckMethodAdapter} object. This method adapter
 * will perform basic data flow checks. For instance in a method whose
 * signature is <tt>void m ()</tt>, the invalid instruction IRETURN, or the
 * invalid sequence IADD L2I will be detected.
 *
 * @param access the method's access flags.
 * @param name the method's name.
 * @param desc the method's descriptor (see {@link Type Type}).
 * @param cmv the method visitor to which this adapter must delegate calls.
 * @param labels a map of already visited labels (in other methods).
 */
public CheckMethodAdapter(
    final int access,
    final String name,
    final String desc,
    final MethodVisitor cmv,
    final Map<Label, Integer> labels)
{
    this(new MethodNode(access, name, desc, null, null) {
        @Override
        public void visitEnd() {
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(new BasicVerifier());
            try {
                a.analyze("dummy", this);
            } catch (Exception e) {
                if (e instanceof IndexOutOfBoundsException
                        && maxLocals == 0 && maxStack == 0)
                {
                    throw new RuntimeException("Data flow checking option requires valid, non zero maxLocals and maxStack values.");
                }
                e.printStackTrace();
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw, true);
                CheckClassAdapter.printAnalyzerResult(this, a, pw);
                pw.close();
                throw new RuntimeException(e.getMessage() + ' '
                        + sw.toString());
            }
            accept(cmv);
        }
    },
            labels);
}