Added the state of the HasAllMethodBodies flag in the issue 164 analyser. Looks like eclipse sometimes sets this flag even though

all method bodies are not in fact parsed yet, as a shortcut to try and force future eclipse parse runs to simply skip doing it
as a timesaver. D'oh.
This commit is contained in:
Reinier Zwitserloot committed 2011-08-01 11:21:24 +02:00
1 parent 6f8e8adf4c
commit ced7a8d554
1 file changed
+4 -1
@@ -5,12 +5,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
public class DebugSnapshot implements Comparable<DebugSnapshot> {
private static AtomicLong counter = new AtomicLong();
private final long when, id = counter.getAndIncrement();
private final long bits;
private final List<StackTraceElement> trace;
private final String threadName;
private final String message;
@@ -19,6 +21,7 @@ public class DebugSnapshot implements Comparable<DebugSnapshot> {
public DebugSnapshot(CompilationUnitDeclaration owner, int stackHiding, String message, Object... params) {
this.when = System.currentTimeMillis();
this.bits = owner.bits;
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
this.trace = new ArrayList<StackTraceElement>(Math.max(0, stackTrace.length - stackHiding - 1));
for (int i = 1 + stackHiding; i < stackTrace.length; i++) trace.add(stackTrace[i]);
@@ -42,7 +45,7 @@ public class DebugSnapshot implements Comparable<DebugSnapshot> {
public String shortToString() {
StringBuilder out = new StringBuilder();
out.append(String.format("WHEN: %14d THREAD: %s AST: %s", when, threadName, ownerName()));
out.append(String.format("WHEN: %14d THREAD: %s AST: %s HAMB: %b -- ", when, threadName, ownerName(), 0 != (bits & ASTNode.HasAllMethodBodies)));
if (message != null) out.append(" ").append(String.format(message, params));
return out.toString();
}