Patches const for jdk bug 6822627

This commit is contained in:
Egor.Ushakov
2016-11-01 12:33:12 +03:00
parent 0b4990f75e
commit ebbdb2fa49
2 changed files with 16 additions and 4 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.debugger.jdi;
import com.intellij.Patches;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.openapi.util.Ref;
import com.intellij.util.ReflectionUtil;
@@ -56,11 +57,16 @@ public class MethodBytecodeUtil {
}
public static byte[] getConstantPool(ReferenceType type) {
try {
return type.constantPool();
if (Patches.JDK_BUG_ID_6822627) {
try {
return type.constantPool();
}
catch (NullPointerException e) { // workaround for JDK bug 6822627
ReflectionUtil.resetField(type, "constantPoolInfoGotten");
return type.constantPool();
}
}
catch (NullPointerException e) { // workaround for JDK bug 6822627
ReflectionUtil.resetField(type, "constantPoolInfoGotten");
else {
return type.constantPool();
}
}
@@ -82,6 +82,12 @@ public class Patches {
*/
public static final boolean JDK_BUG_EVENT_CONTROLLER_LEAK = true;
/**
* NPE from com.sun.jdi.ReferenceType#constantPool()
* See <a href="https://bugs.openjdk.java.net/browse/JDK-6822627">JDK-6822627</a>
*/
public static final boolean JDK_BUG_ID_6822627 = true;
/**
* JDK on Mac detects font style for system fonts based only on their name (PostScript name).
* This doesn't work for some fonts which don't use recognizable style suffixes in their names.