Commit 62dde4fa authored by andrei's avatar andrei

Allow to show verifier pane for default methods

parent 2cf0cde4
......@@ -52,6 +52,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
showLocals = options.modes.get(BCOConstants.F_SHOW_VARIABLES);
showStackMap = options.modes.get(BCOConstants.F_SHOW_STACKMAP);
showHex = options.modes.get(BCOConstants.F_SHOW_HEX_VALUES);
javaVersion = "?";
}
private boolean decompilingEntireClass() {
......@@ -69,8 +70,10 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
//int minor = version >>> 16;
// 1.1 is 45, 1.2 is 46 etc.
int javaV = major % 44;
if (javaV > 0 && javaV < 10) {
if (javaV > 0) {
javaVersion = "1." + javaV;
} else {
javaVersion = "? " + major;
}
this.accessFlags = access;
}
......@@ -484,7 +487,8 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
if(type.getSort() == Type.METHOD){
appendDescriptor(METHOD_DESCRIPTOR, descriptor);
} else {
buf.append(descriptor + ".class");
String descr = raw? descriptor : descriptor.substring(0, descriptor.length() - 1);
appendDescriptor(INTERNAL_NAME, descr + ".class");
}
} else {
buf.append(formatValue(cst));
......
......@@ -51,6 +51,10 @@ public class DecompiledClass {
|| ((accessFlags & Opcodes.ACC_INTERFACE) != 0);
}
public boolean isDefaultMethodPossible(){
return classInfo.major >= 8;
}
public String getText() {
if (value == null) {
StringBuffer buf = new StringBuffer();
......
......@@ -7,12 +7,18 @@
*******************************************************************************/
package de.loskutov.bco.asm;
public class DecompiledClassInfo {
/**
* Major.minor or ?
*/
public final String javaVersion;
public final int accessFlags;
public final int major;
public DecompiledClassInfo(String javaVersion, int accessFlags) {
this.javaVersion = javaVersion;
this.accessFlags = accessFlags;
major = javaVersion.startsWith("1.")? Integer.parseInt(javaVersion.substring(2)) : 0;
}
}
......@@ -1134,12 +1134,11 @@ public class BytecodeOutlineView extends ViewPart {
if (result == null) {
clearOutput = true;
} else {
if (modes.get(BCOConstants.F_SHOW_ANALYZER)
&& !result.isAbstractOrInterface()) {
boolean hasMethods = !result.isAbstractOrInterface() || result.isDefaultMethodPossible();
if (modes.get(BCOConstants.F_SHOW_ANALYZER) && hasMethods) {
refreshVerifyView(result);
} else {
toggleVerifierAction.setEnabled(!result
.isAbstractOrInterface());
toggleVerifierAction.setEnabled(hasMethods);
refreshTextView(result);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment