// if (pNode.isOverrider()) {
// //this.setText("<overrider>");
// }
-
if (node.getMessage() != null) {
if (node.getMessage().getKind().equals(IMessage.WARNING)) {
setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon());
suite.addTestSuite(CompilerMessagesTest.class);
suite.addTestSuite(AsmDeclarationsTest.class);
suite.addTestSuite(AsmRelationshipsTest.class);
- suite.addTestSuite(ResourceCopyTestCase.class);
+// suite.addTestSuite(ResourceCopyTestCase.class);
//$JUnit-END$
return suite;
assertTrue("root exists", model.getRoot() != null);
File testFile = openFile("figures-coverage/figures/Main.java");
IProgramElement node = model.findNodeForSourceLine(testFile.getCanonicalPath(), 11);
-
assertTrue("find result", node != null);
-
- System.err.println("##### " + node);
-
IProgramElement pNode = (IProgramElement)((IProgramElement)node).getParent();
if (null == pNode) {
assertTrue("null parent of " + node, false);
public IProgramElement walk(HierarchyWalker walker);
public void setName(String name);
public void setChildren(List children);
+ public void setModifiers(int i);
/**
* Uses "typesafe enum" pattern.
public ProgramElement(
String name,
Kind kind,
- List modifiers,
+ int modifiers,
Accessibility accessibility,
String declaringType,
String packageName,
this(name, kind, children);
this.sourceLocation = sourceLocation;
this.kind = kind;
- this.modifiers = modifiers;
+ this.modifiers = genModifiers(modifiers);
this.accessibility = accessibility;
this.declaringType = declaringType;
this.packageName = packageName;
return getName();
}
- public static List genModifiers(int modifiers) {
+ private static List genModifiers(int modifiers) {
List modifiersList = new ArrayList();
if ((modifiers & AccStatic) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
if ((modifiers & AccFinal) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
if ((modifiers & AccTransient) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
if ((modifiers & AccNative) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
if ((modifiers & AccAbstract) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
- return modifiersList;
+ return modifiersList;
}
public static IProgramElement.Accessibility genAccessibility(int modifiers) {
if ((modifiers & AccPrivileged) != 0) return IProgramElement.Accessibility.PRIVILEGED;
else return IProgramElement.Accessibility.PACKAGE;
}
-
-
// XXX these names and values are from org.eclipse.jdt.internal.compiler.env.IConstants
private static int AccPublic = 0x0001;
walker.process(this);
return buffer.toString();
}
+ /**
+ *
+ */
+
+ public void setModifiers(int i) {
+ this.modifiers = genModifiers(i);
+ }
+
}
makeLocation(methodDeclaration),
methodDeclaration.modifiers,
"",
- new ArrayList());
+ new ArrayList());
formatter.genLabelAndKind(methodDeclaration, peNode);
genBytecodeInfo(methodDeclaration, peNode);
+ peNode.setModifiers(methodDeclaration.modifiers);
- // TODO: should improve determining what the main method is
+ // TODO: add return type test
if (peNode.getKind().equals(IProgramElement.Kind.METHOD)) {
- if (peNode.getName().equals("main")) {
+ if (peNode.getName().equals("main(String[])")
+ && peNode.getModifiers().contains(IProgramElement.Modifiers.STATIC)
+ && peNode.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC)) {
((IProgramElement)stack.peek()).setRunnable(true);
}
}
-
stack.push(peNode);
return true;
}