id stringlengths 7 14 | source stringlengths 135 41.2k | target stringlengths 36 20.4k | context_text stringlengths 183 4k | prompt_context stringlengths 0 1.52k | source_ctx stringlengths 198 41.2k | ctx_included bool 2
classes | static_status stringclasses 2
values | static_context stringlengths 1.96k 252k |
|---|---|---|---|---|---|---|---|---|
13899_11 | class IoUtils {
public static String readString(InputStream in, String charset) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int c;
while ((c = in.read()) > 0) {
out.write(c);
}
return new String(out.toByteArray(), charset);
}
private IoUtils();
public static int s... | final String first = "Hi there";
final String second = "Have a nice day!";
byte[] firstBytes = first.getBytes();
byte[] secondBytes = second.getBytes();
byte[] newBytes = new byte[firstBytes.length + secondBytes.length + 1];
System.arraycopy(firstBytes, 0, newBytes, 0, firstBytes.length);
System.arraycopy... | [FOCAL] public static String IoUtils.readString(InputStream in, String charset)
[CLASS] class IoUtils
[METRICS] loc=9 cc=2 branches=0 loops=1 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] InputStream.read/0, ByteArrayOutputStream.write/1, ByteArrayOutputStream.toByteArray/0
[NEW] ByteArrayOutputStream, String
[EXCEPTIO... | /* static context
[FOCAL] public static String IoUtils.readString(InputStream in, String charset)
[PATH1] while((c = in.read()) > 0)=T -> exit loop -> return new String(out.toByteArray(), charset)
[PATH2] while((c = in.read()) > 0)=F -> return new String(out.toByteArray(), charset)
[INPUTS] branches=in | result=charset... | /* static context
[FOCAL] public static String IoUtils.readString(InputStream in, String charset)
[PATH1] while((c = in.read()) > 0)=T -> exit loop -> return new String(out.toByteArray(), charset)
[PATH2] while((c = in.read()) > 0)=F -> return new String(out.toByteArray(), charset)
[INPUTS] branches=in | result=charset... | true | ok | {"focal": {"class": "IoUtils", "name": "readString", "signature": "String readString(InputStream in, String charset) throws IOException", "start_line": 3, "modifiers": "public static", "params": [{"name": "in", "type": "InputStream"}, {"name": "charset", "type": "String"}], "return_type": "String"}, "class_info": {"nam... |
32578_0 | class LookupManagerImpl implements LookupManager {
public List<LabelValue> getAllRoles() {
List<Role> roles = dao.getRoles();
List<LabelValue> list = new ArrayList<LabelValue>();
for (Role role1 : roles) {
list.add(new LabelValue(role1.getName(), role1.getName()));
}
... | log.debug("entered 'testGetAllRoles' method");
// set expected behavior on dao
Role role = new Role(Constants.ADMIN_ROLE);
final List<Role> testData = new ArrayList<Role>();
testData.add(role);
context.checking(new Expectations() {{
one(lookupDao).getRoles();... | [FOCAL] public List<LabelValue> LookupManagerImpl.getAllRoles()
[CLASS] class LookupManagerImpl implements LookupManager
[METRICS] loc=10 cc=2 branches=0 loops=1 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] dao.getRoles/0, List<LabelValue>.add/1, Role.getName/0
[NEW] ArrayList<LabelValue>, LabelValue
[PATH1] foreach(R... | /* static context
[FOCAL] public List<LabelValue> LookupManagerImpl.getAllRoles()
[PATH1] foreach(Role role1 : roles)=T -> exit loop -> return list
[PATH2] foreach(Role role1 : roles)=F -> return list
[COLLABORATORS] field dao getRoles/0
[NEW] ArrayList<LabelValue>, LabelValue
[CALLS-EXTERNAL] dao.getRoles/0, List<Labe... | /* static context
[FOCAL] public List<LabelValue> LookupManagerImpl.getAllRoles()
[PATH1] foreach(Role role1 : roles)=T -> exit loop -> return list
[PATH2] foreach(Role role1 : roles)=F -> return list
[COLLABORATORS] field dao getRoles/0
[NEW] ArrayList<LabelValue>, LabelValue
[CALLS-EXTERNAL] dao.getRoles/0, List<Labe... | true | ok | {"focal": {"class": "LookupManagerImpl", "name": "getAllRoles", "signature": "List<LabelValue> getAllRoles()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "List<LabelValue>"}, "class_info": {"name": "LookupManagerImpl", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "Lookup... |
56670_0 | class ClasspathScanner {
protected String getPackage() {
return pkg;
}
public ClasspathScanner(String pkg, boolean subpackages);
public ClasspathScanner(String pkg);
private void sanitizePackage(String pkgName);
protected ClassLoader getClassLoader();
protected boolean isJARPath... | scanner = new ClasspathScanner("org.hibernate.*");
assertEquals("Package was sanitized", "org/hibernate", scanner.getPackage());
}
} | [FOCAL] protected String ClasspathScanner.getPackage()
[CLASS] class ClasspathScanner
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CLASS-MEMBERS] ClasspathScanner(String pkg, boolean subpackages); ClasspathScanner(String pkg); void sanitizePackage(String pkgName); ClassLoader getClassLoader(); ... | /* static context
[FOCAL] protected String ClasspathScanner.getPackage()
*/
| /* static context
[FOCAL] protected String ClasspathScanner.getPackage()
*/
class ClasspathScanner {
protected String getPackage() {
return pkg;
}
public ClasspathScanner(String pkg, boolean subpackages);
public ClasspathScanner(String pkg);
private void sanitizePackage(String pkgName);... | true | ok | {"focal": {"class": "ClasspathScanner", "name": "getPackage", "signature": "String getPackage()", "start_line": 3, "modifiers": "protected", "params": [], "return_type": "String"}, "class_info": {"name": "ClasspathScanner", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"name": "s... |
56904_58 | class ForeignKeyListHolder {
public List<U> get() {
if (this.loaded == null) {
if (this.parent.isNew() || UnitTesting.isEnabled()) {
// parent is brand new, so don't bother hitting the database
this.loaded = new ArrayList<U>();
} else {
if (!UoW.isOpen()) {
throw new... | DummyDomainObject parent = new DummyDomainObject();
ForeignKeyListHolder<DummyDomainObject, DummyDomainObject> h = //
new ForeignKeyListHolder<DummyDomainObject, DummyDomainObject>(parent, null, null, null);
parent.setId(1l);
Assert.assertEquals(0, h.get().size());
}
} | [FOCAL] public List<U> ForeignKeyListHolder.get()
[CLASS] class ForeignKeyListHolder
[METRICS] loc=40 cc=8 branches=7 loops=0 returns=1 throws=2 nesting=5
[CALLS-INTERNAL] void eagerlyLoad(MapToList<Long, U> byParentId, Collection<Long> idsToLoad)
[CALLS-EXTERNAL] this.parent.isNew/0, UnitTesting.isEnabled/0, UoW.isOpe... | /* static context
[FOCAL] public List<U> ForeignKeyListHolder.get()
[THROWS-WHEN] DisconnectedException when this.loaded == null && !(this.parent.isNew() || UnitTesting.isEnabled()) && !UoW.isOpen()
[THROWS-WHEN] IllegalStateException when this.loaded == null && !(this.parent.isNew() || UnitTesting.isEnabled()) && UoW.... | /* static context
[FOCAL] public List<U> ForeignKeyListHolder.get()
[THROWS-WHEN] DisconnectedException when this.loaded == null && !(this.parent.isNew() || UnitTesting.isEnabled()) && !UoW.isOpen()
[THROWS-WHEN] IllegalStateException when this.loaded == null && !(this.parent.isNew() || UnitTesting.isEnabled()) && UoW.... | true | ok | {"focal": {"class": "ForeignKeyListHolder", "name": "get", "signature": "List<U> get()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "List<U>"}, "class_info": {"name": "ForeignKeyListHolder", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"n... |
74217_5 | class RecordPackageClassScanner {
public List<Class<?>> scan(List<String> packages) {
List<Class<?>> classes = new ArrayList<Class<?>>();
for (String packageName : packages) {
for (Class clazz : findClassesInPackage(packageName)) {
if (hasRecordAnnoation(clazz))
... | RecordPackageClassScanner scanner = new RecordPackageClassScanner();
List<Class<?>> classes = scanner.scan(Arrays.<String>asList("flapjack.test", "flapjack.test2"));
assertNotNull(classes);
assertTrue(classes.contains(User.class));
assertTrue(classes.contains(Phone.class));
... | [FOCAL] public List<Class<?>> RecordPackageClassScanner.scan(List<String> packages)
[CLASS] class RecordPackageClassScanner
[METRICS] loc=10 cc=4 branches=1 loops=2 returns=1 throws=0 nesting=3
[CALLS-INTERNAL] List<Class> findClassesInPackage(String packageName); boolean hasRecordAnnoation(Class clazz)
[CALLS-EXTERNAL... | /* static context
[FOCAL] public List<Class<?>> RecordPackageClassScanner.scan(List<String> packages)
[PATH1] foreach(String packageName : packages)=T -> foreach(Class clazz : findClassesInPackage(packageName))=T -> if(hasRecordAnnoation(clazz))=T -> exit loop -> exit loop -> return classes
[PATH2] foreach(String packa... | /* static context
[FOCAL] public List<Class<?>> RecordPackageClassScanner.scan(List<String> packages)
[PATH1] foreach(String packageName : packages)=T -> foreach(Class clazz : findClassesInPackage(packageName))=T -> if(hasRecordAnnoation(clazz))=T -> exit loop -> exit loop -> return classes
[PATH2] foreach(String packa... | true | ok | {"focal": {"class": "RecordPackageClassScanner", "name": "scan", "signature": "List<Class<?>> scan(List<String> packages)", "start_line": 3, "modifiers": "public", "params": [{"name": "packages", "type": "List<String>"}], "return_type": "List<Class<?>>"}, "class_info": {"name": "RecordPackageClassScanner", "kind": "cla... |
88960_47 | class PlainFormatter implements JSLintResultFormatter {
public String format(JSLintResult result) {
StringBuilder sb = new StringBuilder();
for (Issue issue : result.getIssues()) {
sb.append(outputOneIssue(issue));
}
return sb.toString();
}
public String footer(... | String nl = System.getProperty("line.separator");
String name = "foo/bar.js";
Issue issue = new IssueBuilder(name, 0, 0, "oops").evidence("BANG").build();
JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
StringBuilder sb = new StringBuilder(name... | [FOCAL] public String PlainFormatter.format(JSLintResult result)
[CLASS] class PlainFormatter implements JSLintResultFormatter
[METRICS] loc=7 cc=2 branches=0 loops=1 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] String outputOneIssue(Issue issue)
[CALLS-EXTERNAL] JSLintResult.getIssues/0, StringBuilder.append/1, Strin... | /* static context
[FOCAL] public String PlainFormatter.format(JSLintResult result)
[PATH1] foreach(Issue issue : result.getIssues())=T -> exit loop -> return sb.toString()
[PATH2] foreach(Issue issue : result.getIssues())=F -> return sb.toString()
[INPUTS] branches=result | result=-
[COLLABORATORS] param result:JSLintR... | /* static context
[FOCAL] public String PlainFormatter.format(JSLintResult result)
[PATH1] foreach(Issue issue : result.getIssues())=T -> exit loop -> return sb.toString()
[PATH2] foreach(Issue issue : result.getIssues())=F -> return sb.toString()
[INPUTS] branches=result | result=-
[COLLABORATORS] param result:JSLintR... | true | ok | {"focal": {"class": "PlainFormatter", "name": "format", "signature": "String format(JSLintResult result)", "start_line": 3, "modifiers": "public", "params": [{"name": "result", "type": "JSLintResult"}], "return_type": "String"}, "class_info": {"name": "PlainFormatter", "kind": "class", "modifiers": "", "superclass": nu... |
97620_0 | class ClassName {
public String get() {
return this.fullClassNameWithGenerics;
}
public ClassName(String fullClassNameWithGenerics);
public String toString();
public String getSimpleName();
public String getPackageName();
public List<String> getGenericsWithoutBounds();
public List<String> getGenericsWithB... | assertThat(//
new ClassName("java.util.Map<K, V>.Entry<K, V>").get(),
is("java.util.Map.Entry<K, V>"));
assertThat(//
new ClassName("java.util.Foo<K extends java.util.Bar<K>>.Entry<K extends java.util.Bar<K>>").get(),
is("java.util.Foo.Entry<K extends java.util.Bar<K>>"));
}
} | [FOCAL] public String ClassName.get()
[CLASS] class ClassName
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[FIELDS] read=fullClassNameWithGenerics
[CLASS-MEMBERS] ClassName(String fullClassNameWithGenerics); String toString(); String getSimpleName(); String getPackageName(); List<String> getGene... | /* static context
[FOCAL] public String ClassName.get()
[FIELDS] read=fullClassNameWithGenerics
*/
| /* static context
[FOCAL] public String ClassName.get()
[FIELDS] read=fullClassNameWithGenerics
*/
class ClassName {
public String get() {
return this.fullClassNameWithGenerics;
}
public ClassName(String fullClassNameWithGenerics);
public String toString();
public String getSimpleName();
public String getPa... | true | ok | {"focal": {"class": "ClassName", "name": "get", "signature": "String get()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "String"}, "class_info": {"name": "ClassName", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"name": "ClassName", "kind... |
103035_6 | class JMXAgent implements NotificationListener {
public static boolean unregisterMBean(ObjectName oName) {
boolean unregistered = false;
if (null != oName) {
try {
if (mbs.isRegistered(oName)) {
log.debug("Mbean is registered");
mbs.unregisterMBean(oName);
//set flag based on registration st... | logger.info("Default jmx domain: {}", JMXFactory.getDefaultDomain());
JMXAgent agent = new JMXAgent();
agent.init();
MBeanServer mbs = JMXFactory.getMBeanServer();
//create a new mbean for this instance
ObjectName oName = JMXFactory.createMBean(
"org.red5.server.net.rtmp.RTMPMinaConnection",
"connec... | [FOCAL] public static boolean JMXAgent.unregisterMBean(ObjectName oName)
[CLASS] class JMXAgent implements NotificationListener
[METRICS] loc=19 cc=4 branches=2 loops=0 returns=1 throws=0 nesting=3
[CALLS-EXTERNAL] mbs.isRegistered/1, log.debug/1, mbs.unregisterMBean/1, log.warn/2
[EXCEPTIONS] catches Exception e
[PATH... | /* static context
[FOCAL] public static boolean JMXAgent.unregisterMBean(ObjectName oName)
[PATH1] if(null != oName)=T -> try-body throws -> return unregistered
[PATH2] if(null != oName)=F -> return unregistered
[PATH3] if(null != oName)=T -> if(mbs.isRegistered(oName))=T -> return unregistered
[PATH4] if(null != oName... | /* static context
[FOCAL] public static boolean JMXAgent.unregisterMBean(ObjectName oName)
[PATH1] if(null != oName)=T -> try-body throws -> return unregistered
[PATH2] if(null != oName)=F -> return unregistered
[PATH3] if(null != oName)=T -> if(mbs.isRegistered(oName))=T -> return unregistered
[PATH4] if(null != oName... | true | ok | {"focal": {"class": "JMXAgent", "name": "unregisterMBean", "signature": "boolean unregisterMBean(ObjectName oName)", "start_line": 3, "modifiers": "public static", "params": [{"name": "oName", "type": "ObjectName"}], "return_type": "boolean"}, "class_info": {"name": "JMXAgent", "kind": "class", "modifiers": "", "superc... |
121672_32 | class Fields implements Comparable, Iterable<Comparable>, Serializable, Comparator<Tuple> {
public Fields appendSelector( Fields fields )
{
return appendInternal( fields, true );
}
protected Fields( Kind kind );
public Fields();
@ConstructorProperties({"fields"}) public Fields( Comparab... | Fields fieldA = new Fields( 0, -1 );
Fields fieldB = new Fields( -1 );
try
{
Fields appended = fieldA.appendSelector( fieldB );
fail();
}
catch( Exception exception )
{
// ignore
}
}
} | [FOCAL] public Fields Fields.appendSelector(Fields fields)
[CLASS] class Fields implements Comparable, Iterable<Comparable>, Serializable, Comparator<Tuple>
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] Fields appendInternal(Fields fields, boolean isSelect)
[INPUTS] branches=- | ... | /* static context
[FOCAL] public Fields Fields.appendSelector(Fields fields)
[INPUTS] branches=- | result=fields
[CALLS-INTERNAL] Fields appendInternal(Fields fields, boolean isSelect)
*/
| /* static context
[FOCAL] public Fields Fields.appendSelector(Fields fields)
[INPUTS] branches=- | result=fields
[CALLS-INTERNAL] Fields appendInternal(Fields fields, boolean isSelect)
*/
class Fields implements Comparable, Iterable<Comparable>, Serializable, Comparator<Tuple> {
public Fields appendSelector( Field... | true | ok | {"focal": {"class": "Fields", "name": "appendSelector", "signature": "Fields appendSelector(Fields fields)", "start_line": 3, "modifiers": "public", "params": [{"name": "fields", "type": "Fields"}], "return_type": "Fields"}, "class_info": {"name": "Fields", "kind": "class", "modifiers": "", "superclass": null, "interfa... |
123235_12 | class PubkeyUtils {
public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException,
InvalidKeySpecException {
final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded));
final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded);
final KeyFactory kf = KeyFactory.getInst... | KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8);
DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic();
assertEquals(DSA_KEY_pub, pubKey.getY());
DSAParams params = pubKey.getParams();
assertEquals(params.getG(), DSA_KEY_G);
assertEquals(params.getP(), DSA_KEY_P);
assertEquals(params.getQ(), DSA_K... | [FOCAL] public static KeyPair PubkeyUtils.recoverKeyPair(byte[] encoded)
[CLASS] class PubkeyUtils
[METRICS] loc=11 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] PublicKey recoverPublicKey(KeyFactory kf, PrivateKey priv); String getAlgorithmForOid(String oid); String getOidFromPkcs8Encoded(byte[... | /* static context
[FOCAL] public static KeyPair PubkeyUtils.recoverKeyPair(byte[] encoded)
[INPUTS] branches=- | result=encoded
[EXCEPTIONS] declares NoSuchAlgorithmException, InvalidKeySpecException
[CALLS-INTERNAL] PublicKey recoverPublicKey(KeyFactory kf, PrivateKey priv); String getAlgorithmForOid(String oid); Stri... | /* static context
[FOCAL] public static KeyPair PubkeyUtils.recoverKeyPair(byte[] encoded)
[INPUTS] branches=- | result=encoded
[EXCEPTIONS] declares NoSuchAlgorithmException, InvalidKeySpecException
[CALLS-INTERNAL] PublicKey recoverPublicKey(KeyFactory kf, PrivateKey priv); String getAlgorithmForOid(String oid); Stri... | true | ok | {"focal": {"class": "PubkeyUtils", "name": "recoverKeyPair", "signature": "KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException", "start_line": 3, "modifiers": "public static", "params": [{"name": "encoded", "type": "byte[]"}], "return_type": "KeyPair"}, "class_info": {"name":... |
End of preview. Expand in Data Studio
methods2test_small (cleaned) + static method-level context
Static context for unit-test generation, computed with tree-sitter from each row's source only
(no repository checkout; target is never read).
Configs
default: train / validation / test fromNDe2V/methods2test_small_cleaned@3d6a2f2061736202832b7ac2bb4e84e1c70668e8methods2test_runnable: test fromandstor/methods2test_runnable(fm+fc+c+m+f+t+tc) @ed8cded666b2f7d101ba04a7a8d121b6249d8c39
Added columns
| column | meaning |
|---|---|
static_context |
JSON string: focal, class_info, ast, cfg, dfg, cdg, paths, calls, types, fields, exceptions, metrics, test_case, test_hints, context_text |
context_text |
full text summary |
prompt_context |
compact Java comment actually used in the prompt ("" if dropped) |
source_ctx |
prompt_context + source: ready-to-use prompt for Salesforce/codegen-350M-multi within 2048 tokens |
ctx_included |
whether context fit the token budget |
static_status |
ok / partial / error |
import json
from datasets import load_dataset
ds = load_dataset("NDe2V/methods2test_small_static", "default", split="train")
sc = json.loads(ds[0]["static_context"]) # nested AST/CFG/DFG/...
- Downloads last month
- 33