Commit d44f4882 authored by andrei's avatar andrei

Fixed errors in verify view on interfaces/abstract methods. Increased plugin number.

parent 0f716b70
Manifest-Version: 1.0
Bundle-Name: Bytecode Outline Plug-in
Bundle-SymbolicName: de.loskutov.BytecodeOutline;singleton=true
Bundle-Version: 2.0.0
Bundle-Version: 2.0.1
Bundle-ClassPath: BytecodeOutline.jar
Bundle-Activator: de.loskutov.bco.BytecodeOutlinePlugin
Bundle-Vendor: Andrei Loskutov
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.MethodNode;
......@@ -62,8 +63,11 @@ public class DecompiledMethod {
formatText(inputText, new HashMap(), new StringBuffer(), this.text);
computeMaps(lineNumbers);
if (meth != null) {
if (meth != null &&
(meth.access & Opcodes.ACC_ABSTRACT)==0) {
analyzeMethod(owner, cl);
} else {
// System.out.println("\nabstr:" + (meth.access & Opcodes.ACC_ABSTRACT));
}
}
......
......@@ -919,6 +919,53 @@ public class JdtUtils {
return cl;
}
/**
* Check if java element is an interface or abstract method or a method from
* interface.
*/
public static boolean isAbstractOrInterface(IJavaElement javaEl) {
if (javaEl == null) {
return true;
}
boolean abstractOrInterface = false;
try {
switch (javaEl.getElementType()) {
case IJavaElement.CLASS_FILE :
abstractOrInterface = ((IClassFile) javaEl).isInterface();
break;
case IJavaElement.COMPILATION_UNIT :
ICompilationUnit cUnit = (ICompilationUnit) javaEl;
IType type = cUnit.findPrimaryType();
abstractOrInterface = type != null && type.isInterface();
break;
case IJavaElement.TYPE :
abstractOrInterface = ((IType) javaEl).isInterface();
break;
case IJavaElement.METHOD :
// test for "abstract" flag on method in a class
abstractOrInterface = Flags.isAbstract(((IMethod) javaEl)
.getFlags());
// "abstract" flags could be not exist on interface methods
if (!abstractOrInterface) {
IType ancestor = (IType) javaEl
.getAncestor(IJavaElement.TYPE);
abstractOrInterface = ancestor != null
&& ancestor.isInterface();
}
break;
default :
IType ancestor1 = (IType) javaEl
.getAncestor(IJavaElement.TYPE);
abstractOrInterface = ancestor1 != null
&& ancestor1.isInterface();
break;
}
} catch (JavaModelException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
}
return abstractOrInterface;
}
static class SourceOffsetComparator implements Comparator {
/**
......
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