Menu

oopsla12-results

Alon Mishne

Below are some of the results found using Prime. Analysis Results is a collection of API-usage automata found using Prime. Search Results is a collection of automata found by Prime in response to a specific query.

In all cases, click the image for a larger, zoomable, image.

Analysis Results

Apache Commons CLI

The CLI library is a command-line-options parser.

The following example demonstrates how, even before consolidation, a very strong hasOption <--> getOptionValue loop, and how hasOption almost always starts that loop - because the programmers first check for the presence of a value before extracting it.

Apache Commons Net

The Net library deals with network communication.

The following example shows the single result found when investigating FTPTimestampParserImpl, and shows that it apparently used precisely the same why by all the found examples.

Eclipse JDT Core

The Eclipse JDT library is the Eclipse plugin which enables working with the Java language, and the Core package is responsible for, among others, Java parsing.

The following example shows an interesting common sequence getJavaProject --> getElementType --> getType / getDeclaringType / getParent --> exists.

The following example seems to indicate that the result from isBinary is used to determine whether isReadOnly is invoked.

The following example shows a few interesting facts:

  • Seems like you need to check isConstructor before getReturnType, possibly because Java constructors don't have an AST node for a return type.
  • Looks like resolveBinding is used to obtain an ITypeBinding from a Name or SimpleName.
  • Logically, isArray always precedes getElementType.

Basic Java Classes

The following example shows the dominant usage of StringBuffer class - which is the class created when writing + or += between strings in a Java source.

Search Results

All the queries here are brought in their abbreviated forms. In their full forms all known types are fully qualified and question marks are replaced with unknown method calls.

JDBC

A query which users a cached database manager to obtain a connection, then creates and runs a prepared statement and finally gets a double value form a specific field.

InitialContext ic = new InitialContext();
ic.?;
PreparedStatement ps = ic.?;
ResultSet rs = ps.executeQuery();
rs.?;
double d = rs.getDouble("column");

The result shows not only the full appropriate sequence - including how to get a Connection and how to set up a PreparedStatement - but also even show get how getLong is apparently very common after getDouble:

WebDriver

Looking for any sequence which uses a specific implementation of a WebDriver, that creates a WebElement from the WebDriver via a specific method, and that clears and then submits a web form.

WebDriver d = new FirefoxDriver();
d.?;
By by = ?;
WebElement e = d.findElement(by);
e.?;
e.clear();
e.?
e.submit();

The results shows that between clearing a textual field and submitting it, is very common to actually type in text in that field, via sendKeys. The three variations demonstrate the need to navigate to a web page before attempting to find a web element on it, via navigate, manage or get:



Apache CLI

Aiming to obtain a String from command-line arguments that adhere to the GNU style. The query only requires initialization of a GnuParser instance, and that at a certain point a String will be obtained from it.

GnuParser p = new GnuParser();
p.?;
String s = p.?;
s.?;

The results show how to parse a command-line and how to get a string from it - the first is by getting the entire command-line as a string, the second is by getting the string of a specific option, and the third is getting the value of an option, with first verifying the option was provided:




Related

Wiki: Home