_id
stringlengths
2
7
title
stringclasses
1 value
partition
stringclasses
3 values
text
stringlengths
25
15k
language
stringclasses
1 value
meta_information
dict
c0
train
int r = (int) params >> 8 & 0xff; int p = (int) params & 0xff; byte[] derived1 = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32); if (derived0.length != derived1.length) return false; int result = 0; for (int i = 0; i < derived0.length; i++) { result |= derived0[i] ^ derived1[i]; } return result == 0; } catch (UnsupportedEncodingException e) { throw new IllegalStateException("JVM doesn't support UTF-8?"); } catch (GeneralSecurityException e) { throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?"); } }
java
{ "resource": "" }
c1
train
os); } } } } String msg = String.format("Unsupported platform %s %s", osArch, osName); throw new UnsupportedPlatformException(msg); }
java
{ "resource": "" }
c2
train
} return (T) metaDataMap.get(key); }
java
{ "resource": "" }
c3
train
new ListHashMap(); } metaDataMap.putAll(other.metaDataMap); }
java
{ "resource": "" }
c4
train
Object old = metaDataMap.put(key,value); if (old!=null) throw new GroovyBugError("Tried to overwrite existing meta data "+this+"."); }
java
{ "resource": "" }
c5
train
null key on " + this + "."); if (metaDataMap == null) { metaDataMap = new ListHashMap(); } return metaDataMap.put(key, value); }
java
{ "resource": "" }
c6
train
null) { return; } metaDataMap.remove(key); }
java
{ "resource": "" }
c7
train
} if (tempFrom > tempTo) { return new RangeInfo(inclusive ? tempTo : tempTo + 1, tempFrom + 1, true); } return new RangeInfo(tempFrom, inclusive ? tempTo + 1 : tempTo, false); }
java
{ "resource": "" }
c8
train
params(param(propertyNode.getType(), "value")), ClassNode.EMPTY_ARRAY, setterBlock); setter.setSynthetic(true); // add it to the class declaringClass.addMethod(setter); }
java
{ "resource": "" }
c9
train
} catch (NullPointerException npe) { GroovyBugError gbe = new GroovyBugError("unexpected NullpointerException", npe); changeBugText(gbe, context); throw gbe; } catch (GroovyBugError e) { changeBugText(e, context); throw e; } catch (NoClassDefFoundError e) { // effort to get more logging in case a dependency of a class is loaded // although it shouldn't have convertUncaughtExceptionToCompilationError(e); } catch (Exception e) { convertUncaughtExceptionToCompilationError(e); } } getErrorCollector().failIfErrors(); }
java
{ "resource": "" }
c10
train
OutputStream temp2 = output; output = null; temp2.close(); return result; } finally { closeWithWarning(input); closeWithWarning(output); } }
java
{ "resource": "" }
c11
train
null; temp2.close(); temp2 = output; output = null; temp2.close(); return result; } finally { closeWithWarning(ois); closeWithWarning(input); closeWithWarning(oos); closeWithWarning(output); } }
java
{ "resource": "" }
c12
train
for (int i = 0; i < size; i++) { paramTypes[i] = getParameterType(i); } return new DefaultMethodKey(sender, name, paramTypes, isCallToSuper); }
java
{ "resource": "" }
c13
train
helpers); superCallTransformer.visitClass(cNode); if (unit!=null) { ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader()); collector.visitClass(cNode); } } } }
java
{ "resource": "" }
c14
train
exception = ((SyntaxErrorMessage) message).getCause(); } return exception; }
java
{ "resource": "" }
c15
train
tokens.add(iter.next()); } } }
java
{ "resource": "" }
c16
train
equal for (int i = 0; i < params.length; i++) { ClassNode paramType = params[i].getType(); ClassNode argType = args[i]; if (!isAssignableTo(argType, paramType)) return -1; else { if (!paramType.equals(argType)) dist+=getDistance(argType, paramType); } } return dist; }
java
{ "resource": "" }
c17
train
for (int i = params.length; i < args.length; i++) { if (!isAssignableTo(args[i],vargsBase)) return -1; else if (!args[i].equals(vargsBase)) dist+=getDistance(args[i], vargsBase); } return dist; }
java
{ "resource": "" }
c18
train
1].getType(); ClassNode ptype = lastParamType.getComponentType(); ClassNode arg = args[args.length - 1]; if (isNumberType(ptype) && isNumberType(arg) && !ptype.equals(arg)) return -1; return isAssignableTo(arg, ptype)?Math.min(getDistance(arg, lastParamType), getDistance(arg, ptype)):-1; }
java
{ "resource": "" }
c19
train
Parameter component = buildParameter(genericFromReceiver, placeholdersFromContext, subMethodParameter, componentType); return new Parameter(component.getType().makeArray(), component.getName()); } ClassNode resolved = resolveClassNodeGenerics(genericFromReceiver, placeholdersFromContext, paramType); return new Parameter(resolved, methodParameter.getName()); }
java
{ "resource": "" }
c20
train
genericsTypes!=null && !genericsTypes[0].isPlaceholder() && !genericsTypes[0].isWildcard(); }
java
{ "resource": "" }
c21
train
return splitEachLine(new BufferedReader(new InputStreamReader(stream, charset)), regex, closure); }
java
{ "resource": "" }
c22
train
temp2 = writer; writer = null; temp2.close(); Reader temp1 = self; self = null; temp1.close(); } finally { closeWithWarning(self); closeWithWarning(writer); } }
java
{ "resource": "" }
c23
train
self = null; temp.close(); return result; } finally { DefaultGroovyMethodsSupport.closeWithWarning(self); } }
java
{ "resource": "" }
c24
train
java.lang.reflect.Array.getLength(object); }
java
{ "resource": "" }
c25
train
String wrappedType = getWrappedClassDescriptor(arg); mv.visitMethodInsn(INVOKESTATIC, wrappedType, "valueOf", "(" + arg.getDescriptor() + ")L" + wrappedType + ";", false); } else { mv.visitVarInsn(ALOAD, idx); // load argument i } size = Math.max(size, 5+registerLen(arg)); idx += registerLen(arg); mv.visitInsn(AASTORE); // store value into array } mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/InvokerHelper", "invokeMethod", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", false); unwrapResult(mv, desc); mv.visitMaxs(size, registerLen(args) + 1); return mv; }
java
{ "resource": "" }
c26
train
if (res!=null) return null; res = mi; } return res; } else { LinkedList<Method> methods = new LinkedList(); getAbstractMethods(c, methods); if (methods.isEmpty()) return null; ListIterator<Method> it = methods.listIterator(); while (it.hasNext()) { Method m = it.next(); if (hasUsableImplementation(c, m)) it.remove(); } return getSingleNonDuplicateMethod(methods); } }
java
{ "resource": "" }
c27
train
// JDK 8 support for default methods in interfaces // this should probably be strenghtened when we support the A.super.foo() syntax int opcode = declaringClass.isInterface()?INVOKEINTERFACE:INVOKESPECIAL; mv.visitMethodInsn(opcode, BytecodeHelper.getClassInternalName(declaringClass), method.getName(), methodDescriptor, opcode == INVOKEINTERFACE); BytecodeHelper.doReturn(mv, method.getReturnType()); mv.visitMaxs(0, 0); mv.visitEnd(); controller.getClassNode().addMethod(name, ACC_PUBLIC | ACC_SYNTHETIC, method.getReturnType(), parameters, null, null); } }
java
{ "resource": "" }
c28
train
return Long_TYPE; } else if (cn==float_TYPE) { return Float_TYPE; } else if (cn==double_TYPE) { return Double_TYPE; } else if (cn==VOID_TYPE) { return void_WRAPPER_TYPE; } else { return cn; } }
java
{ "resource": "" }
c29
train
List<MethodNode> methods = type.getAbstractMethods(); MethodNode found = null; if (methods!=null) { for (MethodNode mi : methods) { if (!hasUsableImplementation(type, mi)) { if (found!=null) return null; found = mi; } } } return found; } }
java
{ "resource": "" }
c30
train
return 40; case MULTIPLY: case DIVIDE: case INTDIV: case MOD: return 45; case NOT: case REGEX_PATTERN: return 50; case SYNTH_CAST: return 55; case PLUS_PLUS: case MINUS_MINUS: case PREFIX_PLUS_PLUS: case PREFIX_MINUS_MINUS: case POSTFIX_PLUS_PLUS: case POSTFIX_MINUS_MINUS: return 65; case PREFIX_PLUS: case PREFIX_MINUS: return 70; case POWER: return 72; case SYNTH_METHOD: case LEFT_SQUARE_BRACKET: return 75; case DOT: case NAVIGATE: return 80; case KEYWORD_NEW: return 85; } if( throwIfInvalid ) { throw new GroovyBugError( "precedence requested for non-operator" ); } return -1; }
java
{ "resource": "" }
c31
train
return DefaultGroovyMethods.with( null, closure ) ; }
java
{ "resource": "" }
c32
train
boolean methodMatch = mn.getName().equals(methodName); if(methodMatch)return true; // TODO Implement further parameter analysis } } return false; }
java
{ "resource": "" }
c33
train
} Parameter param = parameters[i]; buf.append(formatTypeName(param.getType())); } buf.append(')'); typeDescriptor = buf.toString(); } return typeDescriptor; }
java
{ "resource": "" }
c34
train
return AstToTextHelper.getModifiersText(modifiers) + " " + retType + " " + name + "(" + parms + ") " + exceptionTypes + " { ... }"; }
java
{ "resource": "" }
c35
train
constructors.toArray(new GroovyConstructorDoc[constructors.size()]); }
java
{ "resource": "" }
c36
train
nested.toArray(new GroovyClassDoc[nested.size()]); }
java
{ "resource": "" }
c37
train
fields.toArray(new GroovyFieldDoc[fields.size()]); }
java
{ "resource": "" }
c38
train
properties.toArray(new GroovyFieldDoc[properties.size()]); }
java
{ "resource": "" }
c39
train
enumConstants.toArray(new GroovyFieldDoc[enumConstants.size()]); }
java
{ "resource": "" }
c40
train
methods.toArray(new GroovyMethodDoc[methods.size()]); }
java
{ "resource": "" }
c41
train
} int answer = executeUpdate(buildListQuery(map), new ArrayList<Object>(map.values())); if (answer != 1) { LOG.warning("Should have updated 1 row not " + answer + " when trying to add: " + map); } }
java
{ "resource": "" }
c42
train
eachRow(getSql(), getParameters(), offset, maxRows, closure); }
java
{ "resource": "" }
c43
train
// create a local variable to hold the old value from the getter block.addStatement(declS(oldValue, callThisX(getterName))); // add the fireVetoableChange method call block.addStatement(stmt(callThisX("fireVetoableChange", args( constX(propertyName), oldValue, proposedValue)))); // call the existing block, which will presumably set the value properly block.addStatement(code); if (bindable) { // get the new value to emit in the event block.addStatement(declS(newValue, callThisX(getterName))); // add the firePropertyChange method call block.addStatement(stmt(callThisX("firePropertyChange", args(constX(propertyName), oldValue, newValue)))); } // replace the existing code block with our new one setter.setCode(block); } }
java
{ "resource": "" }
c44
train
doCall(Object[] args) { size[0] += ((File) args[0]).length(); } }); return size[0]; }
java
{ "resource": "" }
c45
train
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure); }
java
{ "resource": "" }
c46
train
writer.flush(); Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
java
{ "resource": "" }
c47
train
Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
java
{ "resource": "" }
c48
train
writeUTF16BomIfRequired(charset, out); } writer = new OutputStreamWriter(out, charset); InvokerHelper.write(writer, text); writer.flush(); Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
java
{ "resource": "" }
c49
train
appendBuffered(file, writer, charset); }
java
{ "resource": "" }
c50
train
else { stream.write(-1); stream.write(-2); } }
java
{ "resource": "" }
c51
train
null; synchronized (classCache) { return classCache.get(name); } }
java
{ "resource": "" }
c52
train
ret.addAll(nonRemoveableChangeListenerList); ret.addAll(changeListenerList); return ret.toArray(new MetaClassRegistryChangeEventListener[ret.size()]); } }
java
{ "resource": "" }
c53
train
} else { if (instanceExclude == null) { instanceExclude = new MetaClassRegistryImpl(DONT_LOAD_DEFAULT); } return instanceExclude; } }
java
{ "resource": "" }
c54
train
element = (CSTNode)elements.get( index ); } return element; }
java
{ "resource": "" }
c55
train
if necessary. int count = elements.size(); if( index >= count ) { for( int i = count; i <= index; i++ ) { elements.add( null ); } } // // Then set in the element. elements.set( index, element ); return element; }
java
{ "resource": "" }
c56
train
tail; if (tail != null) tail.next = element; tail = element; if (head == null) head = element; }
java
{ "resource": "" }
c57
train
it.hasNext();) { T val = it.next(); if (val != null) array.add(val); } return array.toArray(tArray); }
java
{ "resource": "" }
c58
train
MapItemValue miv = (MapItemValue) item; if (key.equals(miv.name.toValue())) { return miv.value; } } return null; } else { if (map == null) buildIfNeededMap(); return map.get(key); } }
java
{ "resource": "" }
c59
train
return toList((Iterable<T>) unique(toList(self))).listIterator(); }
java
{ "resource": "" }
c60
train
numberAwareComparator = new NumberAwareComparator<Comparable>(); return numberAwareComparator.compare(self, other); }
java
{ "resource": "" }
c61
train
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) { if (bcw.call(iter.next())) return true; } return false; }
java
{ "resource": "" }
c62
train
if (result == null) return defaultResult; return result; }
java
{ "resource": "" }
c63
train
List<T> groupedElements = new ArrayList<T>(); groupedElements.add(element); answer.put(value, groupedElements); } }
java
{ "resource": "" }
c64
train
? extends V> self) { return Collections.unmodifiableMap(self); }
java
{ "resource": "" }
c65
train
return Collections.unmodifiableSortedMap(self); }
java
{ "resource": "" }
c66
train
return Collections.unmodifiableList(self); }
java
{ "resource": "" }
c67
train
return Collections.unmodifiableSet(self); }
java
{ "resource": "" }
c68
train
return Collections.unmodifiableSortedSet(self); }
java
{ "resource": "" }
c69
train
return sort(self, true, comparator); }
java
{ "resource": "" }
c70
train
if (self.add(next)) changed = true; } return changed; }
java
{ "resource": "" }
c71
train
if (self.add(next)) changed = true; } return changed; }
java
{ "resource": "" }
c72
train
if (DefaultTypeTransformation.compareEqual(e1, e2)) { ansMap.remove(e1.getKey()); } } } } return ansMap; }
java
{ "resource": "" }
c73
train
if (i < startIndex) { continue; } if (bcw.call(value)) { result = i; } } return result; }
java
{ "resource": "" }
c74
train
return findIndexValues(self, 0, closure); }
java
{ "resource": "" }
c75
train
if (count < startCount) { continue; } if (bcw.call(value)) { result.add(count); } } return result; }
java
{ "resource": "" }
c76
train
return replaceDelegate().getProperty(property); } } return myMetaClass.getProperty(this, property); }
java
{ "resource": "" }
c77
train
) { return new SimpleMessage( text, data, owner); }
java
{ "resource": "" }
c78
train
while (iterator.hasNext()) { list.add(curryDelegateAndGetContent(closure, iterator.next())); } val = list; } else { val = Arrays.asList(arr); } } content.put(name, val); return val; }
java
{ "resource": "" }
c79
train
null) variables = new LinkedHashMap(); variables.put(name, value); }
java
{ "resource": "" }
c80
train
//TODO: create a WriteOnlyException class? throw new GroovyRuntimeException("Cannot read write-only property: " + name); } return getter.invoke(object, MetaClassHelper.EMPTY_ARRAY); }
java
{ "resource": "" }
c81
train
} throw new GroovyRuntimeException("Cannot set read-only property: " + name); } newValue = DefaultTypeTransformation.castToType(newValue, getType()); setter.invoke(object, new Object[]{newValue}); }
java
{ "resource": "" }
c82
train
= Modifier.PROTECTED; if (Modifier.isPrivate(modifiers)) visibility = Modifier.PRIVATE; int states = getter.getModifiers() & setter.getModifiers(); states &= ~(Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE); states |= visibility; return states; }
java
{ "resource": "" }
c83
train
&& ((cNode.isInterface() && !cNode.getAnnotations(TRAIT_CLASSNODE).isEmpty()) || isAnnotatedWithTrait(cNode)); }
java
{ "resource": "" }
c84
train
String methodDescriptor = BytecodeHelper.getMethodDescriptor(method.getReturnType(), method.getParameterTypes()); if (desc.equals(methodDescriptor)) { return method; } } return null; }
java
{ "resource": "" }
c85
train
found = SEGMENT.array[pos + i] == c; if (!MATCH_CASE_CHECKBOX.isSelected() && !found) { c = Character.isUpperCase(c) ? Character.toLowerCase(c) : Character.toUpperCase(c); found = SEGMENT.array[pos + i] == c; } } } if (!found) { pos += backwards ? -1 : 1; if (pos == end && wrapped) { pos = backwards ? SEGMENT.getEndIndex() : 0; end = start; wrapped = false; } } } pos = found ? pos : -1; } return pos; }
java
{ "resource": "" }
c86
train
= new SwitchPoint(); synchronized(IndyInterface.class) { SwitchPoint.invalidateAll(new SwitchPoint[]{old}); } }
java
{ "resource": "" }
c87
train
return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false); }
java
{ "resource": "" }
c88
train
target to one, // that does the method selection including the the direct call to the // real method. MutableCallSite mc = new MutableCallSite(type); MethodHandle mh = makeFallBack(mc,caller.lookupClass(),name,callID,type,safe,thisCall,spreadCall); mc.setTarget(mh); return mc; }
java
{ "resource": "" }
c89
train
= new Insets(cellpadding, cellpadding, cellpadding, cellpadding); add(cell.getComponent(), constraints); }
java
{ "resource": "" }
c90
train
} else { txt += "The sources " + nodeSource.getName() + " and " + storedSource.getName() + " each contain a class with the name " + node.getName() + ".\n"; } nodeSource.getErrorCollector().addErrorAndContinue( new SyntaxErrorMessage(new SyntaxException(txt, node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()), nodeSource) ); } classes.put(name, node); if (classesToCompile.containsKey(name)) { ClassNode cn = classesToCompile.get(name); cn.setRedirect(node); classesToCompile.remove(name); } }
java
{ "resource": "" }
c91
train
changedPath.replace(File.separatorChar, '/'); return changedPath; }
java
{ "resource": "" }
c92
train
Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
java
{ "resource": "" }
c93
train
Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
java
{ "resource": "" }
c94
train
// we get to the end to avoid JDK library bug (see GROOVY-5858) if (idx < answer) break; ++answer; } return answer; }
java
{ "resource": "" }
c95
train
eachMatch(self.toString(), regex.toString(), closure); return self; }
java
{ "resource": "" }
c96
train
options={"List<String>","String[]"}) Closure closure) { return eachMatch(self, Pattern.compile(regex), closure); }
java
{ "resource": "" }
c97
train
builder.deleteCharAt(index); for (int i = 0; i < count; i++) builder.insert(index, " "); s = builder.toString(); } return s; }
java
{ "resource": "" }
c98
train
return find(self.toString(), Pattern.compile(regex.toString()), closure); }
java
{ "resource": "" }
c99
train
} else if (value instanceof Collection) { answer.append(getAt(self, (Collection) value)); } else { int idx = DefaultTypeTransformation.intUnbox(value); answer.append(getAt(self, idx)); } } return answer.toString(); }
java
{ "resource": "" }

