[java] runtime ASM version detection (IDEA-191331)

This commit is contained in:
Roman Shevchenko
2018-10-02 11:31:33 +02:00
parent 35d906d82b
commit c4a601c27f
2 changed files with 10 additions and 2 deletions
@@ -25,7 +25,11 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
@SuppressWarnings("SSBasedInspection") private static final String[] EMPTY_STRING_ARRAY = new String[0];
@SuppressWarnings("ConstantConditions") private static final boolean NEW_ASM = Opcodes.API_VERSION > Opcodes.ASM6;
private static final boolean NEW_ASM;
static {
try { NEW_ASM = (Integer)Opcodes.class.getField("API_VERSION").get(null) > Opcodes.ASM6; }
catch (Exception e) { throw new RuntimeException(e); }
}
private final Map<String, Map<Integer, String>> myMethodParamNames;
private String myClassName;
@@ -26,7 +26,11 @@ class PatternInstrumenter extends ClassVisitor implements Opcodes {
static final String JAVA_UTIL_REGEX_PATTERN = "[Ljava/util/regex/Pattern;";
static final String NULL_PATTERN = "((((";
@SuppressWarnings("ConstantConditions") static final boolean NEW_ASM = Opcodes.API_VERSION > Opcodes.ASM6;
private static final boolean NEW_ASM;
static {
try { NEW_ASM = (Integer)Opcodes.class.getField("API_VERSION").get(null) > Opcodes.ASM6; }
catch (Exception e) { throw new RuntimeException(e); }
}
private final String myPatternAnnotationClassName;
private final boolean myDoAssert;