private String getRefDescriptor(ASTNode ref) { if (ref instanceof FieldNode) { FieldNode f = (FieldNode) ref; return "the field " + f.getName() + " "; } else if (ref instanceof PropertyNode) { PropertyNode p = (PropertyNode) ref; return "the property " + p.getName() + " "; } else if (ref instanceof ConstructorNode) { return "the constructor " + ref.getText() + " "; } else if (ref instanceof MethodNode) { return "the method " + ref.getText() + " "; } else if (ref instanceof ClassNode) { return "the super class " + ref + " "; } return "<unknown with class " + ref.getClass() + "> "; }
public void addCompileWarning(String msg, ASTNode node) { Token token = new Token(Types.UNKNOWN, node.getText(), node.getLineNumber(), node.getColumnNumber()); sourceUnit .getErrorCollector() .addWarning(WarningMessage.POSSIBLE_ERRORS, msg, token, sourceUnit); }
/** * @param inferredElement * @return */ private String createLabel(ASTNode inferredElement) { if (inferredElement instanceof PropertyNode) { inferredElement = ((PropertyNode) inferredElement).getField(); } String label; if (inferredElement instanceof ClassNode) { label = createClassLabel((ClassNode) inferredElement); } else if (inferredElement instanceof MethodNode) { label = createMethodLabel((MethodNode) inferredElement); } else if (inferredElement instanceof FieldNode) { label = createFieldLabel((FieldNode) inferredElement); } else { label = inferredElement.getText(); } return "<b>" + label + "</b><br>\n"; }