--- old/src/java.base/share/classes/jdk/internal/org/objectweb/asm/util/CheckSignatureAdapter.java Fri Oct 27 09:24:55 2017 +++ new/src/java.base/share/classes/jdk/internal/org/objectweb/asm/util/CheckSignatureAdapter.java Fri Oct 27 09:24:55 2017 @@ -142,7 +142,7 @@ * null. */ public CheckSignatureAdapter(final int type, final SignatureVisitor sv) { - this(Opcodes.ASM5, type, sv); + this(Opcodes.ASM6, type, sv); } /** @@ -150,7 +150,7 @@ * * @param api * the ASM API version implemented by this visitor. Must be one - * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. + * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. * @param type * the type of signature to be checked. See * {@link #CLASS_SIGNATURE}, {@link #METHOD_SIGNATURE} and @@ -175,7 +175,7 @@ || (state != EMPTY && state != FORMAL && state != BOUND)) { throw new IllegalStateException(); } - CheckMethodAdapter.checkIdentifier(name, "formal type parameter"); + checkIdentifier(name, "formal type parameter"); state = FORMAL; if (sv != null) { sv.visitFormalTypeParameter(name); @@ -284,7 +284,7 @@ if (type != TYPE_SIGNATURE || state != EMPTY) { throw new IllegalStateException(); } - CheckMethodAdapter.checkIdentifier(name, "type variable"); + checkIdentifier(name, "type variable"); state = SIMPLE_TYPE; if (sv != null) { sv.visitTypeVariable(name); @@ -306,7 +306,7 @@ if (type != TYPE_SIGNATURE || state != EMPTY) { throw new IllegalStateException(); } - CheckMethodAdapter.checkInternalName(name, "class name"); + checkClassName(name, "class name"); state = CLASS_TYPE; if (sv != null) { sv.visitClassType(name); @@ -318,7 +318,7 @@ if (state != CLASS_TYPE) { throw new IllegalStateException(); } - CheckMethodAdapter.checkIdentifier(name, "inner class name"); + checkIdentifier(name, "inner class name"); if (sv != null) { sv.visitInnerClassType(name); } @@ -356,4 +356,30 @@ sv.visitEnd(); } } + + private void checkClassName(final String name, final String msg) { + if (name == null || name.length() == 0) { + throw new IllegalArgumentException("Invalid " + msg + + " (must not be null or empty)"); + } + for (int i = 0; i < name.length(); ++i) { + if (".;[<>:".indexOf(name.charAt(i)) != -1) { + throw new IllegalArgumentException("Invalid " + msg + + " (must not contain . ; [ < > or :): " + name); + } + } + } + + private void checkIdentifier(final String name, final String msg) { + if (name == null || name.length() == 0) { + throw new IllegalArgumentException("Invalid " + msg + + " (must not be null or empty)"); + } + for (int i = 0; i < name.length(); ++i) { + if (".;[/<>:".indexOf(name.charAt(i)) != -1) { + throw new IllegalArgumentException("Invalid " + msg + + " (must not contain . ; [ / < > or :): " + name); + } + } + } }