Employing the MTEB evaluation framework's dataset version, utilize the code below for assessment:

import mteb
import logging
from sentence_transformers import SentenceTransformer
from mteb import MTEB

logger = logging.getLogger(__name__)

model_name = 'intfloat/e5-base-v2'
model = SentenceTransformer(model_name)
tasks = mteb.get_tasks(
    tasks=[
        "AppsRetrieval",
        "CodeFeedbackMT",
        "CodeFeedbackST",
        "CodeTransOceanContest",
        "CodeTransOceanDL",
        "CosQA",
        "SyntheticText2SQL",
        "StackOverflowQA",
        "COIRCodeSearchNetRetrieval",
        "CodeSearchNetCCRetrieval",
    ]
)
evaluation = MTEB(tasks=tasks)
results = evaluation.run(
    model=model,
    overwrite_results=True
)
print(result)

Employing the MTEB evaluation framework's dataset version, utilize the code below for assessment:

import mteb
import logging
from sentence_transformers import SentenceTransformer
from mteb import MTEB

logger = logging.getLogger(__name__)

model_name = 'intfloat/e5-base-v2'
model = SentenceTransformer(model_name)
tasks = mteb.get_tasks(
    tasks=[
        "AppsRetrieval",
        "CodeFeedbackMT",
        "CodeFeedbackST",
        "CodeTransOceanContest",
        "CodeTransOceanDL",
        "CosQA",
        "SyntheticText2SQL",
        "StackOverflowQA",
        "COIRCodeSearchNetRetrieval",
        "CodeSearchNetCCRetrieval",
    ]
)
evaluation = MTEB(tasks=tasks)
results = evaluation.run(
    model=model,
    overwrite_results=True
)
print(result)
Downloads last month
308